This commit is contained in:
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -53,7 +53,7 @@
|
||||
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
|
||||
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
|
||||
"AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles",
|
||||
"AYANOVA_SERVER_TEST_MODE": "true",
|
||||
"AYANOVA_SERVER_TEST_MODE": "false",
|
||||
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "large",
|
||||
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7",
|
||||
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using AyaNova.Biz;
|
||||
using AyaNova.Models;
|
||||
|
||||
@@ -72,15 +73,7 @@ namespace AyaNova.DataList
|
||||
SqlValueColumnName = "aworkorderitemunit.notes"
|
||||
});
|
||||
|
||||
//META column
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
FieldKey = "metawoitemunitid",
|
||||
UiFieldDataType = (int)UiFieldDataType.InternalId,
|
||||
SqlIdColumnName = "aworkorderitemunit.id",
|
||||
SqlValueColumnName = "aworkorderitemunit.id",
|
||||
IsMeta = true
|
||||
});
|
||||
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemUnitCustom1", FieldKey = "workorderitemunitcustom1", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aworkorderitemunit.customfields", TKeySection = "WorkOrderItemUnit" });
|
||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemUnitCustom2", FieldKey = "workorderitemunitcustom2", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aworkorderitemunit.customfields", TKeySection = "WorkOrderItemUnit" });
|
||||
@@ -100,8 +93,24 @@ namespace AyaNova.DataList
|
||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemUnitCustom16", FieldKey = "workorderitemunitcustom16", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aworkorderitemunit.customfields", TKeySection = "WorkOrderItemUnit" });
|
||||
|
||||
|
||||
//META columns
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
FieldKey = "metawoitemunitid",
|
||||
UiFieldDataType = (int)UiFieldDataType.InternalId,
|
||||
SqlIdColumnName = "aworkorderitemunit.id",
|
||||
SqlValueColumnName = "aworkorderitemunit.id",
|
||||
IsMeta = true
|
||||
});
|
||||
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
FieldKey = "metaunit",
|
||||
UiFieldDataType = (int)UiFieldDataType.InternalId,
|
||||
SqlIdColumnName = "aworkorderitemunit.unitid",
|
||||
SqlValueColumnName = "aworkorderitemunit.unitid",
|
||||
IsMeta = true
|
||||
});
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -488,11 +497,44 @@ namespace AyaNova.DataList
|
||||
|
||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, string clientCriteria)
|
||||
{
|
||||
//This is required to filter out rows where there are no matching scheduled user otherwise we'd get all workorders and items regardless
|
||||
|
||||
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
||||
DataListFilterOption FilterOption = new DataListFilterOption() { Column = "metawoitemunitid" };
|
||||
FilterOption.Items.Add(new DataListColumnFilter() { value = "*NULL*", op = DataListFilterComparisonOperator.NotEqual });
|
||||
ret.Add(FilterOption);
|
||||
|
||||
//This is required to filter out rows where there are no matching scheduled user otherwise we'd get all workorders and items regardless
|
||||
{
|
||||
DataListFilterOption FilterOption = new DataListFilterOption() { Column = "metawoitemunitid" };
|
||||
FilterOption.Items.Add(new DataListColumnFilter() { value = "*NULL*", op = DataListFilterComparisonOperator.NotEqual });
|
||||
ret.Add(FilterOption);
|
||||
}
|
||||
|
||||
//This is an optional filter generated at client to restrict to particular item's workorders
|
||||
//ClientCriteria format for this list is "OBJECTID,AYATYPE"
|
||||
var crit = (clientCriteria ?? "").Split(',').Select(z => z.Trim()).ToArray();
|
||||
if (crit.Length > 1)
|
||||
{
|
||||
//will be filtered from different types, show all workorders from Customer, Project and nothing else at this time (others but for sub lists like workorderitemunits etc)
|
||||
int nType = 0;
|
||||
if (!int.TryParse(crit[1], out nType)) return ret;
|
||||
AyaType forType = (AyaType)nType;
|
||||
if (forType != AyaType.Unit) return ret;//only supports Unit currently but could be more later
|
||||
|
||||
long lId = 0;
|
||||
if (!long.TryParse(crit[0], out lId)) return ret;
|
||||
if (lId == 0) return ret;
|
||||
|
||||
//Have valid type, have an id, so filter away
|
||||
switch (forType)
|
||||
{
|
||||
case AyaType.Unit:
|
||||
{
|
||||
DataListFilterOption FilterOption = new DataListFilterOption() { Column = "metaunit" };
|
||||
FilterOption.Items.Add(new DataListColumnFilter() { value = crit[0], op = DataListFilterComparisonOperator.Equality });
|
||||
ret.Add(FilterOption);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}//eoc
|
||||
|
||||
Reference in New Issue
Block a user