This commit is contained in:
@@ -2,20 +2,20 @@ using System.Collections.Generic;
|
|||||||
|
|
||||||
namespace AyaNova.Biz
|
namespace AyaNova.Biz
|
||||||
{
|
{
|
||||||
public static class AyDataType
|
// public static class AyDataType
|
||||||
{
|
// {
|
||||||
//Date and time types, all stored internally as a date and time timestamp, but may display as date only or time only
|
// //Date and time types, all stored internally as a date and time timestamp, but may display as date only or time only
|
||||||
public const string DateTime = "datetime";
|
// public const string DateTime = "datetime";
|
||||||
public const string Date = "date";
|
// public const string Date = "date";
|
||||||
public const string Time = "time";
|
// public const string Time = "time";
|
||||||
public const string Text = "text";
|
// public const string Text = "text";
|
||||||
public const string Integer = "int";
|
// public const string Integer = "int";
|
||||||
public const string Bool = "bool";
|
// public const string Bool = "bool";
|
||||||
public const string Decimal = "decimal";
|
// public const string Decimal = "decimal";
|
||||||
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
|
||||||
}
|
// }
|
||||||
|
|
||||||
//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 AyaDataType : int
|
||||||
|
|||||||
@@ -13,28 +13,28 @@ namespace AyaNova.Biz
|
|||||||
// - Text
|
// - Text
|
||||||
// - Bool
|
// - Bool
|
||||||
|
|
||||||
public const string Currency = "currency";
|
// public const string Currency = "currency";
|
||||||
public const string Date = "date";
|
// public const string Date = "date";
|
||||||
public const string Time = "time";
|
// public const string Time = "time";
|
||||||
public const string DateTime = "datetime";
|
// public const string DateTime = "datetime";
|
||||||
public const string Text = "text";
|
// public const string Text = "text";
|
||||||
public const string Number = "number"; //decimal regardless
|
// public const string Number = "number"; //decimal regardless
|
||||||
public const string Bool = "bool";
|
// public const string Bool = "bool";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static List<string> ValidCustomFieldTypes
|
public static List<int> ValidCustomFieldTypes
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var ret = new List<string>();
|
var ret = new List<int>();
|
||||||
ret.Add(CustomFieldType.Currency);
|
ret.Add((int)AyaDataType.Currency);
|
||||||
ret.Add(CustomFieldType.Date);
|
ret.Add((int)AyaDataType.Date);
|
||||||
ret.Add(CustomFieldType.Time);
|
ret.Add((int)AyaDataType.Time);
|
||||||
ret.Add(CustomFieldType.DateTime);
|
ret.Add((int)AyaDataType.DateTime);
|
||||||
ret.Add(CustomFieldType.Text);
|
ret.Add((int)AyaDataType.Text);
|
||||||
ret.Add(CustomFieldType.Number);
|
ret.Add((int)AyaDataType.Number);
|
||||||
ret.Add(CustomFieldType.Bool);
|
ret.Add((int)AyaDataType.Bool);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
var dataType = objectFields.Find(x => x.PropertyName.ToLowerInvariant() == fld).DataType;
|
var dataType = objectFields.Find(x => x.PropertyName.ToLowerInvariant() == fld).DataType;
|
||||||
sb.Append("(");
|
sb.Append("(");
|
||||||
sb.Append(DataFilterToColumnCriteria(fld, dataType, opType, val, tagList, userId));
|
sb.Append(DataFilterToColumnCriteria(fld, (AyaDataType)dataType, opType, val, tagList, userId));
|
||||||
if (i < FilterArray.Count - 1)
|
if (i < FilterArray.Count - 1)
|
||||||
{
|
{
|
||||||
sb.Append(") AND ");
|
sb.Append(") AND ");
|
||||||
@@ -142,9 +142,9 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
|
|
||||||
#region Build for specific type
|
#region Build for specific type
|
||||||
switch (sDataType)
|
switch (DataType)
|
||||||
{
|
{
|
||||||
case AyDataType.Text:
|
case AyaDataType.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 AyDataType.Bool:
|
case AyaDataType.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 AyDataType.Date:
|
case AyaDataType.Date:
|
||||||
case AyDataType.DateTime:
|
case AyaDataType.DateTime:
|
||||||
case AyDataType.Time:
|
case AyaDataType.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 AyDataType.Enum://enums are just ints to the db, but it's a special type so the client can recognize it
|
case AyaDataType.Enum://enums are just ints to the db, but it's a special type so the client can recognize it
|
||||||
case AyDataType.Decimal:
|
case AyaDataType.Decimal:
|
||||||
case AyDataType.Integer: //whole numbers, not only integer
|
case AyaDataType.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 (sDataType)
|
switch (DataType)
|
||||||
{
|
{
|
||||||
case AyDataType.Decimal:
|
case AyaDataType.Decimal:
|
||||||
{
|
{
|
||||||
if (nfi.CurrencyDecimalSeparator != ".")
|
if (nfi.CurrencyDecimalSeparator != ".")
|
||||||
{
|
{
|
||||||
@@ -735,7 +735,7 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AyDataType.Integer:
|
case AyaDataType.Integer:
|
||||||
{
|
{
|
||||||
if (nfi.NumberDecimalSeparator != ".")
|
if (nfi.NumberDecimalSeparator != ".")
|
||||||
{
|
{
|
||||||
@@ -781,7 +781,7 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AyDataType.Tags:
|
case AyaDataType.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
|
||||||
@@ -800,7 +800,7 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new System.ArgumentOutOfRangeException("DATA_TYPE", sDataType, "GridToSqlCriteria unhandled data type[" + sDataType + "]");
|
throw new System.ArgumentOutOfRangeException("DATA_TYPE", DataType, "GridToSqlCriteria unhandled data type[" + DataType + "]");
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}//end of nonnull path
|
}//end of nonnull path
|
||||||
|
|||||||
Reference in New Issue
Block a user