diff --git a/server/AyaNova/biz/AyDataType.cs b/server/AyaNova/biz/AyDataType.cs index d2991a99..d820134b 100644 --- a/server/AyaNova/biz/AyDataType.cs +++ b/server/AyaNova/biz/AyDataType.cs @@ -15,20 +15,22 @@ namespace AyaNova.Biz public const string Currency = "currency"; 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 static List ValidCustomFieldTypes - // { - // get - // { - // var ret = new List(); - // ret.Add(AyDataType.Date); - // ret.Add(AyDataType.Text); - // ret.Add(AyDataType.Integer); - // ret.Add(AyDataType.Bool); - // ret.Add(AyDataType.Decimal); - // return ret; - // } - // } + } + + //DataTypes used to format display properly and for custom fields definition etc + public enum AyaDataType : int + { + NoType = 0, + DateTime = 1, + Date = 2, + Time = 3, + Text = 4, + Integer = 5, + Bool = 6, + Decimal = 7, + Currency = 8, + Tags = 9, + Enum = 10 } } diff --git a/server/AyaNova/biz/FilterSqlCriteriaBuilder.cs b/server/AyaNova/biz/FilterSqlCriteriaBuilder.cs index e3718e9d..4af25021 100644 --- a/server/AyaNova/biz/FilterSqlCriteriaBuilder.cs +++ b/server/AyaNova/biz/FilterSqlCriteriaBuilder.cs @@ -53,7 +53,7 @@ namespace AyaNova.Biz /// /// Translate DataFilter to Postgres friendly SQL criteria /// - private static string DataFilterToColumnCriteria(string sColumn, string sDataType, string sOperator, string sValue, List sTags, long userId)//, bool IsCompound) + private static string DataFilterToColumnCriteria(string sColumn, AyaDataType DataType, string sOperator, string sValue, List sTags, long userId)//, bool IsCompound) { bool TagFilter = sTags.Count < 0; StringBuilder sb = new StringBuilder(); @@ -65,9 +65,9 @@ namespace AyaNova.Biz //handle null values separately if (!TagFilter && sValue == FilterSpecialToken.Null) { - switch (sDataType) + switch (DataType) { - case AyDataType.Text: + case AyaDataType.Text: { if (sOperator == FilterComparisonOperator.Equality) { diff --git a/server/AyaNova/biz/ObjectFields.cs b/server/AyaNova/biz/ObjectFields.cs index 382eea07..58d337fe 100644 --- a/server/AyaNova/biz/ObjectFields.cs +++ b/server/AyaNova/biz/ObjectFields.cs @@ -55,16 +55,16 @@ namespace AyaNova.Biz { case WIDGET_KEY: #region WIDGET_KEY - l.Add(new ObjectField { Key = "WidgetName", PropertyName = "Name", DataType = AyDataType.Text, Hideable = false }); - l.Add(new ObjectField { Key = "WidgetSerial", PropertyName = "Serial", DataType = AyDataType.Integer }); - l.Add(new ObjectField { Key = "WidgetDollarAmount", PropertyName = "DollarAmount", DataType = AyDataType.Currency }); - l.Add(new ObjectField { Key = "WidgetCount", PropertyName = "Count", DataType = AyDataType.Integer }); - l.Add(new ObjectField { Key = "WidgetRoles", PropertyName = "Roles", DataType = AyDataType.Enum, EnumType = typeof(AuthorizationRoles).ToString() }); - l.Add(new ObjectField { Key = "WidgetStartDate", PropertyName = "StartDate", DataType = AyDataType.DateTime }); - l.Add(new ObjectField { Key = "WidgetEndDate", PropertyName = "EndDate", DataType = AyDataType.DateTime }); - l.Add(new ObjectField { Key = "WidgetNotes", PropertyName = "Notes", DataType = AyDataType.Text }); - l.Add(new ObjectField { Key = "Active", PropertyName = "Active", DataType = AyDataType.Bool, Hideable = false, SharedLTKey = true }); - l.Add(new ObjectField { Key = "Tags", PropertyName = "Tags", DataType = AyDataType.Tags, SharedLTKey = true }); + l.Add(new ObjectField { Key = "WidgetName", PropertyName = "Name", DataType = (int)AyaDataType.Text, Hideable = false }); + l.Add(new ObjectField { Key = "WidgetSerial", PropertyName = "Serial", DataType = (int)AyaDataType.Integer }); + l.Add(new ObjectField { Key = "WidgetDollarAmount", PropertyName = "DollarAmount", DataType = (int)AyaDataType.Currency }); + l.Add(new ObjectField { Key = "WidgetCount", PropertyName = "Count", DataType = (int)AyaDataType.Integer }); + 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 = (int)AyaDataType.DateTime }); + l.Add(new ObjectField { Key = "WidgetEndDate", PropertyName = "EndDate", DataType = (int)AyaDataType.DateTime }); + l.Add(new ObjectField { Key = "WidgetNotes", PropertyName = "Notes", DataType = (int)AyaDataType.Text }); + 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 = (int)AyaDataType.Tags, SharedLTKey = true }); l.Add(new ObjectField { Key = "WidgetCustom1", PropertyName = "WidgetCustom1", Custom = true }); l.Add(new ObjectField { Key = "WidgetCustom2", PropertyName = "WidgetCustom2", Custom = true }); @@ -86,13 +86,13 @@ namespace AyaNova.Biz #endregion case 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 = "UserEmployeeNumber", PropertyName = "EmployeeNumber", DataType = AyDataType.Text }); - l.Add(new ObjectField { Key = "AuthorizationRoles", PropertyName = "Roles", Hideable = false, DataType = AyDataType.Enum, EnumType = typeof(AuthorizationRoles).ToString() }); - l.Add(new ObjectField { Key = "UserNotes", PropertyName = "Notes", DataType = AyDataType.Text }); - l.Add(new ObjectField { Key = "UserUserType", PropertyName = "UserType", Hideable = false, DataType = AyDataType.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 = "Tags", PropertyName = "Tags", DataType = AyDataType.Tags, SharedLTKey = true }); + 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 = (int)AyaDataType.Text }); + 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 = (int)AyaDataType.Text }); + 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 = (int)AyaDataType.Bool, Hideable = false, 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 = "UserCustom2", PropertyName = "UserCustom2", Custom = true }); @@ -184,7 +184,7 @@ namespace AyaNova.Biz public bool Filterable { get; set; } public bool Sortable { 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 public string EnumType { get; set; } //if field is a reference to another object (i.e. a client in a workorders list)