This commit is contained in:
2020-01-15 17:05:06 +00:00
parent cbe48027ae
commit 122d3a93fa
3 changed files with 37 additions and 35 deletions

View File

@@ -15,20 +15,22 @@ namespace AyaNova.Biz
public const string Currency = "currency"; public const string Currency = "currency";
public const string Tags = "tags"; public const string Tags = "tags";
public const string Enum = "enum";//enums are just integers in the db so the sql code handles it like an int, but the client needs to know it's an enum public const string Enum = "enum";//enums are just integers in the db so the sql code handles it like an int, but the client needs to know it's an enum
}
// public static List<string> ValidCustomFieldTypes
// { //DataTypes used to format display properly and for custom fields definition etc
// get public enum AyaDataType : int
// { {
// var ret = new List<string>(); NoType = 0,
// ret.Add(AyDataType.Date); DateTime = 1,
// ret.Add(AyDataType.Text); Date = 2,
// ret.Add(AyDataType.Integer); Time = 3,
// ret.Add(AyDataType.Bool); Text = 4,
// ret.Add(AyDataType.Decimal); Integer = 5,
// return ret; Bool = 6,
// } Decimal = 7,
// } Currency = 8,
Tags = 9,
Enum = 10
} }
} }

View File

@@ -53,7 +53,7 @@ namespace AyaNova.Biz
/// <summary> /// <summary>
/// Translate DataFilter to Postgres friendly SQL criteria /// Translate DataFilter to Postgres friendly SQL criteria
/// </summary> /// </summary>
private static string DataFilterToColumnCriteria(string sColumn, string sDataType, string sOperator, string sValue, List<string> sTags, long userId)//, bool IsCompound) private static string DataFilterToColumnCriteria(string sColumn, AyaDataType DataType, string sOperator, string sValue, List<string> sTags, long userId)//, bool IsCompound)
{ {
bool TagFilter = sTags.Count < 0; bool TagFilter = sTags.Count < 0;
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
@@ -65,9 +65,9 @@ namespace AyaNova.Biz
//handle null values separately //handle null values separately
if (!TagFilter && sValue == FilterSpecialToken.Null) if (!TagFilter && sValue == FilterSpecialToken.Null)
{ {
switch (sDataType) switch (DataType)
{ {
case AyDataType.Text: case AyaDataType.Text:
{ {
if (sOperator == FilterComparisonOperator.Equality) if (sOperator == FilterComparisonOperator.Equality)
{ {

View File

@@ -55,16 +55,16 @@ namespace AyaNova.Biz
{ {
case WIDGET_KEY: case WIDGET_KEY:
#region WIDGET_KEY #region WIDGET_KEY
l.Add(new ObjectField { Key = "WidgetName", PropertyName = "Name", DataType = AyDataType.Text, Hideable = false }); l.Add(new ObjectField { Key = "WidgetName", PropertyName = "Name", DataType = (int)AyaDataType.Text, Hideable = false });
l.Add(new ObjectField { Key = "WidgetSerial", PropertyName = "Serial", DataType = AyDataType.Integer }); l.Add(new ObjectField { Key = "WidgetSerial", PropertyName = "Serial", DataType = (int)AyaDataType.Integer });
l.Add(new ObjectField { Key = "WidgetDollarAmount", PropertyName = "DollarAmount", DataType = AyDataType.Currency }); l.Add(new ObjectField { Key = "WidgetDollarAmount", PropertyName = "DollarAmount", DataType = (int)AyaDataType.Currency });
l.Add(new ObjectField { Key = "WidgetCount", PropertyName = "Count", DataType = AyDataType.Integer }); l.Add(new ObjectField { Key = "WidgetCount", PropertyName = "Count", DataType = (int)AyaDataType.Integer });
l.Add(new ObjectField { Key = "WidgetRoles", PropertyName = "Roles", DataType = AyDataType.Enum, EnumType = typeof(AuthorizationRoles).ToString() }); l.Add(new ObjectField { Key = "WidgetRoles", PropertyName = "Roles", DataType = (int)AyaDataType.Enum, EnumType = typeof(AuthorizationRoles).ToString() });
l.Add(new ObjectField { Key = "WidgetStartDate", PropertyName = "StartDate", DataType = AyDataType.DateTime }); l.Add(new ObjectField { Key = "WidgetStartDate", PropertyName = "StartDate", DataType = (int)AyaDataType.DateTime });
l.Add(new ObjectField { Key = "WidgetEndDate", PropertyName = "EndDate", DataType = AyDataType.DateTime }); l.Add(new ObjectField { Key = "WidgetEndDate", PropertyName = "EndDate", DataType = (int)AyaDataType.DateTime });
l.Add(new ObjectField { Key = "WidgetNotes", PropertyName = "Notes", DataType = AyDataType.Text }); l.Add(new ObjectField { Key = "WidgetNotes", PropertyName = "Notes", DataType = (int)AyaDataType.Text });
l.Add(new ObjectField { Key = "Active", PropertyName = "Active", DataType = AyDataType.Bool, Hideable = false, SharedLTKey = true }); l.Add(new ObjectField { Key = "Active", PropertyName = "Active", DataType = (int)AyaDataType.Bool, Hideable = false, SharedLTKey = true });
l.Add(new ObjectField { Key = "Tags", PropertyName = "Tags", DataType = AyDataType.Tags, SharedLTKey = true }); l.Add(new ObjectField { Key = "Tags", PropertyName = "Tags", DataType = (int)AyaDataType.Tags, SharedLTKey = true });
l.Add(new ObjectField { Key = "WidgetCustom1", PropertyName = "WidgetCustom1", Custom = true }); l.Add(new ObjectField { Key = "WidgetCustom1", PropertyName = "WidgetCustom1", Custom = true });
l.Add(new ObjectField { Key = "WidgetCustom2", PropertyName = "WidgetCustom2", Custom = true }); l.Add(new ObjectField { Key = "WidgetCustom2", PropertyName = "WidgetCustom2", Custom = true });
@@ -86,13 +86,13 @@ namespace AyaNova.Biz
#endregion #endregion
case USER_KEY: case USER_KEY:
#region USER_KEY #region USER_KEY
l.Add(new ObjectField { Key = "Name", PropertyName = "Name", SharedLTKey = true, DataType = AyDataType.Text, Hideable = false }); l.Add(new ObjectField { Key = "Name", PropertyName = "Name", SharedLTKey = true, DataType = (int)AyaDataType.Text, Hideable = false });
l.Add(new ObjectField { Key = "UserEmployeeNumber", PropertyName = "EmployeeNumber", DataType = AyDataType.Text }); l.Add(new ObjectField { Key = "UserEmployeeNumber", PropertyName = "EmployeeNumber", DataType = (int)AyaDataType.Text });
l.Add(new ObjectField { Key = "AuthorizationRoles", PropertyName = "Roles", Hideable = false, DataType = AyDataType.Enum, EnumType = typeof(AuthorizationRoles).ToString() }); l.Add(new ObjectField { Key = "AuthorizationRoles", PropertyName = "Roles", Hideable = false, DataType = (int)AyaDataType.Enum, EnumType = typeof(AuthorizationRoles).ToString() });
l.Add(new ObjectField { Key = "UserNotes", PropertyName = "Notes", DataType = AyDataType.Text }); l.Add(new ObjectField { Key = "UserNotes", PropertyName = "Notes", DataType = (int)AyaDataType.Text });
l.Add(new ObjectField { Key = "UserUserType", PropertyName = "UserType", Hideable = false, DataType = AyDataType.Enum, EnumType = typeof(UserType).ToString() }); l.Add(new ObjectField { Key = "UserUserType", PropertyName = "UserType", Hideable = false, DataType = (int)AyaDataType.Enum, EnumType = typeof(UserType).ToString() });
l.Add(new ObjectField { Key = "Active", PropertyName = "Active", DataType = AyDataType.Bool, Hideable = false, SharedLTKey = true }); l.Add(new ObjectField { Key = "Active", PropertyName = "Active", DataType = (int)AyaDataType.Bool, Hideable = false, SharedLTKey = true });
l.Add(new ObjectField { Key = "Tags", PropertyName = "Tags", DataType = AyDataType.Tags, SharedLTKey = true }); l.Add(new ObjectField { Key = "Tags", PropertyName = "Tags", DataType = (int)AyaDataType.Tags, SharedLTKey = true });
l.Add(new ObjectField { Key = "UserCustom1", PropertyName = "UserCustom1", Custom = true }); l.Add(new ObjectField { Key = "UserCustom1", PropertyName = "UserCustom1", Custom = true });
l.Add(new ObjectField { Key = "UserCustom2", PropertyName = "UserCustom2", Custom = true }); l.Add(new ObjectField { Key = "UserCustom2", PropertyName = "UserCustom2", Custom = true });
@@ -184,7 +184,7 @@ namespace AyaNova.Biz
public bool Filterable { get; set; } public bool Filterable { get; set; }
public bool Sortable { get; set; } public bool Sortable { get; set; }
public bool MiniAvailable { get; set; } public bool MiniAvailable { get; set; }
public string DataType { get; set; } public int DataType { get; set; }
//If it's an enum DataType then this is the specific enum type which sb the name of the class that holds the enum in the server project //If it's an enum DataType then this is the specific enum type which sb the name of the class that holds the enum in the server project
public string EnumType { get; set; } public string EnumType { get; set; }
//if field is a reference to another object (i.e. a client in a workorders list) //if field is a reference to another object (i.e. a client in a workorders list)