This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using AyaNova.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Linq;
|
||||
using AyaNova.Biz;
|
||||
namespace AyaNova.DataList
|
||||
{
|
||||
@@ -12,47 +9,52 @@ namespace AyaNova.DataList
|
||||
{
|
||||
|
||||
DefaultListObjectType = AyaType.Review;
|
||||
SQLFrom = "from areview left join auser uassto on (areview.userid=uassto.id) left join auser uassby on (areview.assignedbyuserid=uassby.id)";
|
||||
SQLFrom = "from areview "
|
||||
+ "left join auser uassto on (areview.userid=uassto.id) "
|
||||
+ "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;
|
||||
// //######## 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 = "ReviewCompletedDate";
|
||||
// cm.sort = "-";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
cm = new JObject();
|
||||
cm.fld = "ReviewDueDate";
|
||||
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 = "ReviewName";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
cm = new JObject();
|
||||
cm.fld = "AyaType";
|
||||
dlistView.Add(cm);
|
||||
// cm = new JObject();
|
||||
// cm.fld = "Object";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
cm = new JObject();
|
||||
cm.fld = "ReviewNotes";
|
||||
dlistView.Add(cm);
|
||||
// cm = new JObject();
|
||||
// cm.fld = "AyaType";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
cm = new JObject();
|
||||
cm.fld = "ReviewUserId";
|
||||
dlistView.Add(cm);
|
||||
// cm = new JObject();
|
||||
// cm.fld = "ReviewNotes";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
||||
// 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<AyaDataListFieldDefinition>();
|
||||
@@ -189,19 +191,41 @@ namespace AyaNova.DataList
|
||||
|
||||
|
||||
|
||||
string IAyaDataListServerCriteria.DataListServerCriteria(long currentUserId, AyaNova.Biz.AuthorizationRoles userRoles, DataListOptions dataListOptions)
|
||||
// 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> DataListServerCriteria(long currentUserId, AuthorizationRoles userRoles, DataListBase dataListBase)
|
||||
{
|
||||
|
||||
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
||||
bool HasSupervisorRole =
|
||||
userRoles.HasFlag(AuthorizationRoles.BizAdminFull) ||
|
||||
userRoles.HasFlag(AuthorizationRoles.DispatchFull) ||
|
||||
userRoles.HasFlag(AuthorizationRoles.InventoryFull) ||
|
||||
userRoles.HasFlag(AuthorizationRoles.SalesFull) ||
|
||||
userRoles.HasFlag(AuthorizationRoles.AccountingFull);
|
||||
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
|
||||
{
|
||||
DataListFilterOption FilterOption = new DataListFilterOption() { Column = "metareviewuser" };
|
||||
FilterOption.items.Add(new DataListColumnFilter() { value = currentUserId.ToString(), op = DataListFilterComparisonOperator.Equality });
|
||||
|
||||
ret.Add(FilterOption);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
}//eoc
|
||||
}//eons
|
||||
Reference in New Issue
Block a user