LISTS WORKING cleanup afterwords
This commit is contained in:
@@ -4,48 +4,18 @@ namespace AyaNova.DataList
|
||||
{
|
||||
internal class AttachmentDataList : DataListProcessingBase
|
||||
{
|
||||
|
||||
public AttachmentDataList()
|
||||
{
|
||||
DefaultListObjectType = AyaType.FileAttachment;
|
||||
SQLFrom = "from afileattachment";
|
||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
|
||||
// //Default ListView
|
||||
// dynamic dlistView = new JArray();
|
||||
|
||||
// dynamic cm = new JObject();
|
||||
// cm.fld = "displayfilename";
|
||||
// cm.sort = "+";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "object";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "size";
|
||||
// cm.sort = "-";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "notes";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "exists";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
||||
|
||||
DefaultColumns = new List<string>() { "displayfilename", "object", "size", "notes", "exists" };
|
||||
DefaultSortBy = new Dictionary<string, string>() { { "displayfilename", "+" }, { "size", "-" } };
|
||||
|
||||
|
||||
//NOTE: Due to the join, all the sql id and name fields that can conflict with the joined (in this case User) table need to be specified completely
|
||||
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||
//DPRECATED FieldDefinitions.Add(new AyaDataListFieldDefinition { FieldKey = "df", AyaObjectType = (int)AyaType.User, SqlIdColumnName = "auser.id" });
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "FileAttachment",
|
||||
|
||||
@@ -10,38 +10,9 @@ namespace AyaNova.DataList
|
||||
SQLFrom = "from acustomer left join aheadoffice on (acustomer.headofficeid=aheadoffice.id) left join acontract on (acustomer.contractid=acontract.id)";
|
||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
|
||||
|
||||
//######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
||||
// //Default ListView
|
||||
// dynamic dlistView = new JArray();
|
||||
|
||||
// dynamic cm = new JObject();
|
||||
// cm.fld = "customername";
|
||||
// cm.sort = "+";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "customerphone1";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "customeremail";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "customerheadoffice";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
||||
|
||||
DefaultColumns = new List<string>() { "customername", "customerphone1", "customeremail", "customerheadoffice" };
|
||||
DefaultSortBy = new Dictionary<string, string>() { { "customername", "+" } };
|
||||
|
||||
|
||||
|
||||
//NOTE: Due to the join, all the sql id and name fields that can conflict with the joined table need to be specified completely
|
||||
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
|
||||
@@ -12,31 +12,9 @@ namespace AyaNova.DataList
|
||||
SQLFrom = "from acustomernote left join auser on (acustomernote.userid=auser.id)";
|
||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
|
||||
// //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
||||
// //Default ListView
|
||||
// dynamic dlistView = new JArray();
|
||||
|
||||
|
||||
// dynamic cm = new JObject();
|
||||
// cm.fld = "notedate";
|
||||
// cm.sort = "-";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "notes";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "username";
|
||||
// dlistView.Add(cm);
|
||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
||||
|
||||
DefaultColumns = new List<string>() { "notedate", "notes", "username" };
|
||||
DefaultSortBy = new Dictionary<string, string>() { { "notedate", "-" } };
|
||||
|
||||
|
||||
//NOTE: Due to the join, all the sql id and name fields that can conflict with the joined table need to be specified completely
|
||||
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
@@ -89,7 +67,7 @@ namespace AyaNova.DataList
|
||||
if (string.IsNullOrWhiteSpace(clientCriteria))
|
||||
throw new System.ArgumentNullException("CustomerNoteDataList - ClientCriteria is empty, should be Customer ID");
|
||||
|
||||
DataListFilterOption FilterOption = new DataListFilterOption() { Column = "metacustomer" };
|
||||
DataListFilterOption FilterOption = new DataListFilterOption() { Column = "metacustomer" };
|
||||
FilterOption.Items.Add(new DataListColumnFilter() { value = clientCriteria, op = DataListFilterComparisonOperator.Equality });
|
||||
|
||||
ret.Add(FilterOption);
|
||||
|
||||
@@ -15,39 +15,9 @@ namespace AyaNova.DataList
|
||||
"left join aworkorder as w on (wi.workorderid=w.id)";
|
||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
|
||||
// //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
||||
// //Default ListView
|
||||
// dynamic dlistView = new JArray();
|
||||
// dynamic cm = null;
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "Created";
|
||||
// cm.sort = "-";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "Customer";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "CustomerServiceRequestTitle";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "CustomerServiceRequestPriority";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "CustomerServiceRequestStatus";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
||||
|
||||
DefaultColumns = new List<string>() { "Created", "Customer", "CustomerServiceRequestTitle", "CustomerServiceRequestPriority", "CustomerServiceRequestStatus" };
|
||||
DefaultSortBy = new Dictionary<string, string>() { { "Created", "-" } };
|
||||
|
||||
//NOTE: Due to the join, all the sql id and name fields that can conflict with the joined table need to be specified completely
|
||||
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
|
||||
|
||||
namespace AyaNova.DataList
|
||||
{
|
||||
internal static class DataListFactory
|
||||
|
||||
@@ -6,7 +6,6 @@ using Microsoft.Extensions.Logging;
|
||||
using AyaNova.Models;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using EnumsNET;
|
||||
|
||||
namespace AyaNova.DataList
|
||||
{
|
||||
@@ -19,39 +18,7 @@ namespace AyaNova.DataList
|
||||
//
|
||||
internal static async Task<DataListReturnData> GetResponseAsync(AyContext ct, DataListTableProcessingOptions dataListTableProcessingOptions, IDataListProcessing DataList, AuthorizationRoles userRoles, ILogger log, long userId)
|
||||
{
|
||||
|
||||
// var DataList = DataListFactory.GetAyaDataList(dataListTableRequest.DataListKey);
|
||||
|
||||
//was the name not found as a list?
|
||||
// if (DataList == null)
|
||||
// throw new System.ArgumentOutOfRangeException($"DataList \"{dataListTableRequest.DataListKey}\" specified does not exist");
|
||||
|
||||
//turn the DataListTableRequest into a DataListTableProcesingOptions object here
|
||||
//hydrates filter and column selections etc
|
||||
// = new DataListTableProcessingOptions(dataListTableRequest, DataList, ct);
|
||||
|
||||
//#### TODO: below block into above method to clean it up and centralize it
|
||||
|
||||
|
||||
// //STATIC filter options from server
|
||||
// List<DataListFilterOption> StaticServerFilterOptions = new List<DataListFilterOption>();
|
||||
// if (DataList is IDataListInternalCriteria)
|
||||
// StaticServerFilterOptions = ((IDataListInternalCriteria)DataList).DataListInternalCriteria(userId, userRoles, dataListTableOptions);
|
||||
|
||||
|
||||
// //Get the public field key names in a list from the listview
|
||||
// List<string> PublicListViewFieldList = listOptions.Columns;
|
||||
|
||||
//Get the combination of all unique fields from both StaticServerFilterOptions and listOptions
|
||||
//NOTE: this assumes no list options filter colums that don't exist in listoptions.columns
|
||||
// var AllUniqueFieldKeysRequiredForQuery = dataListTableOptions.Columns.Union(StaticServerFilterOptions.Select(z => z.Column).ToList()).ToList();
|
||||
|
||||
// //Add the internal filters into the listoptions existing filters
|
||||
// //NOTE: There is currently no overlap between internal filtered columns and filters coming from the client
|
||||
// foreach (DataListFilterOption dfo in StaticServerFilterOptions)
|
||||
// dataListTableOptions.Filter.Add(dfo);
|
||||
|
||||
//BUILD THE QUERY
|
||||
//#BUILD THE QUERY
|
||||
|
||||
//SELECT CLAUSE
|
||||
var qSelect = DataListSqlSelectBuilder.BuildForDataTableListResponse(DataList.FieldDefinitions, dataListTableProcessingOptions.AllUniqueColumnKeysReferenced);
|
||||
@@ -100,17 +67,13 @@ namespace AyaNova.DataList
|
||||
while (dr.Read())
|
||||
{
|
||||
List<DataListField> row = new List<DataListField>(returnRowColumnCount);
|
||||
|
||||
|
||||
//INSERT REMAINING FIELDS FROM TEMPLATE INTO THE RETURN ROWS LIST
|
||||
foreach (string TemplateField in dataListTableProcessingOptions.Columns)
|
||||
{
|
||||
|
||||
//get the AyaObjectFieldDefinition
|
||||
DataListFieldDefinition f = DataList.FieldDefinitions.FirstOrDefault(z => z.FieldKey == TemplateField);
|
||||
if (f.IsCustomField)
|
||||
{
|
||||
|
||||
DataListField AyaField = new DataListField();
|
||||
//could be null
|
||||
var rawValue = dr.GetValue(qSelect.map[f.GetSqlValueColumnName()]);
|
||||
@@ -123,7 +86,6 @@ namespace AyaNova.DataList
|
||||
//convert field name to cust name then get value
|
||||
var InternalCustomFieldName = FormFieldReference.TranslateLTCustomFieldToInternalCustomFieldName(TemplateField);
|
||||
//Sometimes a custom field is specified but doesn't exist in the collection so don't assume it's there
|
||||
// AyaField.v = j[InternalCustomFieldName].Value<object>();
|
||||
JToken o = j[InternalCustomFieldName];
|
||||
if (o != null)
|
||||
AyaField.v = o.Value<object>();
|
||||
@@ -131,29 +93,12 @@ namespace AyaNova.DataList
|
||||
AyaField.v = null;
|
||||
|
||||
row.Add(AyaField);
|
||||
}else{
|
||||
AyaField.v=null;
|
||||
}
|
||||
else
|
||||
{
|
||||
AyaField.v = null;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
TODO: Custom field handling
|
||||
GetName works just not with multipart identifiers
|
||||
I could force naming by making all fields and AS, or
|
||||
I could map the ordinal when generating the Select fields so that I have a map to refer to here
|
||||
mapping in advance actually makes a lot of sense, then no more of this fragility of going by pointer index and hoping for the best
|
||||
it would just be premapped out.
|
||||
|
||||
dr.GetOrdinal(f.SqlValueColumnName)
|
||||
'dr.GetOrdinal(f.SqlValueColumnName)' threw an exception of type 'System.IndexOutOfRangeException'
|
||||
f.SqlValueColumnName
|
||||
"awidget.customfields"
|
||||
dr.GetName(nCurrentColumnPointer)
|
||||
"customfields"
|
||||
dr.GetOrdinal("customfields");
|
||||
5
|
||||
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -230,72 +175,22 @@ namespace AyaNova.DataList
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//BUILD THE COLUMNS RETURN PROPERTY JSON FRAGMENT
|
||||
Newtonsoft.Json.Linq.JArray ColumnsJSON = null;
|
||||
ColumnsJSON = DataList.GenerateReturnListColumns(dataListTableProcessingOptions.Columns);
|
||||
|
||||
|
||||
return new DataListReturnData(rows, totalRecordCount, ColumnsJSON, dataListTableProcessingOptions.SortBy, dataListTableProcessingOptions.Filter.Where(z => z.Column.StartsWith("meta") == false).ToList());
|
||||
}
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Get a list of id's of the datalist results for reporting
|
||||
//
|
||||
//
|
||||
internal static async Task<long[]> GetIdListResponseAsync(AyContext ct, DataListSelectedProcessingOptions dataListSelectionOptions, IDataListProcessing DataList, AuthorizationRoles userRoles, ILogger log, long userId)
|
||||
{
|
||||
// // var DataList = DataListFactory.GetAyaDataList(dataListSelectionOptions.DataListKey);
|
||||
// // //was the name not found as a list?
|
||||
// // if (DataList == null)
|
||||
// // throw new System.ArgumentOutOfRangeException($"DataList \"{dataListSelectionOptions.DataListKey}\" specified does not exist");
|
||||
//#BUILD THE QUERY
|
||||
|
||||
|
||||
|
||||
// //check rights
|
||||
// if (!userRoles.HasAnyFlags(DataList.AllowedRoles))
|
||||
// throw new System.UnauthorizedAccessException("User roles insufficient for this datalist");
|
||||
|
||||
// // //do we need to default the listView?
|
||||
// // if (string.IsNullOrWhiteSpace(listView))
|
||||
// // listView = DataList.DefaultListView;
|
||||
|
||||
// DataList.SetListOptionDefaultsIfNecessary(dataListSelectionOptions);
|
||||
|
||||
// // //parse the list view
|
||||
// // var ListViewArray = JArray.Parse(listView);
|
||||
|
||||
|
||||
// // //Hard coded extra criteria from server end
|
||||
// // if (DataList is IAyaDataListServerCriteria)
|
||||
// // {
|
||||
// // var ServerCriteriaListView = JArray.Parse(((IAyaDataListServerCriteria)DataList).DataListServerCriteria(await ct.User.AsNoTracking().FirstOrDefaultAsync(z => z.Id == userId), ct));
|
||||
// // foreach (JToken jt in ServerCriteriaListView)
|
||||
// // ListViewArray.Add(jt);
|
||||
// // }
|
||||
|
||||
// //STATIC filter options from server
|
||||
// List<DataListFilterOption> StaticServerFilterOptions = null;
|
||||
// if (DataList is IDataListInternalCriteria)
|
||||
// StaticServerFilterOptions = ((IDataListInternalCriteria)DataList).DataListInternalCriteria(userId, userRoles, dataListSelectionOptions);
|
||||
|
||||
// //Add the internal filters into the listoptions existing filters
|
||||
// //NOTE: There is currently no overlap between internal filtered columns and filters coming from the client
|
||||
// foreach (DataListFilterOption dfo in StaticServerFilterOptions)
|
||||
// dataListSelectionOptions.Filter.Add(dfo);
|
||||
|
||||
// // //Hard coded extra criteria from Client end
|
||||
// // //parse and combine any additional listview hard coded from Client UI
|
||||
// // var MetaListViewArray = JArray.Parse(metaListView ?? "[]");
|
||||
// // foreach (JToken jt in MetaListViewArray)
|
||||
// // ListViewArray.Add(jt);
|
||||
|
||||
// // //Get the field key names in a list from the listview
|
||||
// // List<string> ListViewFieldList = DataList.GetFieldListFromListView(ListViewArray);
|
||||
|
||||
//BUILD THE QUERY
|
||||
//SELECT FRAGMENT COLUMNS FROM TEMPLATE
|
||||
var qSelect = DataListSqlSelectBuilder.BuildForIdListResponse(DataList.FieldDefinitions, dataListSelectionOptions);
|
||||
|
||||
@@ -319,22 +214,6 @@ namespace AyaNova.DataList
|
||||
//RETURN OBJECTS
|
||||
var retList = new List<long>();
|
||||
|
||||
//GET ID COLUMN ORDINAL
|
||||
int IDColumnOrdinal = 0;
|
||||
|
||||
//NOTE: assuming change of code means id column is *always* the zeroth column
|
||||
|
||||
// foreach (string TemplateField in ListViewFieldList)
|
||||
// {
|
||||
// //get the AyaObjectFieldDefinition
|
||||
// AyaDataListFieldDefinition f = DataList.FieldDefinitions.FirstOrDefault(z => z.FieldKey == TemplateField);
|
||||
// if (f.IsRowId)
|
||||
// {
|
||||
// IDColumnOrdinal = SelectBuild.map[f.SqlIdColumnName];
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
using (var command = ct.Database.GetDbConnection().CreateCommand())
|
||||
{
|
||||
await ct.Database.OpenConnectionAsync();
|
||||
@@ -345,8 +224,9 @@ namespace AyaNova.DataList
|
||||
{
|
||||
while (dr.Read())
|
||||
{
|
||||
if (!dr.IsDBNull(IDColumnOrdinal))
|
||||
retList.Add(dr.GetInt64(IDColumnOrdinal));
|
||||
//only one column and it's the zeroth id column
|
||||
if (!dr.IsDBNull(0))
|
||||
retList.Add(dr.GetInt64(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
using AyaNova.Biz;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace AyaNova.DataList
|
||||
{
|
||||
|
||||
//This class defines a field used for returning data in list format for UI grid lists and reporting
|
||||
public class DataListFieldDefinition
|
||||
{
|
||||
@@ -51,12 +49,9 @@ namespace AyaNova.DataList
|
||||
[JsonIgnore]
|
||||
public string SqlColorColumnName { get; set; }//column to fetch the color if applicable to this field
|
||||
|
||||
|
||||
|
||||
public DataListFieldDefinition()
|
||||
{
|
||||
//most common defaults
|
||||
|
||||
IsCustomField = false;
|
||||
IsFilterable = true;
|
||||
IsSortable = true;
|
||||
@@ -66,7 +61,6 @@ namespace AyaNova.DataList
|
||||
AyaObjectType = (int)AyaType.NoType;
|
||||
SqlAyTypeColumnName = null;//must be null as that is checked against specifically
|
||||
SqlColorColumnName = null;//must be null to be ignored properly
|
||||
|
||||
}
|
||||
|
||||
//Get column to query for display name or use FieldName if there is no difference
|
||||
|
||||
@@ -39,7 +39,5 @@ namespace AyaNova.DataList
|
||||
return operators;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
|
||||
//MOVED TO MODELS AS DataListTableOptions AND BROKEN APART
|
||||
|
||||
// using System.ComponentModel.DataAnnotations;
|
||||
// using Microsoft.AspNetCore.Mvc;
|
||||
// using System.Collections.Generic;
|
||||
// using
|
||||
|
||||
// namespace AyaNova.DataList
|
||||
// {
|
||||
|
||||
// public sealed class DataListOptions : DataListBase
|
||||
// {
|
||||
// public const int MaxPageSize = 1000;
|
||||
// public const int DefaultOffset = 0;
|
||||
// public const int DefaultLimit = 25;
|
||||
|
||||
// [FromBody]
|
||||
// public int? Offset { get; set; }
|
||||
|
||||
// [FromBody]
|
||||
// public int? Limit { get; set; }
|
||||
|
||||
// [FromBody, Required]
|
||||
// public string DataListKey { get; set; }
|
||||
|
||||
// [FromBody]
|
||||
// public DataListView View { get; set; }
|
||||
|
||||
|
||||
// // [FromBody]
|
||||
// // public List<string> Columns { get; set; }
|
||||
// // [FromBody]
|
||||
// // public Dictionary<string, string> SortBy { get; set; }
|
||||
// // [FromBody]
|
||||
// // public List<DataListFilterOption> Filter { get; set; }
|
||||
// // [FromBody]
|
||||
// // public string ClientCriteria { get; set; }
|
||||
// }
|
||||
|
||||
|
||||
// public class DataListView
|
||||
// {
|
||||
// /*
|
||||
// OLD EXAMPLE:
|
||||
// {"offset":0,"limit":10,"dataListKey":"CustomerDataList",
|
||||
// "listView":"[
|
||||
// {\"fld\":\"customername\",\"sort\":\"+\",\"filter\":{\"items\":[{\"op\":\"=\",\"value\":\"dfdfdf\"},{\"op\":\"=\",\"value\":\"3333\"}],\"any\":true}},
|
||||
// {\"fld\":\"customerphone1\",\"filter\":{\"items\":[{\"op\":\">\",\"value\":\"44444\"},
|
||||
// {\"op\":\"<\",\"value\":\"7777\"}]}},
|
||||
// {\"fld\":\"customeremail\"}
|
||||
// {\"fld\":\"customerheadoffice\"},
|
||||
// {\"fld\":\"customertags\",\"sort\":\"+\"}]"}
|
||||
|
||||
// NEW:
|
||||
// columns:["PartInventoryTransactionEntryDate","PartPartNumber","PartWarehouseName","PartInventoryTransactionQuantity","PartInventoryTransactionDescription","PartInventoryTransactionSource","PartInventoryBalance"]
|
||||
// sortBy:[{"PartInventoryTransactionEntryDate":"-"}],//All sorted columns here as keyvalue pairs value is a string of "+" for ascending "-" for descending and are IN ORDER of how to be sorted
|
||||
// filter:[{column:"PartPartNumber",any:true/false,items:[{op: "=",value: "400735"}]}],
|
||||
// clientCriteria:"2" //could be anything here that makes sense to the list, in this case an example customer id for customernotedatalist
|
||||
// */
|
||||
// [FromBody]
|
||||
// public List<string> Columns { get; set; }
|
||||
// [FromBody]
|
||||
// public Dictionary<string, string> SortBy { get; set; }
|
||||
// [FromBody]
|
||||
// public List<DataListFilterOption> Filter { get; set; }
|
||||
// [FromBody]
|
||||
// public string ClientCriteria { get; set; }
|
||||
// }
|
||||
|
||||
|
||||
// public class DataListFilterOption
|
||||
// {
|
||||
// public string Column { get; set; }
|
||||
// public List<DataListColumnFilter> items { get; set; }
|
||||
// public bool Any { get; set; }//means "or" the filter conditions
|
||||
// DataListFilterOption()
|
||||
// {
|
||||
// items = new List<DataListColumnFilter>();
|
||||
// }
|
||||
// }
|
||||
|
||||
// public class DataListColumnFilter
|
||||
// {
|
||||
// public string op { get; set; }
|
||||
// public string value { get; set; }
|
||||
// }
|
||||
|
||||
// }
|
||||
@@ -19,23 +19,18 @@ namespace AyaNova.DataList
|
||||
public DataListProcessingBase()
|
||||
{
|
||||
/*
|
||||
NOTE: all sql identifiers need to be explicitly identified as understood by postgres
|
||||
|
||||
DefaultColumns = new List<string>() { "XXX", "XXXX", "XXXX", "XXXX", "XXXX", "XXX", "XXXX", "XXXX", "XXXX", "XXXX" };
|
||||
DefaultSortBy = new Dictionary<string, string>() { { "XXXX", "+" }, { "XXXX", "-" } };
|
||||
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
public string SQLFrom { get; set; }
|
||||
public List<DataListFieldDefinition> FieldDefinitions { get; set; }
|
||||
public AuthorizationRoles AllowedRoles { get; set; }
|
||||
public AyaType DefaultListObjectType { get; set; }
|
||||
|
||||
|
||||
|
||||
public long CurrentUserId { get; set; }
|
||||
|
||||
public List<string> DefaultColumns { get; set; }
|
||||
public Dictionary<string, string> DefaultSortBy { get; set; }
|
||||
|
||||
@@ -71,22 +66,6 @@ namespace AyaNova.DataList
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// //return array of field keys in list view
|
||||
// public List<string> GetFieldListFromListView(JArray listViewArray)
|
||||
// {
|
||||
// // [{key:"COLUMN UNIQUE KEY ID",sort:"-" or "+",filter:{any:true/false,items:[{FILTER OBJECT SEE BELOW}]} }, {key:"second column unique key"},{...etc...}]
|
||||
// List<string> ret = new List<string>();
|
||||
// for (int i = 0; i < listViewArray.Count; i++)
|
||||
// {
|
||||
// var cm = listViewArray[i];
|
||||
// ret.Add(cm["fld"].Value<string>());
|
||||
// }
|
||||
// return ret;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
public Newtonsoft.Json.Linq.JArray GenerateReturnListColumns(List<string> columns)
|
||||
{
|
||||
|
||||
@@ -197,14 +176,7 @@ namespace AyaNova.DataList
|
||||
using (var ct = AyaNova.Util.ServiceProviderProvider.DBContext)
|
||||
{
|
||||
var fc = ct.FormCustom.AsNoTracking().SingleOrDefault(z => z.FormKey == ayatypename);
|
||||
//This is normal and expected in an empty db, removing this block
|
||||
// #if (DEBUG)
|
||||
// if (fc == null)
|
||||
// {
|
||||
// throw new System.ArgumentNullException($"AyaDataList:GetCustomFieldDefinitionsForList, Custom field object type {ayatypename} has no FormCustom defined");
|
||||
// }
|
||||
// #endif
|
||||
//production handling of missing formcustom
|
||||
//normal condition
|
||||
if (fc == null)
|
||||
continue;
|
||||
|
||||
@@ -224,47 +196,6 @@ namespace AyaNova.DataList
|
||||
}
|
||||
}
|
||||
}
|
||||
/*{[
|
||||
{
|
||||
"fld": "Notes",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"fld": "WidgetCustom1",
|
||||
"required": false,
|
||||
"type": 1
|
||||
},
|
||||
{
|
||||
"fld": "WidgetCustom2",
|
||||
"required": true,
|
||||
"type": 4
|
||||
},
|
||||
{
|
||||
"fld": "WidgetCustom3",
|
||||
"required": false,
|
||||
"type": 5
|
||||
},
|
||||
{
|
||||
"fld": "WidgetCustom4",
|
||||
"required": false,
|
||||
"type": 6
|
||||
},
|
||||
{
|
||||
"fld": "WidgetCustom5",
|
||||
"required": false,
|
||||
"type": 8
|
||||
},
|
||||
{
|
||||
"fld": "WidgetCustom6",
|
||||
"required": false,
|
||||
"type": 2
|
||||
},
|
||||
{
|
||||
"fld": "WidgetCustom7",
|
||||
"required": false,
|
||||
"type": 3
|
||||
}
|
||||
]}*/
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,10 +2,8 @@ using System.Collections.Generic;
|
||||
using AyaNova.Models;
|
||||
namespace AyaNova.DataList
|
||||
{
|
||||
|
||||
public class DataListReturnData
|
||||
{
|
||||
|
||||
public object Data { get; }
|
||||
public long TotalRecordCount { get; }
|
||||
public object Columns { get; }
|
||||
@@ -19,7 +17,6 @@ namespace AyaNova.DataList
|
||||
Columns = columns;
|
||||
SortBy = sortBy;
|
||||
Filter = filter;
|
||||
|
||||
}
|
||||
}//eoc
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,60 +1,36 @@
|
||||
using System.Text;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Collections.Generic;
|
||||
using AyaNova.Models;
|
||||
|
||||
namespace AyaNova.DataList
|
||||
{
|
||||
public static class DataListSqlFilterOrderByBuilder
|
||||
{
|
||||
|
||||
|
||||
public static string DataFilterToSQLOrderBy(List<DataListFieldDefinition> objectFieldsList, Models.DataListProcessingBase listOptions)
|
||||
{
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
//iterate the datafilter and concatenate a sql query from it
|
||||
// [{key:"COLUMN UNIQUE KEY ID",sort:"-" or "+",filter:{any:true/false,items:[{FILTER OBJECT SEE BELOW}]} }, {key:"second column unique key"},{...etc...}]
|
||||
bool SortItemAdded = false;
|
||||
// for (int i = 0; i < listViewArray.Count; i++)
|
||||
foreach(KeyValuePair<string,string> kvSort in listOptions.SortBy)
|
||||
foreach (KeyValuePair<string, string> kvSort in listOptions.SortBy)
|
||||
{
|
||||
// var cm = listViewArray[i];
|
||||
// //skip it if sort is not defined
|
||||
// if (cm["sort"] == null)
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
// var fld = cm["fld"].Value<string>();
|
||||
// var dir = cm["sort"].Value<string>();
|
||||
|
||||
//Get the correct sql column name
|
||||
DataListFieldDefinition DataListField = objectFieldsList.FirstOrDefault(z => z.FieldKey == kvSort.Key);
|
||||
//No sorting on custom fields!
|
||||
if (DataListField.IsCustomField)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
#if (DEBUG)
|
||||
//Developers little helper
|
||||
if (DataListField == null)
|
||||
{
|
||||
throw new System.ArgumentNullException($"DEV ERROR in DataListSqlFilterOrderByBuilder.cs: field {kvSort.Key} specified in template was NOT found in ObjectFields list");
|
||||
}
|
||||
|
||||
#endif
|
||||
var SQLValueColumnName = DataListField.GetSqlValueColumnName();
|
||||
|
||||
if (SortItemAdded)
|
||||
sb.Append(", ");
|
||||
else
|
||||
sb.Append(" ");
|
||||
sb.Append(SQLValueColumnName);
|
||||
sb.Append(" ");
|
||||
//sb.Append(dir == "+" ? "ASC" : "DESC");
|
||||
sb.Append(kvSort.Value == "+" ? "ASC" : "DESC");
|
||||
|
||||
SortItemAdded = true;
|
||||
}
|
||||
|
||||
@@ -63,22 +39,13 @@ namespace AyaNova.DataList
|
||||
//no sort specified so default it
|
||||
DataListFieldDefinition rid = objectFieldsList.FirstOrDefault(z => z.IsRowId == true);
|
||||
if (rid != null)
|
||||
{
|
||||
return $"ORDER BY {rid.SqlIdColumnName} DESC";
|
||||
}
|
||||
else
|
||||
{
|
||||
//no default column so no idea how to sort
|
||||
return string.Empty;
|
||||
}
|
||||
return string.Empty; //no default column so no idea how to sort
|
||||
}
|
||||
else
|
||||
{
|
||||
return "ORDER BY" + sb.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}//eoc
|
||||
}//ens
|
||||
|
||||
@@ -18,7 +18,6 @@ namespace AyaNova.DataList
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("SELECT ");
|
||||
|
||||
//keep track of which custom fields columns were added already
|
||||
//this ensures that if there is more than one set of custom fields like from two different objects in the list
|
||||
//only unique ones will be returned by query
|
||||
@@ -113,167 +112,15 @@ namespace AyaNova.DataList
|
||||
|
||||
|
||||
//Build the SELECT portion of a list query but only to return rowid's
|
||||
|
||||
internal static string BuildForIdListResponse(List<DataListFieldDefinition> fieldDefinitions, DataListSelectedProcessingOptions dataListSelectionOptions)
|
||||
{
|
||||
//BugBug - is not including internalcriteria OR user filtered columns so they don't filter properly
|
||||
//needs to be there and also return correct 0th column for id filtering or make sure it's always the zeroth I guess
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("SELECT ");
|
||||
//map sql column name to ordinal name
|
||||
// Dictionary<string, int> map = new Dictionary<string, int>();
|
||||
|
||||
//FIRST: find the rowid in the objectfields list and insert it
|
||||
//this is now the zeroth column
|
||||
//note: only need rowid column for these queries, the where conditions don't rely on any defined column names as they explicitly refer to the exact identifier known to postgres
|
||||
//Note: IsRowId field should *always* exist for any list that is intended to be used in an idlist response
|
||||
var o = fieldDefinitions.FirstOrDefault(z => z.IsRowId == true);
|
||||
sb.Append(o.SqlIdColumnName);
|
||||
// map.Add(o.SqlIdColumnName, 0);
|
||||
|
||||
//DO I NEED THIS? NO! You don't need to return columns that are mentioned in WHERE clause unless it's an AS scenario I guess
|
||||
// //Now add any rows found in filter
|
||||
// foreach(var filter in dataListSelectionOptions.Filter){
|
||||
// //add all columns being filtered but not rowId
|
||||
// var fld=fieldDefinitions.FirstOrDefault(z=>z.FieldKey==filter.Column);
|
||||
// if(!fld.IsRowId){
|
||||
// sb.Append($",{fld.SqlIdColumnName}");
|
||||
// //map.Add(fld.SqlIdColumnName);
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
|
||||
|
||||
return sb.ToString();
|
||||
}//eom
|
||||
|
||||
|
||||
// internal static SqlSelectBuilderResult BuildForReportIdListOnly(List<DataListFieldDefinition> objectFieldsList)
|
||||
// {
|
||||
// //BugBug - is not including internalcriteria columns so they don't filter properly
|
||||
// //needs to be there and also return correct 0th column for id filtering or make sure it's always the zeroth I guess
|
||||
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// sb.Append("SELECT ");
|
||||
// //map sql column name to ordinal name
|
||||
// Dictionary<string, int> map = new Dictionary<string, int>();
|
||||
|
||||
// //find the rowid in the objectfields list and insert it
|
||||
// var o = objectFieldsList.FirstOrDefault(z => z.IsRowId == true);
|
||||
// if (o != null)
|
||||
// {
|
||||
// var idColumnName = o.SqlIdColumnName;
|
||||
// if (!string.IsNullOrWhiteSpace(idColumnName))
|
||||
// {
|
||||
// sb.Append(idColumnName);
|
||||
// map.Add(idColumnName, 0);
|
||||
// }
|
||||
// }
|
||||
|
||||
// return new SqlSelectBuilderResult() { map = map, Select = sb.ToString() };
|
||||
// }//eom
|
||||
|
||||
|
||||
// //Build the SELECT portion of a list query but only to return rowid's
|
||||
// internal static SqlSelectBuilderResult BuildForReportIdListOnly(List<AyaDataListFieldDefinition> objectFieldsList, List<string> listViewFieldList)
|
||||
// {
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// sb.Append("SELECT ");
|
||||
// //map sql column name to ordinal name
|
||||
// Dictionary<string, int> map = new Dictionary<string, int>();
|
||||
// int nOrdinal = 0;
|
||||
|
||||
// var firstColumnAdded = false;
|
||||
// foreach (string ColumnName in listViewFieldList)
|
||||
// {
|
||||
// AyaDataListFieldDefinition o = objectFieldsList.FirstOrDefault(z => z.FieldKey == ColumnName);
|
||||
// #if (DEBUG)
|
||||
// //Developers little helper
|
||||
// if (o == null)
|
||||
// {
|
||||
// throw new System.ArgumentNullException($"DEV ERROR in DataListSqlSelectBuilder.cs:BuildForReportIdListOnly() field {ColumnName} specified in template was NOT found in ObjectFields list");
|
||||
// }
|
||||
// #endif
|
||||
// if (o != null && o.IsRowId)//only return the rowid column
|
||||
// {//Ignore missing fields in production
|
||||
// AddTheColumn(sb, map, ref nOrdinal, ref firstColumnAdded, o);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// //insert rowid if it wasn't specified already in the list view
|
||||
// //this is legit as some datalists don't have a rowid visible to user e.g. PartInventoryOnHand
|
||||
// if (map.Count == 0)
|
||||
// {
|
||||
// //find the rowid in the objectfields list and insert it since it wasn't in the view already
|
||||
// var o = objectFieldsList.FirstOrDefault(z => z.IsRowId == true);
|
||||
// if (o != null)
|
||||
// {
|
||||
// // if(!string.IsNullOrWhiteSpace(rowIdColumn.SqlIdColumnName)){
|
||||
// // map.Add(rowIdColumn.SqlIdColumnName, nOrdinal++);
|
||||
// // }else{
|
||||
// // map.Add(rowIdColumn.GetSqlValueColumnName(), nOrdinal++);
|
||||
// // }
|
||||
// AddTheColumn(sb, map, ref nOrdinal, ref firstColumnAdded, o);
|
||||
// }
|
||||
|
||||
// }
|
||||
// return new SqlSelectBuilderResult() { map = map, Select = sb.ToString() };
|
||||
// }//eof
|
||||
|
||||
|
||||
|
||||
|
||||
// private static void AddTheColumn(StringBuilder sb, Dictionary<string, int> map, ref int nOrdinal, ref bool firstColumnAdded, AyaDataListFieldDefinition o)
|
||||
// {
|
||||
// // var valueColumnName = o.GetSqlValueColumnName();
|
||||
// // if (!map.ContainsKey(valueColumnName))
|
||||
// // {
|
||||
// // if (firstColumnAdded)
|
||||
// // sb.Append(", ");
|
||||
// // sb.Append(valueColumnName);
|
||||
// // firstColumnAdded = true;
|
||||
// // map.Add(valueColumnName, nOrdinal++);
|
||||
// // }
|
||||
|
||||
// // //does it also have an ID column?
|
||||
// // var idColumnName = o.SqlIdColumnName;
|
||||
// // if (!string.IsNullOrWhiteSpace(idColumnName))
|
||||
// // {
|
||||
// // if (!map.ContainsKey(idColumnName))
|
||||
// // {
|
||||
// // if (firstColumnAdded)
|
||||
// // sb.Append(", ");
|
||||
// // sb.Append(idColumnName);
|
||||
// // firstColumnAdded = true;
|
||||
// // map.Add(idColumnName, nOrdinal++);
|
||||
// // }
|
||||
// // }
|
||||
|
||||
// // var valueColumnName = o.GetSqlValueColumnName();
|
||||
// // if (!map.ContainsKey(valueColumnName))
|
||||
// // {
|
||||
// // if (firstColumnAdded)
|
||||
// // sb.Append(", ");
|
||||
// // sb.Append(valueColumnName);
|
||||
// // firstColumnAdded = true;
|
||||
// // map.Add(valueColumnName, nOrdinal++);
|
||||
// // }
|
||||
|
||||
// //does it also have an ID column?
|
||||
// var idColumnName = o.SqlIdColumnName;
|
||||
// if (!string.IsNullOrWhiteSpace(idColumnName))
|
||||
// {
|
||||
// // if (!map.ContainsKey(idColumnName))
|
||||
// // {
|
||||
// // if (firstColumnAdded)
|
||||
// // sb.Append(", ");
|
||||
// sb.Append(idColumnName);
|
||||
// // firstColumnAdded = true;
|
||||
// map.Add(idColumnName, 0);
|
||||
// // }
|
||||
// }
|
||||
// }
|
||||
}//eoc
|
||||
}//ens
|
||||
|
||||
@@ -3,14 +3,7 @@ using AyaNova.Biz;
|
||||
namespace AyaNova.DataList
|
||||
{
|
||||
internal class EventDataList : DataListProcessingBase
|
||||
{/*
|
||||
Select aevent.id, aevent.created, aevent.ayid, aevent.ayatype, aevent.ayevent,
|
||||
aevent.textra, auser.name, auser.id
|
||||
from aevent
|
||||
left join auser on (aevent.userid=auser.id)
|
||||
|
||||
*/
|
||||
|
||||
{
|
||||
public EventDataList()
|
||||
{
|
||||
//NOTE: used this type because it's full BizFull and read only BizLimited only which is appropriate and there is no event type
|
||||
@@ -18,38 +11,6 @@ namespace AyaNova.DataList
|
||||
SQLFrom = "from aevent left join auser on (aevent.userid=auser.id)";
|
||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
|
||||
// //Default ListView
|
||||
// dynamic dlistView = new JArray();
|
||||
|
||||
// dynamic cm = new JObject();
|
||||
// cm.fld = "eventcreated";
|
||||
// cm.sort = "-";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "event";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "object";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "AyaType";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "username";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "textra";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
|
||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
||||
|
||||
DefaultColumns = new List<string>() { "eventcreated", "event", "object", "AyaType", "username", "textra" };
|
||||
DefaultSortBy = new Dictionary<string, string>() { { "eventcreated", "-" } };
|
||||
|
||||
@@ -108,9 +69,6 @@ namespace AyaNova.DataList
|
||||
UiFieldDataType = (int)UiFieldDataType.Text,
|
||||
SqlValueColumnName = "aevent.textra"
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
}//eoc
|
||||
}//eons
|
||||
@@ -10,30 +10,9 @@ namespace AyaNova.DataList
|
||||
SQLFrom = "from aheadoffice left join acontract on (aheadoffice.contractid=acontract.id)";
|
||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
|
||||
// //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
||||
// //Default ListView
|
||||
// dynamic dlistView = new JArray();
|
||||
|
||||
// dynamic cm = new JObject();
|
||||
// cm.fld = "headofficename";
|
||||
// cm.sort = "+";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "headofficephone1";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "headofficeemail";
|
||||
// dlistView.Add(cm);
|
||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
||||
|
||||
DefaultColumns = new List<string>() { "headofficename", "headofficephone1", "headofficeemail" };
|
||||
DefaultSortBy = new Dictionary<string, string>() { { "headofficename", "+" } };
|
||||
|
||||
|
||||
//NOTE: Due to the join, all the sql id and name fields that can conflict with the joined table need to be specified completely
|
||||
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
@@ -272,6 +251,5 @@ namespace AyaNova.DataList
|
||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "HeadOfficeCustom16", FieldKey = "headofficecustom16", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aheadoffice.customfields" });
|
||||
}
|
||||
|
||||
|
||||
}//eoc
|
||||
}//eons
|
||||
@@ -1,36 +1,21 @@
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using AyaNova.Biz;
|
||||
using AyaNova.Models;
|
||||
namespace AyaNova.DataList
|
||||
{
|
||||
internal interface IDataListProcessing
|
||||
{
|
||||
|
||||
//sql query from fragment with table joins et
|
||||
string SQLFrom { get; set; }
|
||||
|
||||
//List of fields for this object
|
||||
List<DataListFieldDefinition> FieldDefinitions { get; set; }
|
||||
|
||||
//allowed roles to access this list
|
||||
AuthorizationRoles AllowedRoles { get; set; }
|
||||
|
||||
//Default object type to open for rows of this list (use no object if no)
|
||||
AyaType DefaultListObjectType { get; set; }
|
||||
|
||||
//Defaults when none is specified (see DataListOptions for formats and notes)
|
||||
List<string> DefaultColumns { get; set; }
|
||||
Dictionary<string, string> DefaultSortBy { get; set; }
|
||||
|
||||
List<string> DefaultColumns { get; set; }
|
||||
Dictionary<string, string> DefaultSortBy { get; set; }
|
||||
void SetListOptionDefaultsIfNecessary(Models.DataListProcessingBase listOptions);
|
||||
|
||||
Newtonsoft.Json.Linq.JArray GenerateReturnListColumns(List<string> columns);
|
||||
// List<string> GetFieldListFromListView(JArray listViewArray);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,38 +13,6 @@ namespace AyaNova.DataList
|
||||
SQLFrom = "from auser left join avendor on (auser.vendorid=avendor.id)";
|
||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
|
||||
// //Default ListView
|
||||
// dynamic dlistView = new JArray();
|
||||
|
||||
// dynamic cm = new JObject();
|
||||
// cm.fld = "name";
|
||||
// cm.sort = "+";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "employeenumber";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "active";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "usertype";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "lastlogin";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "roles";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
||||
|
||||
DefaultColumns = new List<string>() { "name", "employeenumber", "active", "usertype", "lastlogin", "roles" };
|
||||
DefaultSortBy = new Dictionary<string, string>() { { "name", "+" } };
|
||||
|
||||
@@ -124,8 +92,6 @@ namespace AyaNova.DataList
|
||||
SqlValueColumnName = "auser.usertype",
|
||||
IsMeta = true
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, string clientCriteria)
|
||||
|
||||
@@ -16,31 +16,9 @@ namespace AyaNova.DataList
|
||||
//todo: look at loanitemlist in v7 it surfaces due date, out date etc in the list and should here too once those fields are coded for
|
||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
|
||||
// //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
||||
// //Default ListView
|
||||
// dynamic dlistView = new JArray();
|
||||
// dynamic cm = null;
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "LoanUnitName";
|
||||
// cm.sort = "+";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "LoanUnitSerial";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "Tags";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
||||
|
||||
DefaultColumns = new List<string>() { "LoanUnitName", "LoanUnitSerial", "Tags" };
|
||||
DefaultSortBy = new Dictionary<string, string>() { { "LoanUnitName", "+" } };
|
||||
|
||||
|
||||
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
@@ -85,7 +63,6 @@ namespace AyaNova.DataList
|
||||
SqlValueColumnName = "aloanunit.tags"
|
||||
});
|
||||
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
FieldKey = "LoanUnitCurrentWorkOrderItemLoan",
|
||||
@@ -163,7 +140,6 @@ namespace AyaNova.DataList
|
||||
SqlValueColumnName = "shadowunit.serial"
|
||||
});
|
||||
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "LoanUnitCustom1", FieldKey = "loanunitcustom1", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aloanunit.customfields" });
|
||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "LoanUnitCustom2", FieldKey = "loanunitcustom2", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aloanunit.customfields" });
|
||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "LoanUnitCustom3", FieldKey = "loanunitcustom3", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aloanunit.customfields" });
|
||||
@@ -182,6 +158,5 @@ namespace AyaNova.DataList
|
||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "LoanUnitCustom16", FieldKey = "loanunitcustom16", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aloanunit.customfields" });
|
||||
}
|
||||
|
||||
|
||||
}//eoc
|
||||
}//eons
|
||||
@@ -12,36 +12,8 @@ namespace AyaNova.DataList
|
||||
SQLFrom = "from amemo left join auser on (amemo.fromid=auser.id)";
|
||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
|
||||
|
||||
// //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
||||
// //Default ListView
|
||||
// dynamic dlistView = new JArray();
|
||||
|
||||
|
||||
// dynamic cm = new JObject();
|
||||
// cm.fld = "MemoSubject";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "MemoFromID";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "MemoSent";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "MemoViewed";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
||||
|
||||
DefaultColumns = new List<string>() { "MemoSubject", "MemoFromID", "MemoSent", "MemoViewed" };
|
||||
DefaultSortBy = new Dictionary<string, string>() { { "MemoSent", "-" } };//added but wasnt' in original
|
||||
|
||||
|
||||
//NOTE: Due to the join, all the sql id and name fields that can conflict with the joined table need to be specified completely
|
||||
DefaultSortBy = new Dictionary<string, string>() { { "MemoSent", "-" } };
|
||||
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
@@ -147,7 +119,5 @@ namespace AyaNova.DataList
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}//eoc
|
||||
}//eons
|
||||
@@ -12,37 +12,9 @@ namespace AyaNova.DataList
|
||||
SQLFrom = "from auser left join aheadoffice on (auser.headofficeid=aheadoffice.id) left join acustomer on (auser.customerid=acustomer.id)";
|
||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
|
||||
// //Default ListView
|
||||
// dynamic dlistView = new JArray();
|
||||
|
||||
// dynamic cm = new JObject();
|
||||
// cm.fld = "name";
|
||||
// cm.sort = "+";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "active";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "usercustomer";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "userheadoffice";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "lastlogin";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
||||
|
||||
DefaultColumns = new List<string>() { "name", "active", "usercustomer", "userheadoffice", "lastlogin" };
|
||||
DefaultSortBy = new Dictionary<string, string>() { { "name", "+" } };
|
||||
|
||||
|
||||
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
@@ -63,7 +35,6 @@ namespace AyaNova.DataList
|
||||
SqlValueColumnName = "auser.employeenumber"
|
||||
});
|
||||
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "Active",
|
||||
@@ -119,7 +90,7 @@ namespace AyaNova.DataList
|
||||
SqlValueColumnName = "acustomer.name"
|
||||
});
|
||||
|
||||
//META COLUMNS
|
||||
//META COLUMNS
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
FieldKey = "metausertype",
|
||||
@@ -130,12 +101,12 @@ namespace AyaNova.DataList
|
||||
});
|
||||
}
|
||||
|
||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles,string clientCriteria)
|
||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, string clientCriteria)
|
||||
{
|
||||
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
||||
|
||||
DataListFilterOption FilterOption = new DataListFilterOption() { Column = "metausertype" };
|
||||
FilterOption.Any=true;
|
||||
FilterOption.Any = true;
|
||||
FilterOption.Items.Add(new DataListColumnFilter() { value = ((int)UserType.Customer).ToString(), op = DataListFilterComparisonOperator.Equality });
|
||||
FilterOption.Items.Add(new DataListColumnFilter() { value = ((int)UserType.HeadOffice).ToString(), op = DataListFilterComparisonOperator.Equality });
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using AyaNova.Biz;
|
||||
namespace AyaNova.DataList
|
||||
{
|
||||
@@ -11,24 +10,8 @@ namespace AyaNova.DataList
|
||||
SQLFrom = "from apartassembly";
|
||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
|
||||
// //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
||||
// //Default ListView
|
||||
// dynamic dlistView = new JArray();
|
||||
// dynamic cm = null;
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "partassemblyname";
|
||||
// cm.sort = "+";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
|
||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
||||
|
||||
DefaultColumns = new List<string>() { "partassemblyname" };
|
||||
DefaultSortBy = new Dictionary<string, string>() { { "partassemblyname", "+" } };
|
||||
|
||||
|
||||
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
@@ -66,10 +49,6 @@ namespace AyaNova.DataList
|
||||
SqlValueColumnName = "apartassembly.tags"
|
||||
});
|
||||
|
||||
|
||||
|
||||
//-----------
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "PartAssemblyCustom1", FieldKey = "partassemblycustom1", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apartassembly.customfields" });
|
||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "PartAssemblyCustom2", FieldKey = "partassemblycustom2", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apartassembly.customfields" });
|
||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "PartAssemblyCustom3", FieldKey = "partassemblycustom3", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apartassembly.customfields" });
|
||||
|
||||
@@ -7,48 +7,14 @@ namespace AyaNova.DataList
|
||||
public PartDataList()
|
||||
{
|
||||
DefaultListObjectType = AyaType.Part;
|
||||
|
||||
SQLFrom = "from apart "
|
||||
+ "left join avendor as aman on (apart.manufacturerid=aman.id) "
|
||||
+ "left join avendor as awhole on (apart.wholesalerid=awhole.id) "
|
||||
+ "left join avendor as aaltwhole on (apart.alternativewholesalerid=aaltwhole.id)";
|
||||
|
||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
|
||||
// //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
||||
// //Default ListView
|
||||
// dynamic dlistView = new JArray();
|
||||
// dynamic cm = null;
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "PartPartNumber";
|
||||
// cm.sort = "+";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "PartName";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "PartManufacturerID";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "PartWholesalerID";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "Tags";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
||||
|
||||
DefaultColumns = new List<string>() { "PartPartNumber", "PartName", "PartManufacturerID", "PartWholesalerID", "Tags" };
|
||||
DefaultSortBy = new Dictionary<string, string>() { { "PartPartNumber", "+" } };
|
||||
|
||||
|
||||
//NOTE: Due to the join, all the sql id and name fields that can conflict with the joined table need to be specified completely
|
||||
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
@@ -70,7 +36,6 @@ namespace AyaNova.DataList
|
||||
SqlValueColumnName = "apart.name"
|
||||
});
|
||||
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "PartNotes",
|
||||
@@ -111,7 +76,6 @@ namespace AyaNova.DataList
|
||||
SqlValueColumnName = "apart.retail"
|
||||
});
|
||||
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
FieldKey = "PartManufacturerID",
|
||||
@@ -182,10 +146,6 @@ namespace AyaNova.DataList
|
||||
SqlValueColumnName = "apart.upc"
|
||||
});
|
||||
|
||||
|
||||
|
||||
//-----------
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "PartCustom1", FieldKey = "partcustom1", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apart.customfields" });
|
||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "PartCustom2", FieldKey = "partcustom2", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apart.customfields" });
|
||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "PartCustom3", FieldKey = "partcustom3", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apart.customfields" });
|
||||
|
||||
@@ -9,55 +9,16 @@ namespace AyaNova.DataList
|
||||
{
|
||||
public PartInventoryDataList()
|
||||
{
|
||||
|
||||
DefaultListObjectType = AyaType.PartInventory;
|
||||
SQLFrom = "from vpartinventorynow "
|
||||
+ "left join apart on (vpartinventorynow.partid=apart.id) "
|
||||
+ "left join apartwarehouse on (vpartinventorynow.partwarehouseid=apartwarehouse.id) ";
|
||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
|
||||
// //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
||||
// //Default ListView - show all transactions in order
|
||||
// dynamic dlistView = new JArray();
|
||||
// dynamic cm = null;
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "PartPartNumber";
|
||||
// cm.sort = "+";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "PartWarehouseName";
|
||||
// cm.sort = "+";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "PartInventoryBalance";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// // cm = new JObject();
|
||||
// // cm.fld = "PartInventoryTransactionDescription";
|
||||
// // dlistView.Add(cm);
|
||||
|
||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
||||
|
||||
DefaultColumns = new List<string>() { "PartPartNumber", "PartWarehouseName", "PartInventoryBalance", "PartInventoryTransactionDescription" };
|
||||
DefaultSortBy = new Dictionary<string, string>() { { "PartPartNumber", "+" }, { "PartWarehouseName", "+" } };
|
||||
|
||||
|
||||
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||
|
||||
// FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||
// {
|
||||
// TKey = "PartInventoryTransactionSource",
|
||||
// FieldKey = "PartInventoryTransactionSource",
|
||||
// UiFieldDataType = (int)UiFieldDataType.Text,
|
||||
// SqlIdColumnName = "vpartinventorynow.sourceid",
|
||||
// SqlValueColumnName = "AYGETNAME(vpartinventorynow.sourceid, vpartinventorynow.sourcetype)",
|
||||
// SqlAyTypeColumnName = "vpartinventorynow.sourcetype"
|
||||
// });
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "PartPartNumber",
|
||||
@@ -90,22 +51,6 @@ namespace AyaNova.DataList
|
||||
IsRowId = true
|
||||
});
|
||||
|
||||
// FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||
// {
|
||||
// TKey = "PartInventoryTransactionEntryDate",
|
||||
// FieldKey = "PartInventoryTransactionEntryDate",
|
||||
// UiFieldDataType = (int)UiFieldDataType.DateTime,
|
||||
// SqlValueColumnName = "vpartinventorynow.entrydate"
|
||||
// });
|
||||
|
||||
// FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||
// {
|
||||
// TKey = "PartInventoryTransactionQuantity",
|
||||
// FieldKey = "PartInventoryTransactionQuantity",
|
||||
// UiFieldDataType = (int)UiFieldDataType.Decimal,
|
||||
// SqlValueColumnName = "vpartinventorynow.quantity"
|
||||
// });
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "PartInventoryBalance",
|
||||
@@ -114,7 +59,6 @@ namespace AyaNova.DataList
|
||||
SqlValueColumnName = "vpartinventorynow.balance"
|
||||
});
|
||||
|
||||
|
||||
//META
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
|
||||
@@ -9,57 +9,17 @@ namespace AyaNova.DataList
|
||||
{
|
||||
public PartInventoryTransactionsDataList()
|
||||
{
|
||||
|
||||
DefaultListObjectType = AyaType.PartInventory;
|
||||
SQLFrom = "from apartinventory "
|
||||
+ "left join apart on (apartinventory.partid=apart.id) "
|
||||
+ "left join apartwarehouse on (apartinventory.partwarehouseid=apartwarehouse.id) ";
|
||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
|
||||
// //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
||||
// //Default ListView - show all transactions in order
|
||||
// dynamic dlistView = new JArray();
|
||||
// dynamic cm = null;
|
||||
// cm = new JObject();
|
||||
|
||||
// cm.fld = "PartInventoryTransactionEntryDate";
|
||||
// cm.sort = "-";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "PartPartNumber";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "PartWarehouseName";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "PartInventoryTransactionQuantity";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "PartInventoryTransactionDescription";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "PartInventoryTransactionSource";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "PartInventoryBalance";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
||||
|
||||
DefaultColumns = new List<string>() {
|
||||
"PartInventoryTransactionEntryDate", "PartPartNumber", "PartWarehouseName", "PartInventoryTransactionQuantity",
|
||||
"PartInventoryTransactionDescription", "PartInventoryTransactionSource", "PartInventoryBalance"
|
||||
};
|
||||
DefaultSortBy = new Dictionary<string, string>() { { "PartInventoryTransactionEntryDate", "-" } };
|
||||
|
||||
|
||||
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
@@ -147,10 +107,9 @@ namespace AyaNova.DataList
|
||||
SqlValueColumnName = "apartwarehouse.name",
|
||||
IsMeta = true
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, string clientCriteria)
|
||||
{
|
||||
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
||||
|
||||
@@ -10,31 +10,8 @@ namespace AyaNova.DataList
|
||||
SQLFrom = "from apartwarehouse";
|
||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
|
||||
// //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
||||
// //Default ListView
|
||||
// dynamic dlistView = new JArray();
|
||||
// dynamic cm = null;
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "PartWarehouseName";
|
||||
// cm.sort = "+";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "Active";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "Tags";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
||||
|
||||
DefaultColumns = new List<string>() { "PartWarehouseName", "Active", "Tags" };
|
||||
DefaultSortBy = new Dictionary<string, string>() { { "PartWarehouseName", "+" } };
|
||||
|
||||
|
||||
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
@@ -72,10 +49,6 @@ namespace AyaNova.DataList
|
||||
SqlValueColumnName = "apartwarehouse.tags"
|
||||
});
|
||||
|
||||
|
||||
|
||||
//-----------
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "PartWarehouseCustom1", FieldKey = "partwarehousecustom1", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apartwarehouse.customfields" });
|
||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "PartWarehouseCustom2", FieldKey = "partwarehousecustom2", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apartwarehouse.customfields" });
|
||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "PartWarehouseCustom3", FieldKey = "partwarehousecustom3", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apartwarehouse.customfields" });
|
||||
|
||||
@@ -10,48 +10,9 @@ namespace AyaNova.DataList
|
||||
SQLFrom = "from aproject left join auser on (aproject.projectoverseerid=auser.id)";
|
||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
|
||||
// //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
||||
// //Default ListView
|
||||
// dynamic dlistView = new JArray();
|
||||
// dynamic cm = null;
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "projectname";
|
||||
// cm.sort = "+";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "ProjectProjectOverseerID";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "ProjectDateStarted";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "ProjectDateCompleted";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "ProjectAccountNumber";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "projectactive";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "projecttags";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
||||
|
||||
|
||||
DefaultColumns = new List<string>() { "projectname", "ProjectProjectOverseerID", "ProjectDateStarted", "ProjectDateCompleted",
|
||||
"ProjectAccountNumber", "projectactive", "projecttags" };
|
||||
DefaultSortBy = new Dictionary<string, string>() { { "projectname", "+" } };
|
||||
|
||||
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
@@ -89,9 +50,6 @@ namespace AyaNova.DataList
|
||||
SqlValueColumnName = "aproject.tags"
|
||||
});
|
||||
|
||||
|
||||
//------------
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "ProjectAccountNumber",
|
||||
@@ -125,7 +83,6 @@ namespace AyaNova.DataList
|
||||
UiFieldDataType = (int)UiFieldDataType.DateTime,
|
||||
SqlValueColumnName = "aproject.datecompleted"
|
||||
});
|
||||
//-----------
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "ProjectCustom1", FieldKey = "projectcustom1", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" });
|
||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "ProjectCustom2", FieldKey = "projectcustom2", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" });
|
||||
|
||||
@@ -7,39 +7,12 @@ namespace AyaNova.DataList
|
||||
{
|
||||
public ReminderDataList()
|
||||
{
|
||||
|
||||
DefaultListObjectType = AyaType.Reminder;
|
||||
SQLFrom = "from areminder";
|
||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
|
||||
|
||||
// //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
||||
|
||||
// dynamic dlistView = new JArray();
|
||||
|
||||
// dynamic cm = new JObject();
|
||||
// cm.fld = "ReminderName";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "ReminderNotes";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "ReminderStopDate";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "ReminderStartDate";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
||||
|
||||
DefaultColumns = new List<string>() { "ReminderName", "ReminderNotes", "ReminderStopDate", "ReminderStartDate" };
|
||||
DefaultSortBy = new Dictionary<string, string>() { { "ReminderStopDate", "-" } };
|
||||
|
||||
//NOTE: Due to the join, all the sql id and name fields that can conflict with the joined table need to be specified completely
|
||||
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
@@ -62,7 +35,6 @@ namespace AyaNova.DataList
|
||||
SqlValueColumnName = "areminder.notes"
|
||||
});
|
||||
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "ReminderStartDate",
|
||||
@@ -113,7 +85,6 @@ namespace AyaNova.DataList
|
||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "ReminderCustom14", FieldKey = "ReminderCustom14", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "areminder.customfields" });
|
||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "ReminderCustom15", FieldKey = "ReminderCustom15", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "areminder.customfields" });
|
||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "ReminderCustom16", FieldKey = "ReminderCustom16", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "areminder.customfields" });
|
||||
|
||||
}
|
||||
|
||||
//Ensure only current user can fetch their reminders
|
||||
|
||||
@@ -4,38 +4,16 @@ namespace AyaNova.DataList
|
||||
{
|
||||
internal class ReportDataList : DataListProcessingBase
|
||||
{
|
||||
|
||||
public ReportDataList()
|
||||
{
|
||||
DefaultListObjectType = AyaType.Report;
|
||||
SQLFrom = "from aReport";
|
||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
|
||||
// //Default ListView
|
||||
// dynamic dlistView = new JArray();
|
||||
|
||||
// dynamic cm = new JObject();
|
||||
// cm.fld = "name";
|
||||
// cm.sort = "+";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "objecttype";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "active";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
||||
|
||||
DefaultColumns = new List<string>() { "name", "objecttype", "active" };
|
||||
DefaultSortBy = new Dictionary<string, string>() { { "name", "+" } };
|
||||
|
||||
|
||||
|
||||
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "Report",
|
||||
@@ -47,7 +25,6 @@ namespace AyaNova.DataList
|
||||
IsRowId = true
|
||||
});
|
||||
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "AyaType",
|
||||
@@ -57,7 +34,6 @@ namespace AyaNova.DataList
|
||||
SqlValueColumnName = "areport.ObjectType"
|
||||
});
|
||||
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "Active",
|
||||
@@ -66,8 +42,6 @@ namespace AyaNova.DataList
|
||||
SqlValueColumnName = "aReport.active"
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
}//eoc
|
||||
}//eons
|
||||
@@ -15,49 +15,10 @@ namespace AyaNova.DataList
|
||||
+ "left join auser uassby on (areview.assignedbyuserid=uassby.id)";
|
||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
|
||||
|
||||
// //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
||||
// //Default ListView
|
||||
// dynamic dlistView = new JArray();
|
||||
// dynamic cm = null;
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "ReviewCompletedDate";
|
||||
// cm.sort = "-";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "ReviewDueDate";
|
||||
// cm.sort = "+";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "ReviewName";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "Object";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "AyaType";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "ReviewNotes";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "ReviewUserId";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
||||
|
||||
DefaultColumns = new List<string>() { "ReviewCompletedDate", "ReviewDueDate", "ReviewName", "Object", "AyaType", "ReviewNotes", "ReviewUserId" };
|
||||
DefaultSortBy = new Dictionary<string, string>() { { "ReviewCompletedDate", "-" }, { "ReviewDueDate", "+" } };
|
||||
|
||||
//NOTE: Due to the join, all the sql id and name fields that can conflict with the joined table need to be specified completely
|
||||
|
||||
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
@@ -202,51 +163,8 @@ namespace AyaNova.DataList
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// string IAyaDataListServerCriteria.DataListServerCriteria(long currentUserId, AyaNova.Biz.AuthorizationRoles userRoles, DataListOptions dataListOptions)
|
||||
// {
|
||||
|
||||
// bool HasSupervisorRole =
|
||||
// userRoles.HasFlag(AuthorizationRoles.BizAdminFull) ||
|
||||
// userRoles.HasFlag(AuthorizationRoles.DispatchFull) ||
|
||||
// userRoles.HasFlag(AuthorizationRoles.InventoryFull) ||
|
||||
// userRoles.HasFlag(AuthorizationRoles.SalesFull) ||
|
||||
// userRoles.HasFlag(AuthorizationRoles.AccountingFull);
|
||||
// if (!HasSupervisorRole)
|
||||
// return "[{\"fld\":\"metareviewuser\",\"filter\":{\"items\":[{\"op\":\"=\",\"value\":" + currentUserId.ToString() + "}]}}]";
|
||||
// return "[]";//this means effectively don't process this at all
|
||||
// }
|
||||
|
||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, string clientCriteria)
|
||||
{
|
||||
//TODO: support this clientcriteria
|
||||
// if (vm.objectId && vm.objectId != 0 && vm.objectType) {
|
||||
// //REMOVE COMMENT BLOCK AFTER TESTING
|
||||
// // //pre-filter
|
||||
// // vm.metaView = JSON.stringify([
|
||||
// // {
|
||||
// // fld: "metareviewobjectid",
|
||||
// // filter: {
|
||||
// // items: [{ op: "=", value: vm.objectId }]
|
||||
// // }
|
||||
// // },
|
||||
// // {
|
||||
// // fld: "AyaType",
|
||||
// // filter: {
|
||||
// // items: [{ op: "=", value: vm.objectType }]
|
||||
// // }
|
||||
// // }
|
||||
// // ]);
|
||||
// // vm.name = await window.$gz.api.fetchBizObjectName(
|
||||
// // vm.objectType,
|
||||
// // vm.objectId
|
||||
// // );
|
||||
// //OBJECTID,AYATYPE
|
||||
// vm.clientCriteria = `${vm.objectId},${vm.objectType}`;
|
||||
// }
|
||||
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
||||
bool HasSupervisorRole =
|
||||
userRoles.HasFlag(AuthorizationRoles.BizAdminFull)
|
||||
|
||||
@@ -13,52 +13,6 @@ namespace AyaNova.DataList
|
||||
SQLFrom = "from aservicebank";
|
||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
|
||||
|
||||
// //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
||||
// //Default ListView
|
||||
// dynamic dlistView = new JArray();
|
||||
// dynamic cm = null;
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "ServiceBankCreated";
|
||||
// cm.sort = "-";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "Object";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "ServiceBankCurrency";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "ServiceBankCurrencyBalance";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "ServiceBankIncidents";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "ServiceBankIncidentsBalance";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "ServiceBankHours";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "ServiceBankHoursBalance";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// cm = new JObject();
|
||||
// cm.fld = "ServiceBankDescription";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
||||
|
||||
DefaultColumns = new List<string>() {
|
||||
"ServiceBankCreated", "Object", "ServiceBankCurrency", "ServiceBankCurrencyBalance", "ServiceBankIncidents",
|
||||
"ServiceBankIncidentsBalance", "ServiceBankHours", "ServiceBankHoursBalance", "ServiceBankDescription"
|
||||
@@ -66,7 +20,6 @@ namespace AyaNova.DataList
|
||||
DefaultSortBy = new Dictionary<string, string>() { { "ServiceBankCreated", "-" } };
|
||||
|
||||
|
||||
//NOTE: Due to the join, all the sql id and name fields that can conflict with the joined table need to be specified completely
|
||||
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace AyaNova.DataList
|
||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
|
||||
// //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
||||
//######## DEFAULT VIEW ############
|
||||
// //Default ListView
|
||||
// dynamic dlistView = new JArray();
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace AyaNova.DataList
|
||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
|
||||
// //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
||||
//######## DEFAULT VIEW ############
|
||||
// //Default ListView
|
||||
// dynamic dlistView = new JArray();
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace AyaNova.DataList
|
||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
|
||||
// //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
||||
//######## DEFAULT VIEW ############
|
||||
// //Default ListView
|
||||
// dynamic dlistView = new JArray();
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace AyaNova.DataList
|
||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
|
||||
// //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
||||
//######## DEFAULT VIEW ############
|
||||
// //Default ListView
|
||||
// dynamic dlistView = new JArray();
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace AyaNova.DataList
|
||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
|
||||
// //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
||||
//######## DEFAULT VIEW ############
|
||||
// //Default ListView
|
||||
// dynamic dlistView = new JArray();
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace AyaNova.DataList
|
||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
|
||||
// //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
||||
//######## DEFAULT VIEW ############
|
||||
// //Default ListView
|
||||
// dynamic dlistView = new JArray();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user