This commit is contained in:
@@ -66,8 +66,8 @@ namespace AyaNova.Api.Controllers
|
|||||||
case "datatypes":
|
case "datatypes":
|
||||||
{
|
{
|
||||||
//Iterate the enum and get the values
|
//Iterate the enum and get the values
|
||||||
Type t = typeof(AyaDataType);
|
Type t = typeof(AyaUiFieldDataType);
|
||||||
Enum.GetName(t, AyaDataType.NoType);
|
Enum.GetName(t, AyaUiFieldDataType.NoType);
|
||||||
foreach (var dt in Enum.GetValues(t))
|
foreach (var dt in Enum.GetValues(t))
|
||||||
{
|
{
|
||||||
ReturnList.Add(new NameIdItem() { Name = Enum.GetName(t, dt), Id = (int) dt });
|
ReturnList.Add(new NameIdItem() { Name = Enum.GetName(t, dt), Id = (int) dt });
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace AyaNova.Biz
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
//DataTypes used to format display properly and for custom fields definition etc
|
//DataTypes used to format display properly and for custom fields definition etc
|
||||||
public enum AyaDataType : int
|
public enum AyaUiFieldDataType : int
|
||||||
{
|
{
|
||||||
NoType = 0,
|
NoType = 0,
|
||||||
DateTime = 1,
|
DateTime = 1,
|
||||||
@@ -18,14 +18,14 @@ namespace AyaNova.Biz
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
var ret = new List<int>();
|
var ret = new List<int>();
|
||||||
ret.Add((int)AyaDataType.Currency);
|
ret.Add((int)AyaUiFieldDataType.Currency);
|
||||||
ret.Add((int)AyaDataType.Date);
|
ret.Add((int)AyaUiFieldDataType.Date);
|
||||||
ret.Add((int)AyaDataType.Time);
|
ret.Add((int)AyaUiFieldDataType.Time);
|
||||||
ret.Add((int)AyaDataType.DateTime);
|
ret.Add((int)AyaUiFieldDataType.DateTime);
|
||||||
ret.Add((int)AyaDataType.Text);
|
ret.Add((int)AyaUiFieldDataType.Text);
|
||||||
ret.Add((int)AyaDataType.Decimal);
|
ret.Add((int)AyaUiFieldDataType.Decimal);
|
||||||
ret.Add((int)AyaDataType.Integer);
|
ret.Add((int)AyaUiFieldDataType.Integer);
|
||||||
ret.Add((int)AyaDataType.Bool);
|
ret.Add((int)AyaUiFieldDataType.Bool);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -158,19 +158,19 @@ namespace AyaNova.Biz
|
|||||||
//first column is the non visible Default Id column so that the client knows what to open when there is no field with ID selected that matches underlying record type
|
//first column is the non visible Default Id column so that the client knows what to open when there is no field with ID selected that matches underlying record type
|
||||||
//in this case the default of id is sufficient for this list
|
//in this case the default of id is sufficient for this list
|
||||||
l.Add(new ObjectField { Key = "df", AyObjectType = (int)AyaType.Widget });
|
l.Add(new ObjectField { Key = "df", AyObjectType = (int)AyaType.Widget });
|
||||||
l.Add(new ObjectField { Key = "WidgetName", PropertyName = "Name", DataType = (int)AyaDataType.Text, Hideable = false });
|
l.Add(new ObjectField { Key = "WidgetName", PropertyName = "Name", UiFieldDataType = (int)AyaUiFieldDataType.Text, Hideable = false });
|
||||||
l.Add(new ObjectField { Key = "WidgetSerial", PropertyName = "Serial", DataType = (int)AyaDataType.Integer });
|
l.Add(new ObjectField { Key = "WidgetSerial", PropertyName = "Serial", UiFieldDataType = (int)AyaUiFieldDataType.Integer });
|
||||||
l.Add(new ObjectField { Key = "WidgetDollarAmount", PropertyName = "DollarAmount", DataType = (int)AyaDataType.Currency });
|
l.Add(new ObjectField { Key = "WidgetDollarAmount", PropertyName = "DollarAmount", UiFieldDataType = (int)AyaUiFieldDataType.Currency });
|
||||||
l.Add(new ObjectField { Key = "WidgetCount", PropertyName = "Count", DataType = (int)AyaDataType.Integer });
|
l.Add(new ObjectField { Key = "WidgetCount", PropertyName = "Count", UiFieldDataType = (int)AyaUiFieldDataType.Integer });
|
||||||
l.Add(new ObjectField { Key = "WidgetRoles", PropertyName = "Roles", DataType = (int)AyaDataType.Enum, EnumType = typeof(AuthorizationRoles).ToString() });
|
l.Add(new ObjectField { Key = "WidgetRoles", PropertyName = "Roles", UiFieldDataType = (int)AyaUiFieldDataType.Enum, EnumType = typeof(AuthorizationRoles).ToString() });
|
||||||
l.Add(new ObjectField { Key = "WidgetStartDate", PropertyName = "StartDate", DataType = (int)AyaDataType.DateTime });
|
l.Add(new ObjectField { Key = "WidgetStartDate", PropertyName = "StartDate", UiFieldDataType = (int)AyaUiFieldDataType.DateTime });
|
||||||
l.Add(new ObjectField { Key = "WidgetEndDate", PropertyName = "EndDate", DataType = (int)AyaDataType.DateTime });
|
l.Add(new ObjectField { Key = "WidgetEndDate", PropertyName = "EndDate", UiFieldDataType = (int)AyaUiFieldDataType.DateTime });
|
||||||
l.Add(new ObjectField { Key = "WidgetNotes", PropertyName = "Notes", DataType = (int)AyaDataType.Text });
|
l.Add(new ObjectField { Key = "WidgetNotes", PropertyName = "Notes", UiFieldDataType = (int)AyaUiFieldDataType.Text });
|
||||||
//More to do on this, maybe the datatype should be a LINK or something for UI purposes
|
//More to do on this, maybe the datatype should be a LINK or something for UI purposes
|
||||||
//circle back on this when there is enough infrastructure to test
|
//circle back on this when there is enough infrastructure to test
|
||||||
l.Add(new ObjectField { Key = "User", PropertyName = "userid", DataType = (int)AyaDataType.Text, AyObjectType = (int)AyaType.User });
|
l.Add(new ObjectField { Key = "User", PropertyName = "userid", UiFieldDataType = (int)AyaUiFieldDataType.Text, AyObjectType = (int)AyaType.User });
|
||||||
l.Add(new ObjectField { Key = "Active", PropertyName = "Active", DataType = (int)AyaDataType.Bool, Hideable = false, SharedLTKey = true });
|
l.Add(new ObjectField { Key = "Active", PropertyName = "Active", UiFieldDataType = (int)AyaUiFieldDataType.Bool, Hideable = false, SharedLTKey = true });
|
||||||
l.Add(new ObjectField { Key = "Tags", PropertyName = "Tags", DataType = (int)AyaDataType.Tags, SharedLTKey = true });
|
l.Add(new ObjectField { Key = "Tags", PropertyName = "Tags", UiFieldDataType = (int)AyaUiFieldDataType.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 });
|
||||||
@@ -193,13 +193,13 @@ namespace AyaNova.Biz
|
|||||||
case USER_KEY:
|
case USER_KEY:
|
||||||
#region USER_KEY
|
#region USER_KEY
|
||||||
l.Add(new ObjectField { Key = "df", AyObjectType = (int)AyaType.User });
|
l.Add(new ObjectField { Key = "df", AyObjectType = (int)AyaType.User });
|
||||||
l.Add(new ObjectField { Key = "Name", PropertyName = "Name", SharedLTKey = true, DataType = (int)AyaDataType.Text, Hideable = false });
|
l.Add(new ObjectField { Key = "Name", PropertyName = "Name", SharedLTKey = true, UiFieldDataType = (int)AyaUiFieldDataType.Text, Hideable = false });
|
||||||
l.Add(new ObjectField { Key = "UserEmployeeNumber", PropertyName = "EmployeeNumber", DataType = (int)AyaDataType.Text });
|
l.Add(new ObjectField { Key = "UserEmployeeNumber", PropertyName = "EmployeeNumber", UiFieldDataType = (int)AyaUiFieldDataType.Text });
|
||||||
l.Add(new ObjectField { Key = "AuthorizationRoles", PropertyName = "Roles", Hideable = false, DataType = (int)AyaDataType.Enum, EnumType = typeof(AuthorizationRoles).ToString() });
|
l.Add(new ObjectField { Key = "AuthorizationRoles", PropertyName = "Roles", Hideable = false, UiFieldDataType = (int)AyaUiFieldDataType.Enum, EnumType = typeof(AuthorizationRoles).ToString() });
|
||||||
l.Add(new ObjectField { Key = "UserNotes", PropertyName = "Notes", DataType = (int)AyaDataType.Text });
|
l.Add(new ObjectField { Key = "UserNotes", PropertyName = "Notes", UiFieldDataType = (int)AyaUiFieldDataType.Text });
|
||||||
l.Add(new ObjectField { Key = "UserUserType", PropertyName = "UserType", Hideable = false, DataType = (int)AyaDataType.Enum, EnumType = typeof(UserType).ToString() });
|
l.Add(new ObjectField { Key = "UserUserType", PropertyName = "UserType", Hideable = false, UiFieldDataType = (int)AyaUiFieldDataType.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 = "Active", PropertyName = "Active", UiFieldDataType = (int)AyaUiFieldDataType.Bool, Hideable = false, SharedLTKey = true });
|
||||||
l.Add(new ObjectField { Key = "Tags", PropertyName = "Tags", DataType = (int)AyaDataType.Tags, SharedLTKey = true });
|
l.Add(new ObjectField { Key = "Tags", PropertyName = "Tags", UiFieldDataType = (int)AyaUiFieldDataType.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 });
|
||||||
@@ -248,11 +248,11 @@ namespace AyaNova.Biz
|
|||||||
public string SqlColumn { get; set; }
|
public string SqlColumn { get; set; }
|
||||||
*/
|
*/
|
||||||
l.Add(new ObjectField { Key = "df", AyObjectType = (int)AyaType.Widget });
|
l.Add(new ObjectField { Key = "df", AyObjectType = (int)AyaType.Widget });
|
||||||
l.Add(new ObjectField { Key = "WidgetName", PropertyName = "Name", DataType = (int)AyaDataType.Text, Hideable = false, });//not hideable for strictly list must mean it has to be in template?
|
l.Add(new ObjectField { Key = "WidgetName", PropertyName = "Name", UiFieldDataType = (int)AyaUiFieldDataType.Text, Hideable = false, });//not hideable for strictly list must mean it has to be in template?
|
||||||
|
|
||||||
l.Add(new ObjectField { Key = "User", PropertyName = "userid", DataType = (int)AyaDataType.Text, AyObjectType = (int)AyaType.User });
|
l.Add(new ObjectField { Key = "User", PropertyName = "userid", UiFieldDataType = (int)AyaUiFieldDataType.Text, AyObjectType = (int)AyaType.User });
|
||||||
l.Add(new ObjectField { Key = "Name", PropertyName = "Name", SharedLTKey = true, DataType = (int)AyaDataType.Text, Hideable = false });
|
l.Add(new ObjectField { Key = "Name", PropertyName = "Name", SharedLTKey = true, UiFieldDataType = (int)AyaUiFieldDataType.Text, Hideable = false });
|
||||||
l.Add(new ObjectField { Key = "UserEmailAddress", PropertyName = "Emailaddress", DataType = (int)AyaDataType.EmailAddress, SqlColumn = "emailaddress" });
|
l.Add(new ObjectField { Key = "UserEmailAddress", PropertyName = "Emailaddress", UiFieldDataType = (int)AyaUiFieldDataType.EmailAddress, SqlColumn = "emailaddress" });
|
||||||
break;
|
break;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -280,7 +280,7 @@ namespace AyaNova.Biz
|
|||||||
//Standard mini COLUMN definition
|
//Standard mini COLUMN definition
|
||||||
public static string GenerateMINIListColumnsJSON(AyaType defaultLinkType)
|
public static string GenerateMINIListColumnsJSON(AyaType defaultLinkType)
|
||||||
{
|
{
|
||||||
return $"[ {{\"cm\":\"df\",\"dt\":0,\"ay\":{(int)defaultLinkType}}},{{\"cm\":\"Widget\",\"dt\":{(int)AyaDataType.Text},\"ay\":{(int)defaultLinkType}}}]";
|
return $"[ {{\"cm\":\"df\",\"dt\":0,\"ay\":{(int)defaultLinkType}}},{{\"cm\":\"Widget\",\"dt\":{(int)AyaUiFieldDataType.Text},\"ay\":{(int)defaultLinkType}}}]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -321,7 +321,7 @@ namespace AyaNova.Biz
|
|||||||
sb.Append(",");
|
sb.Append(",");
|
||||||
sb.Append("{");
|
sb.Append("{");
|
||||||
//Build required part of column definition
|
//Build required part of column definition
|
||||||
sb.Append($"\"cm\":\"{o.Key}\",\"dt\":{(int)o.DataType}");
|
sb.Append($"\"cm\":\"{o.Key}\",\"dt\":{(int)o.UiFieldDataType}");
|
||||||
|
|
||||||
//Has a AyObjectType? (linkable / openable)
|
//Has a AyObjectType? (linkable / openable)
|
||||||
if (o.AyObjectType != 0)
|
if (o.AyObjectType != 0)
|
||||||
@@ -350,7 +350,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 int DataType { get; set; }
|
public int UiFieldDataType { 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)
|
||||||
|
|||||||
@@ -38,9 +38,9 @@ namespace AyaNova.Biz
|
|||||||
tagList = filterItem["value"].ToObject<List<String>>();
|
tagList = filterItem["value"].ToObject<List<String>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
var dataType = objectFields.Find(x => x.PropertyName.ToLowerInvariant() == fld).DataType;
|
var dataType = objectFields.Find(x => x.PropertyName.ToLowerInvariant() == fld).UiFieldDataType;
|
||||||
sb.Append("(");
|
sb.Append("(");
|
||||||
sb.Append(DataFilterToColumnCriteria(fld, (AyaDataType)dataType, opType, val, tagList, userId));
|
sb.Append(DataFilterToColumnCriteria(fld, (AyaUiFieldDataType)dataType, opType, val, tagList, userId));
|
||||||
if (i < FilterArray.Count - 1)
|
if (i < FilterArray.Count - 1)
|
||||||
{
|
{
|
||||||
sb.Append(") AND ");
|
sb.Append(") AND ");
|
||||||
@@ -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, AyaDataType DataType, string sOperator, string sValue, List<string> sTags, long userId)//, bool IsCompound)
|
private static string DataFilterToColumnCriteria(string sColumn, AyaUiFieldDataType 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();
|
||||||
@@ -67,7 +67,7 @@ namespace AyaNova.Biz
|
|||||||
{
|
{
|
||||||
switch (DataType)
|
switch (DataType)
|
||||||
{
|
{
|
||||||
case AyaDataType.Text:
|
case AyaUiFieldDataType.Text:
|
||||||
{
|
{
|
||||||
if (sOperator == DataFilterComparisonOperator.Equality)
|
if (sOperator == DataFilterComparisonOperator.Equality)
|
||||||
{
|
{
|
||||||
@@ -144,7 +144,7 @@ namespace AyaNova.Biz
|
|||||||
#region Build for specific type
|
#region Build for specific type
|
||||||
switch (DataType)
|
switch (DataType)
|
||||||
{
|
{
|
||||||
case AyaDataType.Text:
|
case AyaUiFieldDataType.Text:
|
||||||
//escape any pre-existing apostrophes
|
//escape any pre-existing apostrophes
|
||||||
//i.e. "O'Flaherty's pub"
|
//i.e. "O'Flaherty's pub"
|
||||||
sValue = sValue.Replace("'", "''");
|
sValue = sValue.Replace("'", "''");
|
||||||
@@ -243,7 +243,7 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
#endregion build text ops criteria
|
#endregion build text ops criteria
|
||||||
break;
|
break;
|
||||||
case AyaDataType.Bool:
|
case AyaUiFieldDataType.Bool:
|
||||||
{
|
{
|
||||||
switch (sOperator)
|
switch (sOperator)
|
||||||
{
|
{
|
||||||
@@ -271,9 +271,9 @@ namespace AyaNova.Biz
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
//Note there are three types here for display purposes but all are stored in the db as a timestamp the same with date and time components
|
//Note there are three types here for display purposes but all are stored in the db as a timestamp the same with date and time components
|
||||||
case AyaDataType.Date:
|
case AyaUiFieldDataType.Date:
|
||||||
case AyaDataType.DateTime:
|
case AyaUiFieldDataType.DateTime:
|
||||||
case AyaDataType.Time:
|
case AyaUiFieldDataType.Time:
|
||||||
{
|
{
|
||||||
//Note: it is assumed all dates come into here from the CLIENT in UTC iso8601 format
|
//Note: it is assumed all dates come into here from the CLIENT in UTC iso8601 format
|
||||||
//suitable for the database to handle as all database dates are in UTC
|
//suitable for the database to handle as all database dates are in UTC
|
||||||
@@ -717,16 +717,16 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AyaDataType.Enum://enums are just ints to the db, but it's a special type so the client can recognize it
|
case AyaUiFieldDataType.Enum://enums are just ints to the db, but it's a special type so the client can recognize it
|
||||||
case AyaDataType.Decimal:
|
case AyaUiFieldDataType.Decimal:
|
||||||
case AyaDataType.Integer: //whole numbers, not only integer
|
case AyaUiFieldDataType.Integer: //whole numbers, not only integer
|
||||||
{
|
{
|
||||||
//case 1795 - it's numeric, convert to locale independant format
|
//case 1795 - it's numeric, convert to locale independant format
|
||||||
//RAVEN NOTE: this code looks suspect to me, but I'll leave it in for now
|
//RAVEN NOTE: this code looks suspect to me, but I'll leave it in for now
|
||||||
NumberFormatInfo nfi = System.Globalization.CultureInfo.CurrentCulture.NumberFormat;
|
NumberFormatInfo nfi = System.Globalization.CultureInfo.CurrentCulture.NumberFormat;
|
||||||
switch (DataType)
|
switch (DataType)
|
||||||
{
|
{
|
||||||
case AyaDataType.Decimal:
|
case AyaUiFieldDataType.Decimal:
|
||||||
{
|
{
|
||||||
if (nfi.CurrencyDecimalSeparator != ".")
|
if (nfi.CurrencyDecimalSeparator != ".")
|
||||||
{
|
{
|
||||||
@@ -735,7 +735,7 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AyaDataType.Integer:
|
case AyaUiFieldDataType.Integer:
|
||||||
{
|
{
|
||||||
if (nfi.NumberDecimalSeparator != ".")
|
if (nfi.NumberDecimalSeparator != ".")
|
||||||
{
|
{
|
||||||
@@ -781,7 +781,7 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AyaDataType.Tags:
|
case AyaUiFieldDataType.Tags:
|
||||||
{
|
{
|
||||||
//Build tags filter fragment
|
//Build tags filter fragment
|
||||||
//for initial release a tag filter is inclusive of all tags only
|
//for initial release a tag filter is inclusive of all tags only
|
||||||
|
|||||||
Reference in New Issue
Block a user