public object GetList([System.Web.Http.FromUri] DbManagerIndexSearchDTO indexSearchVM) { using (DBConnectionService dBConnectionService = new DBConnectionService()) { indexSearchVM.Update(dBConnectionService.GetList(indexSearchVM.IsAdvSearch ? indexSearchVM.AdvName : indexSearchVM.Name, indexSearchVM.IsAdvSearch ? indexSearchVM.AdvDataSource : string.Empty, string.Empty, indexSearchVM.GetPagingProperties).Select(c => new DBConnectionDTO(c)).ToList()); return(indexSearchVM); } }
public object GetAddEdit(Guid?ID = null, string VariableName = "", Guid?ProcessId = null, Guid?ApplicationPageId = null) { using (VariableService variableService = new VariableService()) { VariableDTO variable = null; if (ID.ToGuidObj() != Guid.Empty) { variable = new VariableDTO(variableService.GetInfo(ID.Value)); } else if (!string.IsNullOrWhiteSpace(VariableName)) { variable = new VariableDTO(variableService.GetInfo(ProcessId, ApplicationPageId, VariableName)); } if (variable == null) { variable = new VariableDTO(new sysBpmsVariable() { ProcessID = ProcessId, ApplicationPageID = ApplicationPageId }); } using (EntityDefService entityDefService = new EntityDefService()) { List <EntityPropertyModel> Properties = new List <EntityPropertyModel>(); var Entities = entityDefService.GetList(string.Empty, true); if (variable != null && variable.EntityDefID.HasValue) { Properties = entityDefService.GetInfo(variable.EntityDefID.Value).AllProperties; } else { Properties = new List <EntityPropertyModel>(); } variable.ListVariableDependencyDTO?.ForEach((item) => { if (item.ToVariableID.HasValue) { sysBpmsVariable getVar = variableService.GetInfo(item.ToVariableID.Value); if (getVar.EntityDefID.HasValue) { item.GetToVariableProperties = entityDefService.GetInfo(getVar.EntityDefID.Value).AllProperties; } } else { item.GetToVariableProperties = new List <EntityPropertyModel>(); } }); using (DBConnectionService dbConnectionService = new DBConnectionService()) return new { Model = variable, ListConnection = dbConnectionService.GetList("").Select(c => new DBConnectionDTO(c)).ToList(), ListTypes = EnumObjHelper.GetEnumList <sysBpmsVariable.e_VarTypeLU>().Select(c => new QueryModel(c.Key.ToString(), c.Value)), ListRelations = EnumObjHelper.GetEnumList <sysBpmsVariable.e_RelationTypeLU>().Where(c => variable.ProcessID.HasValue || c.Key != (int)sysBpmsVariable.e_RelationTypeLU.Local).Select(c => new QueryModel(c.Key.ToString(), c.Value)), ListEntities = Entities.Select(c => new { c.ID, Name = c.Name + $"({c.DisplayName})" }).ToList(), ListFilters = EnumObjHelper.GetEnumList <sysBpmsVariable.e_FilterTypeLU>().Select(c => new QueryModel(c.Key.ToString(), c.Value)), ListProperties = Properties, DependencyToVariables = variableService.GetList(base.ProcessId, base.ApplicationPageId, null, "", null, true).Where(c => c.ID != variable.ID).Select(c => new VariableDTO(c)).ToList() }; } } }