v1.2.10
This commit is contained in:
@@ -18,7 +18,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
public static class Version
|
||||
{
|
||||
private static String version { get; } = "1.2.9.2";
|
||||
private static String version { get; } = "1.2.10.0";
|
||||
// Retrieve version.
|
||||
public static String GetFullVersion () { return version; }
|
||||
public static String GetAppVersion ()
|
||||
@@ -40,6 +40,8 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// Version history.
|
||||
//-------------------------------------------------------------------
|
||||
// 1.2.10 11-Oct-2022
|
||||
// - Online organisations display issue fixed.
|
||||
// 1.2.9 12-Oct-2022
|
||||
// - Online Sports Experience update bug resolved.
|
||||
// - Sports Experience Awards.
|
||||
|
||||
@@ -42,8 +42,15 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
public enum Application
|
||||
{
|
||||
Admin,
|
||||
Online,
|
||||
Online = 100,
|
||||
Admin = 900,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
public enum Database
|
||||
{
|
||||
Core = 10,
|
||||
Support = 20,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -155,6 +162,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
/* Do not change the values - tied to database. */
|
||||
Journalist,
|
||||
SystemAdmin,
|
||||
SystemReviewer,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -20,8 +20,8 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
// Properties.
|
||||
public abstract SaxSystem System { get; }
|
||||
public abstract SaxConsoleHelper ConsoleHelper { get; }
|
||||
public abstract ISacsDatabase GetCoreDatabase(SaxSessionContext sessionContext);
|
||||
public abstract IDatabaseInfo CreateCoreDbInfo(SaxSessionContext sessionContext);
|
||||
public abstract ISacsDatabase GetDatabase(SaxSessionContext sessionContext, Sax.Database databaseType);
|
||||
public abstract IDatabaseInfo CreateDbInfo(SaxSessionContext sessionContext, Sax.Database databaseType);
|
||||
// Application instance.
|
||||
public abstract Sax.InstanceType InstanceType { get; }
|
||||
public bool IsLiveHost() { return InstanceType == Sax.InstanceType.Production; }
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Tue 15-Nov-2022 13:33:16
|
||||
// Code generated by Sarand Database Utilities Tue 6-Dec-2022 18:22:59
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Base.App
|
||||
{
|
||||
@@ -379,6 +379,7 @@ namespace Saxonite.Base.App
|
||||
UserSport_UserAccountId,
|
||||
UserSport_SportId,
|
||||
UserSport_About,
|
||||
UserSport_ContactsData,
|
||||
UserSport_Participation,
|
||||
UserSport_Officiating,
|
||||
UserSport_UserSportData,
|
||||
@@ -420,7 +421,7 @@ namespace Saxonite.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private static readonly int tableCount = 22;
|
||||
private static readonly int columnCount = 369;
|
||||
private static readonly int columnCount = 370;
|
||||
private static ulong maxTextLen = 0;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -947,6 +948,7 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(21,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(21,"SportId",4,4,false,10),
|
||||
new ColumnDfn(21,"About",0,-9,false,2000),
|
||||
new ColumnDfn(21,"ContactsData",0,-9,false,0),
|
||||
new ColumnDfn(21,"Participation",3,5,false,5),
|
||||
new ColumnDfn(21,"Officiating",3,5,false,5),
|
||||
new ColumnDfn(21,"UserSportData",0,-9,false,0),
|
||||
|
||||
@@ -0,0 +1,288 @@
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Tue 6-Dec-2022 18:22:59
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Base.App
|
||||
{
|
||||
public class SaxDbDfn_Support
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Table identifiers.
|
||||
public enum TableIdx
|
||||
{
|
||||
Unknown = 0,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Column identifiers.
|
||||
public enum ColumnIdx
|
||||
{
|
||||
Unknown = 0,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private static readonly int tableCount = 0;
|
||||
private static readonly int columnCount = 0;
|
||||
private static ulong maxTextLen = 0;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve Table details (eg. name: 'Company').
|
||||
public static int GetTableCount ()
|
||||
{
|
||||
return tableCount;
|
||||
}
|
||||
public static String GetTableName (TableIdx table, bool delimitReservedWords = true)
|
||||
{
|
||||
int tableIdx = (int)table - 1;
|
||||
if (tableIdx < 0 || tableIdx >= tableCount) return String.Empty;
|
||||
String tableName = tables[(int)tableIdx];
|
||||
if (delimitReservedWords) tableName = DelimitReservedWord(tableName);
|
||||
return tableName;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Identify the table that corresponds with the specified column.
|
||||
public static TableIdx GetTableForColumn (ColumnIdx column)
|
||||
{
|
||||
int columnIdx = (int)column - 1;
|
||||
if (columnIdx < 0 || columnIdx >= columnCount) return TableIdx.Unknown;
|
||||
return columns[columnIdx].TableIdx;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve the specified Column's name (Qualified include table name: '(<Table>.Column>)').
|
||||
public static String GetColumnName (ColumnIdx column, bool delimitReservedWords = true)
|
||||
{
|
||||
int columnIdx = (int)column - 1;
|
||||
if (columnIdx < 0 || columnIdx >= columnCount) return String.Empty;
|
||||
String columnName = columns[columnIdx].Name;
|
||||
if (delimitReservedWords) columnName = DelimitReservedWord(columnName);
|
||||
return columnName;
|
||||
}
|
||||
public static String GetColumnNameQual (ColumnIdx column, String tableAlias = "", bool braces = false)
|
||||
{
|
||||
String columnName = GetColumnName(column);
|
||||
if (!String.IsNullOrEmpty(columnName))
|
||||
{
|
||||
String tableName = StringUtil.EmptyOnNull(tableAlias);
|
||||
if (tableName.IsEmpty()) tableName = GetTableName(GetTableForColumn(column));
|
||||
columnName = tableName + (tableName.Length > 0 ? "." : "") + columnName;
|
||||
if (braces)
|
||||
columnName = "(" + columnName + ")";
|
||||
}
|
||||
return columnName;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Reserved words.
|
||||
private static DbReservedWordDelim reservedWordDelim = DbReservedWordDelim.SquareBrackets;
|
||||
public static void SetReservedWordDelim (DbReservedWordDelim reservedWordDelim)
|
||||
{
|
||||
SaxDbDfn_Support.reservedWordDelim = reservedWordDelim;
|
||||
}
|
||||
public static bool IsReservedWord (String word)
|
||||
{
|
||||
if (String.IsNullOrEmpty(word)) return false;
|
||||
if (reservedWords.Contains(word, StringComparer.OrdinalIgnoreCase)) return true;
|
||||
return false;
|
||||
}
|
||||
public static String DelimitReservedWord (String word)
|
||||
{
|
||||
if (!IsReservedWord(word)) return word;
|
||||
switch (reservedWordDelim)
|
||||
{
|
||||
case DbReservedWordDelim.None:
|
||||
break;
|
||||
case DbReservedWordDelim.DoubleQuotes:
|
||||
word = "\"" + word + "\"";
|
||||
break;
|
||||
case DbReservedWordDelim.SquareBrackets:
|
||||
default:
|
||||
word = "[" + word + "]";
|
||||
break;
|
||||
}
|
||||
return word;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve information about the specified Column.
|
||||
public static DbColumnDataType GetColDataType (ColumnIdx column)
|
||||
{
|
||||
int columnIdx = (int)column - 1;
|
||||
if (columnIdx < 0 || columnIdx >= columnCount) return DbColumnDataType.Unknown;
|
||||
return columns[columnIdx].DataType;
|
||||
}
|
||||
public static short GetColNativeDataType (ColumnIdx column)
|
||||
{
|
||||
int columnIdx = (int)column - 1;
|
||||
if (columnIdx < 0 || columnIdx >= columnCount) return 0;
|
||||
return columns[columnIdx].NativeDataType;
|
||||
}
|
||||
public static void SetMaxTextLen (ulong maxTextLen)
|
||||
{
|
||||
SaxDbDfn_Support.maxTextLen = maxTextLen;
|
||||
}
|
||||
public static bool IsColFmtText (ColumnIdx column)
|
||||
{
|
||||
int columnIdx = (int)column - 1;
|
||||
if (columnIdx < 0 || columnIdx >= columnCount) return false;
|
||||
return (columns[columnIdx].DataType == DbColumnDataType.VarChar);
|
||||
}
|
||||
public static ulong GetColTextLen (ColumnIdx column)
|
||||
{
|
||||
int columnIdx = (int)column - 1;
|
||||
if (columnIdx < 0 || columnIdx >= columnCount) return 0;
|
||||
if (columns[columnIdx].DataType == DbColumnDataType.VarChar)
|
||||
{
|
||||
ulong textLen = columns[columnIdx].DataLen;
|
||||
if (maxTextLen > 0 && textLen > maxTextLen) textLen = maxTextLen;
|
||||
return textLen;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
public static bool IsColFmtBool (ColumnIdx column)
|
||||
{
|
||||
int columnIdx = (int)column - 1;
|
||||
if (columnIdx < 0 || columnIdx >= columnCount) return false;
|
||||
return (columns[columnIdx].DataType == DbColumnDataType.Bit);
|
||||
}
|
||||
public static bool IsColFmtNumeric (ColumnIdx column)
|
||||
{
|
||||
int columnIdx = (int)column - 1;
|
||||
if (columnIdx < 0 || columnIdx >= columnCount) return false;
|
||||
switch (columns[columnIdx].DataType)
|
||||
{
|
||||
case DbColumnDataType.TinyInt:
|
||||
case DbColumnDataType.SmallInt:
|
||||
case DbColumnDataType.Int:
|
||||
case DbColumnDataType.BigInt:
|
||||
case DbColumnDataType.Single:
|
||||
case DbColumnDataType.Double:
|
||||
case DbColumnDataType.Decimal:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Table definitions.
|
||||
private static readonly String[] tables =
|
||||
{
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Table column definitions.
|
||||
private class ColumnDfn
|
||||
{
|
||||
internal TableIdx TableIdx { get; set; }
|
||||
internal String Name { get; set; }
|
||||
internal DbColumnDataType DataType { get; set; }
|
||||
internal short NativeDataType { get; set; }
|
||||
internal bool IsIdentity { get; set; }
|
||||
internal ulong DataLen { get; set; }
|
||||
internal ColumnDfn (int tableIdx, String name, int dataType, short nativeDataType, bool isIdentity, ulong dataLen)
|
||||
{
|
||||
this.TableIdx = (TableIdx)tableIdx;
|
||||
this.Name = name;
|
||||
this.DataType = (DbColumnDataType)dataType;
|
||||
this.NativeDataType = nativeDataType;
|
||||
this.IsIdentity = isIdentity;
|
||||
this.DataLen = dataLen;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
private static readonly ColumnDfn[] columns =
|
||||
{
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Reserved words.
|
||||
private static readonly List<String> reservedWords = new List<String>()
|
||||
{
|
||||
"ADD",
|
||||
"ALL",
|
||||
"ALTER",
|
||||
"AND",
|
||||
"ANY",
|
||||
"AS",
|
||||
"ASC",
|
||||
"AVG",
|
||||
"BEGIN",
|
||||
"BETWEEN",
|
||||
"BY",
|
||||
"CASE",
|
||||
"CAST",
|
||||
"COLUMN",
|
||||
"COMMIT",
|
||||
"CONSTRAINT",
|
||||
"CONVERT",
|
||||
"COUNT",
|
||||
"CREATE",
|
||||
"CURRENCY",
|
||||
"DEFAULT",
|
||||
"DELETE",
|
||||
"DESC",
|
||||
"DISTINCT",
|
||||
"DROP",
|
||||
"ELSE",
|
||||
"END",
|
||||
"EXECUTE",
|
||||
"EXISTS",
|
||||
"FALSE",
|
||||
"FROM",
|
||||
"GRANT",
|
||||
"GROUP",
|
||||
"HAVING",
|
||||
"IN",
|
||||
"INDEX",
|
||||
"INNER",
|
||||
"INSERT",
|
||||
"INTO",
|
||||
"IS",
|
||||
"JOIN",
|
||||
"KEY",
|
||||
"LEFT",
|
||||
"LIKE",
|
||||
"MAX",
|
||||
"MIN",
|
||||
"NOT",
|
||||
"NULL",
|
||||
"ON",
|
||||
"OR",
|
||||
"ORDER",
|
||||
"OUTER",
|
||||
"OUTPUT",
|
||||
"PRIMARY",
|
||||
"PROCEDURE",
|
||||
"REVOKE",
|
||||
"ROLLBACK",
|
||||
"ROWCOUNT",
|
||||
"SELECT",
|
||||
"SET",
|
||||
"SQL",
|
||||
"SUM",
|
||||
"TABLE",
|
||||
"THEN",
|
||||
"TRANSACTION",
|
||||
"TRUE",
|
||||
"UNION",
|
||||
"UNIQUE",
|
||||
"UPDATE",
|
||||
"USER",
|
||||
"VALUES",
|
||||
"VIEW",
|
||||
"WHEN",
|
||||
"WHERE",
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
}
|
||||
@@ -79,10 +79,10 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
public bool DebugMode { get; } = SacsSystem.DebugMode;
|
||||
public SaxSystem System { get; }
|
||||
public SaxSessionContext SessionContext { get; }
|
||||
public ISacsDatabase CoreDatabase { get { return SaxGlobals.App.GetCoreDatabase(SessionContext); } }
|
||||
public ISacsDatabase CoreDatabase { get { return SaxGlobals.App.GetDatabase(SessionContext, Sax.Database.Core); } }
|
||||
public IDatabaseInfo CreateCoreDbInfo()
|
||||
{
|
||||
return SaxGlobals.App.CreateCoreDbInfo(SessionContext);
|
||||
return SaxGlobals.App.CreateDbInfo(SessionContext, Sax.Database.Core);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -180,6 +180,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
// User roles.
|
||||
userRoleCodes.Add(Sax.UserRole.Journalist, "JRNLST", "Journalist");
|
||||
userRoleCodes.Add(Sax.UserRole.SystemAdmin, "SYSADM", "System Admin");
|
||||
userRoleCodes.Add(Sax.UserRole.SystemReviewer, "SYSRVR", "System Reviewer");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Titles.
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
}
|
||||
|
||||
/// <summary>Clear all contact methods.</summary>
|
||||
public void ClearContactMethods(Sax.ContactMethod method)
|
||||
public void ClearContactMethods()
|
||||
{
|
||||
contactMethods.Clear();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,210 @@
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Saxonite.Net.Standard.Base.Bus
|
||||
{
|
||||
//=======================================================================
|
||||
// Contact data - associated with Organisations, Users etc.
|
||||
//=======================================================================
|
||||
public class SaxSportContactsData
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Definitions.
|
||||
private static readonly String ElementName_Contacts = "Contacts";
|
||||
private static readonly String ElementName_Contact = "Contact";
|
||||
private static readonly String AttributeName_Type = "Type";
|
||||
private static readonly String ElementName_Type = "Type";
|
||||
private static readonly String ElementName_UserAccountId = "UserAccountId";
|
||||
private static readonly String ElementName_Name = "Name";
|
||||
private static readonly String ElementName_Phone = "Phone";
|
||||
private static readonly String ElementName_Email = "Email";
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private class ContactData
|
||||
{
|
||||
public Sax.SportContactType ContactType { get; set; }
|
||||
public SysId UserAccountId { get; set; }
|
||||
public String Name { get; set; }
|
||||
public String Phone { get; set; }
|
||||
public String Email { get; set; }
|
||||
}
|
||||
private Dictionary<Sax.SportContactType, ContactData> contacts { get; } = new Dictionary<Sax.SportContactType, ContactData>();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction - from serialised data.
|
||||
public SaxSportContactsData(String contactsData = "")
|
||||
{
|
||||
FromXml(contactsData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public List<Sax.SportContactType> ContactTypes { get { return contacts.Keys.ToList(); } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
/// <summary>Get the contact for the specified type.</summary>
|
||||
private ContactData GetContactData(Sax.SportContactType contactType)
|
||||
{
|
||||
if ((int)contactType < 1) return null;
|
||||
ContactData contact = contacts.GetValueOrDefault(contactType, null);
|
||||
if (contact == null)
|
||||
contacts.Add(contactType, contact = new ContactData() { ContactType = contactType });
|
||||
return contact;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Contacts.
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Extract the name associated with the specified type.</summary>
|
||||
public String GetContactName(Sax.SportContactType contactType)
|
||||
{
|
||||
return contacts.GetValueOrDefault(contactType, new ContactData()).Name;
|
||||
}
|
||||
|
||||
/// <summary>Extract the phone associated with the specified type.</summary>
|
||||
public String GetContactPhone(Sax.SportContactType contactType)
|
||||
{
|
||||
return contacts.GetValueOrDefault(contactType, new ContactData()).Phone;
|
||||
}
|
||||
|
||||
/// <summary>Extract the email associated with the specified type.</summary>
|
||||
public String GetContactEmail(Sax.SportContactType contactType)
|
||||
{
|
||||
return contacts.GetValueOrDefault(contactType, new ContactData()).Email;
|
||||
}
|
||||
|
||||
/// <summary>Set the name associated with the specified contact.</summary>
|
||||
public bool SetContactName(Sax.SportContactType contactType, String name)
|
||||
{
|
||||
if ((int)contactType < 1 || name.IsEmpty()) return false;
|
||||
ContactData contact = GetContactData(contactType);
|
||||
if (contact == null) return false;
|
||||
contact.Name = name;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>Set the phone associated with the specified contact.</summary>
|
||||
public bool SetContactPhone(Sax.SportContactType contactType, String phone)
|
||||
{
|
||||
if ((int)contactType < 1 || phone.IsEmpty()) return false;
|
||||
ContactData contact = GetContactData(contactType);
|
||||
if (contact == null) return false;
|
||||
contact.Phone = phone;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>Set the email associated with the specified contact.</summary>
|
||||
public bool SetContactEmail(Sax.SportContactType contactType, String email)
|
||||
{
|
||||
if ((int)contactType < 1 || email.IsEmpty()) return false;
|
||||
ContactData contact = GetContactData(contactType);
|
||||
if (contact == null) return false;
|
||||
contact.Email = email;
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Clear the value associated with the specified method.</summary>
|
||||
public bool ClearContact(Sax.SportContactType contactType)
|
||||
{
|
||||
return contacts.Remove(contactType);
|
||||
}
|
||||
|
||||
/// <summary>Clear all contact methods.</summary>
|
||||
public void ClearContacts()
|
||||
{
|
||||
contacts.Clear();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Serialisation.
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Serialise as XML.</summary>
|
||||
public String ToXml()
|
||||
{
|
||||
String fn = typeof(SaxContactData).FullName + ".ToXml";
|
||||
try
|
||||
{
|
||||
XDocument doc = new XDocument();
|
||||
XElement contactsElement = doc.AppendElement(ElementName_Contacts);
|
||||
foreach (ContactData contactData in contacts.Values)
|
||||
{
|
||||
if ((int)contactData.ContactType < 1 || (!SysId.IsValid(contactData.UserAccountId) && contactData.Name.IsEmpty())) continue;
|
||||
XElement contactElement = contactsElement.AppendElement(ElementName_Contact);
|
||||
contactElement.SetAttribute(AttributeName_Type, ((int)contactData.ContactType).ToString());
|
||||
contactElement.AppendElement(ElementName_Type, contactData.ContactType.ToString());
|
||||
if (!StringUtil.IsBlank(contactData.Name))
|
||||
contactElement.AppendElement(ElementName_Name, contactData.Name);
|
||||
if (!StringUtil.IsBlank(contactData.Phone))
|
||||
contactElement.AppendElement(ElementName_Phone, contactData.Phone);
|
||||
if (!StringUtil.IsBlank(contactData.Email))
|
||||
contactElement.AppendElement(ElementName_Email, contactData.Email);
|
||||
}
|
||||
return doc.GetXml();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SaLogger.Warn(fn + " " + ExceptionUtil.GetLogMessage(exc));
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Deserialise from XML data.</summary>
|
||||
private void FromXml(String contactsData)
|
||||
{
|
||||
String fn = typeof(SaxContactData).FullName + ".FromXml";
|
||||
contacts.Clear();
|
||||
if (StringUtil.IsEmpty(contactsData)) return;
|
||||
|
||||
try
|
||||
{
|
||||
// Load XML data.
|
||||
XDocument doc = XDocument.Parse(contactsData);
|
||||
XElement rootElement = doc.Root;
|
||||
foreach (XElement rootChildElement in rootElement.GetChildElements())
|
||||
{
|
||||
String rootChildElementName = rootChildElement.GetLocalName();
|
||||
if (rootChildElementName.EqualsCI(ElementName_Contact))
|
||||
{
|
||||
// Contact.
|
||||
String contactTypeValue = rootChildElement.GetChildText(ElementName_Type);
|
||||
Sax.SportContactType contactType = EnumUtil.ParseEnum(contactTypeValue, Sax.SportContactType.Unknown);
|
||||
if (contactType != Sax.SportContactType.Unknown)
|
||||
{
|
||||
ContactData contactData = new ContactData()
|
||||
{
|
||||
ContactType = contactType,
|
||||
UserAccountId = rootChildElement.GetChildText(ElementName_UserAccountId).ToSysId(),
|
||||
Name = rootChildElement.GetChildText(ElementName_Name),
|
||||
Phone = rootChildElement.GetChildText(ElementName_Phone),
|
||||
Email = rootChildElement.GetChildText(ElementName_Email),
|
||||
};
|
||||
contacts.Add(contactType, contactData);
|
||||
}
|
||||
else SaLogger.Warn(fn + " Unrecognised contact type: " + contactType);
|
||||
}
|
||||
else SaLogger.Warn(fn + " Unexpected 'Root' child element: " + rootChildElementName);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SaLogger.Warn(fn + " " + ExceptionUtil.GetLogMessage(exc));
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -54,6 +54,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
public SysId UserAccountId { get; set; }
|
||||
public SysId SportId { get; set; }
|
||||
public String About { get; set; } = String.Empty;
|
||||
public String ContactsData { get; set; } = String.Empty;
|
||||
public Sax.SportParticipation Participation { get; set; }
|
||||
public Sax.SportOfficiating Officiating { get; set; }
|
||||
public String UserSportData { get; set; }
|
||||
@@ -86,6 +87,11 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
get { return data.About; }
|
||||
set { CheckChanged(data.About, value); data.About = value; }
|
||||
}
|
||||
public String ContactsData
|
||||
{
|
||||
get { return data.ContactsData; }
|
||||
set { CheckChanged(data.ContactsData, value); data.ContactsData = value; }
|
||||
}
|
||||
public Sax.SportParticipation Participation
|
||||
{
|
||||
get { return data.Participation; }
|
||||
@@ -107,6 +113,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
UserAccountId = data.UserAccountId;
|
||||
SportId = data.SportId;
|
||||
About = data.About;
|
||||
ContactsData = data.ContactsData;
|
||||
Participation = data.Participation;
|
||||
Officiating = data.Officiating;
|
||||
UserSportData = data.UserSportData;
|
||||
@@ -128,6 +135,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
public ValidValue UserAccountId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue SportId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue About { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ContactsAbout { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Participation { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Officiating { get; set; } = ValidValue.Valid;
|
||||
public ValidValue UserSportData { get; set; } = ValidValue.Valid;
|
||||
@@ -202,6 +210,11 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
get { return data.About; }
|
||||
set { data.About = value; }
|
||||
}
|
||||
public String ContactsData
|
||||
{
|
||||
get { return data.ContactsData; }
|
||||
set { data.ContactsData = value; }
|
||||
}
|
||||
public Sax.SportParticipation Participation
|
||||
{
|
||||
get { return data.Participation; }
|
||||
|
||||
@@ -128,6 +128,7 @@ namespace Saxonite.Net.Standard.Base.Consoles
|
||||
// Properties.
|
||||
protected SaxSessionContext SessionContext { get; }
|
||||
protected SaxInternals Internals { get { if (internals == null) internals = new SaxInternals(SessionContext); return internals; } }
|
||||
protected ISacsDatabase CoreDatabase { get { return Internals.CoreDatabase; } }
|
||||
protected List<Sax.DataItemType> ValidActivityItemTypes { get { return validActivityItemTypes.ToList(); } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user