public ActionResult GetPlistMyVisitingLogs(GetPlistMyVisitingLogs requestData) { if (!ModelState.IsValid) { return(ModelState.ToJsonResult()); } if (!AcSession.Identity.IsAuthenticated) { return(this.JsonResult(new MiniGrid <Dictionary <string, object> > { total = 0, data = new List <Dictionary <string, object> > { } })); } var visitingLogs = GetRequiredService <IVisitingLogQuery>().GetPlistVisitingLogTrs( AcSession.Account.Id, AcSession.Identity.Name, requestData.LeftVisitOn, requestData.RightVisitOn , requestData); Debug.Assert(requestData.Total != null, "requestData.total != null"); ViewModelHelper.FillVisitingLog(visitingLogs); var data = new MiniGrid <DicReader> { total = requestData.Total.Value, data = visitingLogs }; return(this.JsonResult(data)); }
public ActionResult GetPlistNodeActions(GetPlistNodeActions requestModel) { NodeDescriptor node; if (!AcDomain.NodeHost.Nodes.TryGetNodeById(requestModel.NodeId.ToString(), out node)) { throw new ValidationException("意外的节点标识" + requestModel.NodeId); } OntologyDescriptor ontology; if (!AcDomain.NodeHost.Ontologies.TryGetOntology(requestModel.OntologyId, out ontology)) { throw new ValidationException("意外的本体标识" + requestModel.OntologyId); } var list = new List <NodeAssignActionTr>(); foreach (var action in ontology.Actions.Values) { Guid id; string isAllowed; string isAudit; var nodeActions = node.Node.NodeActions; if (nodeActions.ContainsKey(ontology) && nodeActions[ontology].ContainsKey(action.ActionVerb)) { var nodeAction = nodeActions[ontology][action.ActionVerb]; id = nodeAction.Id; isAllowed = nodeAction.IsAllowed; isAudit = nodeAction.IsAudit; } else { id = Guid.NewGuid(); isAllowed = AllowType.ImplicitAllow.ToName(); isAudit = AuditType.ImplicitAudit.ToName(); } var item = new NodeAssignActionTr { ActionId = action.Id, ActionIsAllow = action.AllowType.ToName(), ActionIsAudit = action.AuditType.ToName(), ActionIsPersist = action.IsPersist, Id = id, Name = action.Name, NodeCode = node.Node.Code, NodeId = node.Node.Id, NodeName = node.Node.Name, OntologyId = action.OntologyId, OntologyName = ontology.Ontology.Name, Verb = action.Verb, IsAllowed = isAllowed, IsAudit = isAudit }; list.Add(item); } var data = new MiniGrid <NodeAssignActionTr> { total = list.Count, data = list }; return(this.JsonResult(data)); }
public ActionResult GetPlistPlugins(GetPlistResult requestModel) { if (!ModelState.IsValid) { return(ModelState.ToJsonResult()); } var dataDics = GetRequiredService <IPluginQuery>().GetPlist(base.EntityType, () => { RdbDescriptor rdb; if (!AcDomain.RdbSet.TryDb(base.EntityType.DatabaseId, out rdb)) { throw new GeneralException("意外配置的Plugin实体类型对象数据库标识" + base.EntityType.DatabaseId); } List <DbParameter> ps; var filterString = new SqlFilterStringBuilder().FilterString(rdb, requestModel.Filters, "a", out ps); if (!string.IsNullOrEmpty(filterString)) { filterString = " where " + filterString; } return(new SqlFilter(filterString, ps.ToArray())); }, requestModel); Debug.Assert(requestModel.Total != null, "requestModel.Total != null"); var data = new MiniGrid <Dictionary <string, object> > { total = requestModel.Total.Value, data = dataDics }; return(this.JsonResult(data)); }
public ActionResult GetPlistTopics(Guid?ontologyId) { if (!ontologyId.HasValue) { return(this.JsonResult(new MiniGrid <Topic> { total = 0, data = new List <Topic>() })); } OntologyDescriptor ontology; if (!AcDomain.NodeHost.Ontologies.TryGetOntology(ontologyId.Value, out ontology)) { throw new ValidationException("非法的本体标识" + ontologyId); } var models = ontology.Topics.Values.Select(a => new Topic(a.Id) { Code = a.Code, IsAllowed = a.IsAllowed, OntologyId = a.OntologyId, Name = a.Name, Description = a.Description }).ToList(); var data = new MiniGrid <Topic> { total = models.Count, data = models }; return(this.JsonResult(data)); }
public ActionResult GetPlist(GetPlistMessages requestModel) { if (!ModelState.IsValid) { return(ModelState.ToJsonResult()); } OntologyDescriptor ontology; if (!AcDomain.NodeHost.Ontologies.TryGetOntology(requestModel.OntologyCode, out ontology)) { throw new ValidationException("非法的本体码"); } MessageTypeKind commandTypeEnum; if (!requestModel.CommandType.TryParse(out commandTypeEnum)) { throw new ValidationException("非法的命令类型" + requestModel.CommandType); } long total; IList <MessageTr> list = null; switch (commandTypeEnum) { case MessageTypeKind.Invalid: throw new ValidationException("非法的命令类型"); case MessageTypeKind.AnyCommand: throw new ValidationException("AnyCommand不是实体命令类型"); case MessageTypeKind.Received: case MessageTypeKind.Unaccepted: case MessageTypeKind.Executed: case MessageTypeKind.ExecuteFailing: case MessageTypeKind.Distribute: case MessageTypeKind.Distributed: case MessageTypeKind.DistributeFailing: case MessageTypeKind.LocalEvent: case MessageTypeKind.ClientEvent: list = ontology.MessageProvider.GetPlistCommandTrs( commandTypeEnum, ontology, requestModel.CatalogCode, requestModel.ActionCode, requestModel.NodeId, requestModel.EntityId, requestModel.PageIndex, requestModel.PageSize, requestModel.SortField, requestModel.SortOrder, out total); break; default: throw new ValidationException("非法的命令类型" + requestModel.CommandType); } var data = new MiniGrid <MessageTr> { data = list, total = total }; return(this.JsonResult(data)); }
public ActionResult GetPlistVisitingLogs(GetPlistVisitingLogs requestData) { if (!ModelState.IsValid) { return ModelState.ToJsonResult(); } var visitingLogs = GetRequiredService<IVisitingLogQuery>().GetPlistVisitingLogTrs( requestData.Key, requestData.LeftVisitOn, requestData.RightVisitOn, requestData); Debug.Assert(requestData.Total != null, "requestData.total != null"); ViewModelHelper.FillVisitingLog(visitingLogs); var data = new MiniGrid<DicReader> { total = requestData.Total.Value, data = visitingLogs }; return this.JsonResult(data); }
public ActionResult GetElementActions(GetElementActions input) { ElementDescriptor element; if (!AcDomain.NodeHost.Ontologies.TryGetElement(input.ElementId, out element)) { throw new ValidationException("意外的本体元素标识" + input.ElementId); } var list = new List <ElementAssignActionTr>(); foreach (var action in element.Ontology.Actions.Values) { Guid id; string isAllowed; string isAudit; if (element.Element.ElementActions.ContainsKey(action.ActionVerb)) { var elementAction = element.Element.ElementActions[action.ActionVerb]; id = elementAction.Id; isAllowed = elementAction.IsAllowed; isAudit = elementAction.IsAudit; } else { id = Guid.NewGuid(); isAllowed = AllowType.ImplicitAllow.ToName(); isAudit = AuditType.ImplicitAudit.ToName(); } var elementAssignAction = new ElementAssignActionTr { ActionId = action.Id, ActionIsAllow = action.AllowType.ToName(), ElementCode = element.Element.Code, ElementId = element.Element.Id, ElementName = element.Element.Name, Id = id, IsAllowed = isAllowed, IsAudit = isAudit, Name = action.Name, OntologyId = action.OntologyId, Verb = action.Verb }; list.Add(elementAssignAction); } var data = new MiniGrid <ElementAssignActionTr> { total = list.Count, data = list }; return(this.JsonResult(data)); }
public ActionResult GetPlistExceptionLogs(GetPlistExceptionLogs requestData) { if (!ModelState.IsValid) { return(ModelState.ToJsonResult()); } var exceptionlogs = GetRequiredService <ILoggingService>().GetPlistExceptionLogs(requestData.Filters, requestData); Debug.Assert(requestData.Total != null, "requestData.total != null"); var data = new MiniGrid <ExceptionLog> { total = requestData.Total.Value, data = exceptionlogs }; return(this.JsonResult(data)); }
public ActionResult GetPlistAnyLogs(GetPlistAnyLogs requestModel) { if (!ModelState.IsValid) { return(ModelState.ToJsonResult()); } IList <IAnyLog> anyLogs = GetRequiredService <ILoggingService>().GetPlistAnyLogs(requestModel.Filters, requestModel); Debug.Assert(requestModel.Total != null, "requestModel.total != null"); var data = new MiniGrid <IAnyLog> { total = requestModel.Total.Value, data = anyLogs }; return(this.JsonResult(data)); }
public ActionResult GetPlistOperationLogs(GetPlistOperationLogs requestData) { if (!ModelState.IsValid) { return ModelState.ToJsonResult(); } var operationlogs = GetRequiredService<ILoggingService>().GetPlistOperationLogs( requestData.TargetId, requestData.LeftCreateOn, requestData.RightCreateOn, requestData.Filters, requestData); Debug.Assert(requestData.Total != null, "requestData.total != null"); var data = new MiniGrid<OperationLog> { data = operationlogs, total = requestData.Total.Value }; return this.JsonResult(data); }
public ActionResult GetPlistRoleAccounts(GetPlistRoleAccounts input) { if (!ModelState.IsValid) { return(ModelState.ToJsonResult()); } Debug.Assert(input.RoleId != null, "requestModel.RoleId != null"); var roleUserAccountTrs = GetRequiredService <IAccountQuery>().GetPlistRoleAccountTrs( input.Key, input.RoleId.Value, input); Debug.Assert(input.Total != null, "requestModel.total != null"); var data = new MiniGrid <Dictionary <string, object> > { total = input.Total.Value, data = roleUserAccountTrs }; return(this.JsonResult(data)); }
public ActionResult GetPlistVisitingLogs(GetPlistVisitingLogs requestData) { if (!ModelState.IsValid) { return(ModelState.ToJsonResult()); } var visitingLogs = GetRequiredService <IVisitingLogQuery>().GetPlistVisitingLogTrs( requestData.Key, requestData.LeftVisitOn, requestData.RightVisitOn, requestData); Debug.Assert(requestData.Total != null, "requestData.total != null"); ViewModelHelper.FillVisitingLog(visitingLogs); var data = new MiniGrid <DicReader> { total = requestData.Total.Value, data = visitingLogs }; return(this.JsonResult(data)); }
public ActionResult GetPlistMyVisitingLogs(GetPlistMyVisitingLogs requestData) { if (!ModelState.IsValid) { return ModelState.ToJsonResult(); } if (!AcSession.Identity.IsAuthenticated) { return this.JsonResult(new MiniGrid<Dictionary<string, object>> { total = 0, data = new List<Dictionary<string, object>> { } }); } var visitingLogs = GetRequiredService<IVisitingLogQuery>().GetPlistVisitingLogTrs( AcSession.Account.Id, AcSession.Identity.Name, requestData.LeftVisitOn, requestData.RightVisitOn , requestData); Debug.Assert(requestData.Total != null, "requestData.total != null"); ViewModelHelper.FillVisitingLog(visitingLogs); var data = new MiniGrid<DicReader> { total = requestData.Total.Value, data = visitingLogs }; return this.JsonResult(data); }
public ActionResult GetPlistAccounts(GetPlistAccounts input) { if (!ModelState.IsValid) { return(ModelState.ToJsonResult()); } foreach (var filter in input.Filters) { PropertyState property; if (!AcDomain.EntityTypeSet.TryGetProperty(base.EntityType, filter.field, out property)) { throw new ValidationException("意外的Account实体类型属性" + filter.field); } } input.IncludeDescendants = input.IncludeDescendants ?? false; List <DicReader> userAccountTrs = null; // 如果组织机构为空则需要检测是否是开发人员,因为只有开发人员才可以看到全部用户。目录为空表示查询全部目录。 if (string.IsNullOrEmpty(input.CatalogCode)) { if (!AcSession.IsDeveloper()) { throw new ValidationException("对不起,您没有查看全部账户的权限"); } else { userAccountTrs = GetRequiredService <IAccountQuery>().GetPlistAccountTrs(input.Filters, input.CatalogCode , input.IncludeDescendants.Value, input); } } else { userAccountTrs = GetRequiredService <IAccountQuery>().GetPlistAccountTrs(input.Filters, input.CatalogCode , input.IncludeDescendants.Value, input); } Debug.Assert(input.Total != null, "requestModel.total != null"); var data = new MiniGrid <Dictionary <string, object> > { total = input.Total.Value, data = userAccountTrs }; return(this.JsonResult(data)); }
public ActionResult GetPlistOperationLogs(GetPlistOperationLogs requestData) { if (!ModelState.IsValid) { return(ModelState.ToJsonResult()); } var operationlogs = GetRequiredService <ILoggingService>().GetPlistOperationLogs( requestData.TargetId, requestData.LeftCreateOn, requestData.RightCreateOn, requestData.Filters, requestData); Debug.Assert(requestData.Total != null, "requestData.total != null"); var data = new MiniGrid <OperationLog> { data = operationlogs, total = requestData.Total.Value }; return(this.JsonResult(data)); }
public ActionResult GetPlistElementInfoRules(GetPlistElementInfoRules requestModel) { ElementDescriptor element; if (!AcDomain.NodeHost.Ontologies.TryGetElement(requestModel.ElementId, out element)) { throw new ValidationException("意外的本体元素标识" + requestModel.ElementId); } var list = new List <ElementInfoRuleTr>(); foreach (var item in element.Element.ElementInfoRules) { InfoRuleState infoRule; if (AcDomain.NodeHost.InfoRules.TryGetInfoRule(item.InfoRuleId, out infoRule)) { list.Add(new ElementInfoRuleTr { InfoRuleId = infoRule.Id, AuthorCode = infoRule.InfoRule.Author, CreateOn = item.CreateOn, ElementId = element.Element.Id, FullName = infoRule.GetType().Name, Id = item.Id, Name = infoRule.InfoRule.Name, Title = infoRule.InfoRule.Title, SortCode = item.SortCode, IsEnabled = item.IsEnabled }); } } var data = new MiniGrid <ElementInfoRuleTr> { total = list.Count, data = list }; return(this.JsonResult(data)); }
public ActionResult GetPlistElementInfoRules(GetPlistElementInfoRules requestModel) { ElementDescriptor element; if (!AcDomain.NodeHost.Ontologies.TryGetElement(requestModel.ElementId, out element)) { throw new ValidationException("意外的本体元素标识" + requestModel.ElementId); } var list = new List<ElementInfoRuleTr>(); foreach (var item in element.Element.ElementInfoRules) { InfoRuleState infoRule; if (AcDomain.NodeHost.InfoRules.TryGetInfoRule(item.InfoRuleId, out infoRule)) { list.Add(new ElementInfoRuleTr { InfoRuleId = infoRule.Id, AuthorCode = infoRule.InfoRule.Author, CreateOn = item.CreateOn, ElementId = element.Element.Id, FullName = infoRule.GetType().Name, Id = item.Id, Name = infoRule.InfoRule.Name, Title = infoRule.InfoRule.Title, SortCode = item.SortCode, IsEnabled = item.IsEnabled }); } } var data = new MiniGrid<ElementInfoRuleTr> { total = list.Count, data = list }; return this.JsonResult(data); }
public ActionResult GetPlistExceptionLogs(GetPlistExceptionLogs requestData) { if (!ModelState.IsValid) { return ModelState.ToJsonResult(); } var exceptionlogs = GetRequiredService<ILoggingService>().GetPlistExceptionLogs(requestData.Filters, requestData); Debug.Assert(requestData.Total != null, "requestData.total != null"); var data = new MiniGrid<ExceptionLog> { total = requestData.Total.Value, data = exceptionlogs }; return this.JsonResult(data); }
public ActionResult GetPlistAnyLogs(GetPlistAnyLogs requestModel) { if (!ModelState.IsValid) { return ModelState.ToJsonResult(); } IList<IAnyLog> anyLogs = GetRequiredService<ILoggingService>().GetPlistAnyLogs(requestModel.Filters, requestModel); Debug.Assert(requestModel.Total != null, "requestModel.total != null"); var data = new MiniGrid<IAnyLog> { total = requestModel.Total.Value, data = anyLogs }; return this.JsonResult(data); }
public ActionResult GetPlist(GetPlistMessages requestModel) { if (!ModelState.IsValid) { return ModelState.ToJsonResult(); } OntologyDescriptor ontology; if (!AcDomain.NodeHost.Ontologies.TryGetOntology(requestModel.OntologyCode, out ontology)) { throw new ValidationException("非法的本体码"); } MessageTypeKind commandTypeEnum; if (!requestModel.CommandType.TryParse(out commandTypeEnum)) { throw new ValidationException("非法的命令类型" + requestModel.CommandType); } long total; IList<MessageTr> list = null; switch (commandTypeEnum) { case MessageTypeKind.Invalid: throw new ValidationException("非法的命令类型"); case MessageTypeKind.AnyCommand: throw new ValidationException("AnyCommand不是实体命令类型"); case MessageTypeKind.Received: case MessageTypeKind.Unaccepted: case MessageTypeKind.Executed: case MessageTypeKind.ExecuteFailing: case MessageTypeKind.Distribute: case MessageTypeKind.Distributed: case MessageTypeKind.DistributeFailing: case MessageTypeKind.LocalEvent: case MessageTypeKind.ClientEvent: list = ontology.MessageProvider.GetPlistCommandTrs( commandTypeEnum, ontology, requestModel.CatalogCode, requestModel.ActionCode, requestModel.NodeId, requestModel.EntityId, requestModel.PageIndex, requestModel.PageSize, requestModel.SortField, requestModel.SortOrder, out total); break; default: throw new ValidationException("非法的命令类型" + requestModel.CommandType); } var data = new MiniGrid<MessageTr> { data = list, total = total }; return this.JsonResult(data); }
public ActionResult GetElementActions(GetElementActions input) { ElementDescriptor element; if (!AcDomain.NodeHost.Ontologies.TryGetElement(input.ElementId, out element)) { throw new ValidationException("意外的本体元素标识" + input.ElementId); } var list = new List<ElementAssignActionTr>(); foreach (var action in element.Ontology.Actions.Values) { Guid id; string isAllowed; string isAudit; if (element.Element.ElementActions.ContainsKey(action.ActionVerb)) { var elementAction = element.Element.ElementActions[action.ActionVerb]; id = elementAction.Id; isAllowed = elementAction.IsAllowed; isAudit = elementAction.IsAudit; } else { id = Guid.NewGuid(); isAllowed = AllowType.ImplicitAllow.ToName(); isAudit = AuditType.ImplicitAudit.ToName(); } var elementAssignAction = new ElementAssignActionTr { ActionId = action.Id, ActionIsAllow = action.AllowType.ToName(), ElementCode = element.Element.Code, ElementId = element.Element.Id, ElementName = element.Element.Name, Id = id, IsAllowed = isAllowed, IsAudit = isAudit, Name = action.Name, OntologyId = action.OntologyId, Verb = action.Verb }; list.Add(elementAssignAction); } var data = new MiniGrid<ElementAssignActionTr> { total = list.Count, data = list }; return this.JsonResult(data); }
public ActionResult GetPlistNodeActions(GetPlistNodeActions requestModel) { NodeDescriptor node; if (!AcDomain.NodeHost.Nodes.TryGetNodeById(requestModel.NodeId.ToString(), out node)) { throw new ValidationException("意外的节点标识" + requestModel.NodeId); } OntologyDescriptor ontology; if (!AcDomain.NodeHost.Ontologies.TryGetOntology(requestModel.OntologyId, out ontology)) { throw new ValidationException("意外的本体标识" + requestModel.OntologyId); } var list = new List<NodeAssignActionTr>(); foreach (var action in ontology.Actions.Values) { Guid id; string isAllowed; string isAudit; var nodeActions = node.Node.NodeActions; if (nodeActions.ContainsKey(ontology) && nodeActions[ontology].ContainsKey(action.ActionVerb)) { var nodeAction = nodeActions[ontology][action.ActionVerb]; id = nodeAction.Id; isAllowed = nodeAction.IsAllowed; isAudit = nodeAction.IsAudit; } else { id = Guid.NewGuid(); isAllowed = AllowType.ImplicitAllow.ToName(); isAudit = AuditType.ImplicitAudit.ToName(); } var item = new NodeAssignActionTr { ActionId = action.Id, ActionIsAllow = action.AllowType.ToName(), ActionIsAudit = action.AuditType.ToName(), ActionIsPersist = action.IsPersist, Id = id, Name = action.Name, NodeCode = node.Node.Code, NodeId = node.Node.Id, NodeName = node.Node.Name, OntologyId = action.OntologyId, OntologyName = ontology.Ontology.Name, Verb = action.Verb, IsAllowed = isAllowed, IsAudit = isAudit }; list.Add(item); } var data = new MiniGrid<NodeAssignActionTr> { total = list.Count, data = list }; return this.JsonResult(data); }
public ActionResult GetPlistStateCodes(GetPlistStateCodes requestModel) { if (!ModelState.IsValid) { return ModelState.ToJsonResult(); } var dataDics = GetRequiredService<IStateCodeQuery>().GetPlist(base.EntityType, () => { RdbDescriptor rdb; if (!AcDomain.Rdbs.TryDb(base.EntityType.DatabaseId, out rdb)) { throw new AnycmdException("意外配置的StateCode实体类型对象数据库标识" + base.EntityType.DatabaseId); } List<DbParameter> ps; var filterString = new SqlFilterStringBuilder().FilterString(rdb, requestModel.Filters, "a", out ps); if (!string.IsNullOrEmpty(filterString)) { filterString = " where " + filterString; } return new SqlFilter(filterString, ps.ToArray()); }, requestModel); Debug.Assert(requestModel.Total != null, "requestModel.Total != null"); var data = new MiniGrid<Dictionary<string, object>> { total = requestModel.Total.Value, data = dataDics }; return this.JsonResult(data); }
public ActionResult GetPlistRoleAccounts(GetPlistRoleAccounts input) { if (!ModelState.IsValid) { return ModelState.ToJsonResult(); } Debug.Assert(input.RoleId != null, "requestModel.RoleId != null"); var roleUserAccountTrs = GetRequiredService<IAccountQuery>().GetPlistRoleAccountTrs( input.Key, input.RoleId.Value, input); Debug.Assert(input.Total != null, "requestModel.total != null"); var data = new MiniGrid<Dictionary<string, object>> { total = input.Total.Value, data = roleUserAccountTrs }; return this.JsonResult(data); }
public ActionResult GetPlistAccounts(GetPlistAccounts input) { if (!ModelState.IsValid) { return ModelState.ToJsonResult(); } foreach (var filter in input.Filters) { PropertyState property; if (!AcDomain.EntityTypeSet.TryGetProperty(base.EntityType, filter.field, out property)) { throw new ValidationException("意外的Account实体类型属性" + filter.field); } } input.IncludeDescendants = input.IncludeDescendants ?? false; List<DicReader> userAccountTrs = null; // 如果组织机构为空则需要检测是否是开发人员,因为只有开发人员才可以看到全部用户。目录为空表示查询全部目录。 if (string.IsNullOrEmpty(input.CatalogCode)) { if (!AcSession.IsDeveloper()) { throw new ValidationException("对不起,您没有查看全部账户的权限"); } else { userAccountTrs = GetRequiredService<IAccountQuery>().GetPlistAccountTrs(input.Filters, input.CatalogCode , input.IncludeDescendants.Value, input); } } else { userAccountTrs = GetRequiredService<IAccountQuery>().GetPlistAccountTrs(input.Filters, input.CatalogCode , input.IncludeDescendants.Value, input); } Debug.Assert(input.Total != null, "requestModel.total != null"); var data = new MiniGrid<Dictionary<string, object>> { total = input.Total.Value, data = userAccountTrs }; return this.JsonResult(data); }