public object PostLoadSqlFunctionForm(PostLoadSqlFunctionFormDTO model)
        {
            Guid?dynamicFormId            = model.DynamicFormId.ToGuidObjNull();
            DCSqlFunctionModel designCode = null;

            if (!string.IsNullOrWhiteSpace(model.XmlB64Model))
            {
                designCode = DesignCodeUtility.GetObjectOfDesignCode <DCSqlFunctionModel>(model.XmlB64Model.ToStringObj().FromBase64());

                designCode.IsOutputYes = model.IsOutputYes;
            }
            else
            {
                designCode = new DCSqlFunctionModel(Guid.NewGuid().ToString(), "Sql Query", string.Empty, string.Empty
                                                    , model.ShapeId.ToStringObj(), model.ParentShapeId.ToStringObj(),
                                                    model.IsOutputYes, null, model.IsFirst.ToBoolObj(), string.Empty);
            }

            using (DynamicFormService dynamicFormService = new DynamicFormService())
                return new
                       {
                           ListMethodTypes = EnumObjHelper.GetEnumList <DCSqlFunctionModel.e_MethodType>().Select(c => new QueryModel(c.Key.ToString(), c.Value)).ToList(),
                           DynamicFormId   = dynamicFormId,
                           ProcessControls = dynamicFormId != Guid.Empty && dynamicFormId.HasValue ?
                                             dynamicFormService.GetControls(dynamicFormService.GetInfo(dynamicFormId.Value)).Select(c => new QueryModel(c.Key, c.Value)).ToList() : new List <QueryModel>(),
                           Model = designCode
                       };
        }
        public object PostLoadConditionForm(PostLoadConditionFormDTO model)
        {
            Guid?            dynamicFormId = model.DynamicFormId.ToGuidObjNull();
            DCConditionModel designCode;

            if (!string.IsNullOrWhiteSpace(model.Data))
            {
                designCode = DesignCodeUtility.GetObjectOfDesignCode <DCConditionModel>(model.Data.ToStringObj().FromBase64());

                designCode.IsOutputYes = model.IsOutputYes.ToBoolObjNull();
                if (string.IsNullOrWhiteSpace(designCode.FuncName))
                {
                    designCode.FuncName = DesignCodeUtility.GetFunctionName(designCode.ShapeID);
                }
            }
            else
            {
                designCode = new DCConditionModel(Guid.NewGuid().ToString(), model.Name.ToStringObj(),
                                                  model.ShapeId.ToStringObj(), model.ParentShapeId.ToStringObj(),
                                                  model.IsOutputYes.ToBoolObjNull(), new List <DCRowConditionModel>(), model.IsFirst.ToBoolObj(), null);
            }

            using (VariableService variableService = new VariableService())
                using (DynamicFormService dynamicFormService = new DynamicFormService())
                    return new
                           {
                               ProcessControls = dynamicFormId != Guid.Empty && dynamicFormId.HasValue ?
                                                 dynamicFormService.GetControls(dynamicFormService.GetInfo(dynamicFormId.Value)).Select(c => new QueryModel(c.Key, c.Value)).ToList() : new List <QueryModel>(),
                               ListOperationTypes = EnumObjHelper.GetEnumList <DCRowConditionModel.e_OperationType>().Select(c => new QueryModel(c.Key.ToString(), c.Value)).ToList(),
                               Model = designCode
                           };
        }
Exemple #3
0
 public object GetEditInfo(Guid ID)
 {
     using (ProcessService processService = new ProcessService())
     {
         ProcessDTO model = new ProcessDTO(processService.GetInfo(ID));
         model.ListTypes = EnumObjHelper.GetEnumList <sysBpmsProcess.e_TypeLU>().Select(c => new QueryModel(c.Key.ToString(), c.Value)).ToList();
         return(model);
     }
 }
Exemple #4
0
 public object GetAdd(Guid ProcessGroupID)
 {
     return(new ProcessDTO()
     {
         TypeLU = (int)sysBpmsProcess.e_TypeLU.General,
         StatusLU = (int)sysBpmsProcess.Enum_StatusLU.Draft,
         ProcessGroupID = ProcessGroupID,
         ListTypes = EnumObjHelper.GetEnumList <sysBpmsProcess.e_TypeLU>().Select(c => new QueryModel(c.Key.ToString(), c.Value)).ToList()
     });
 }
 public object GetAddEdit(Guid?ID = null)
 {
     using (EntityDefService entityDefService = new EntityDefService())
     {
         EntityDefDTO            entityDef = new EntityDefDTO(ID.HasValue ? entityDefService.GetInfo(ID.Value) : null);
         List <sysBpmsEntityDef> AllPublishedEntityDefs = entityDefService.GetList(string.Empty, true);
         return(Json(new
         {
             Model = entityDef,
             DbTypes = EnumObjHelper.GetEnumList <EntityPropertyModel.e_dbType>().Where(c => c.Key != (int)EntityPropertyModel.e_dbType.Entity).Select(c => new QueryModel(c.Key.ToString(), c.Value)).
                       Union(AllPublishedEntityDefs.Select(c => new QueryModel((int)EntityPropertyModel.e_dbType.Entity + ":" + c.ID.ToString(), c.Name))).ToList(),
             RelationProperties = entityDef.AllProperties
         }));
     }
 }
Exemple #6
0
        // GET: BpmsEvent
        public object GetIndex(Guid ProcessId, string ElementId)
        {
            EventDTO eventDTO = null;

            using (EventService eventService = new EventService())
            {
                eventDTO = new EventDTO(eventService.GetInfo(ElementId, ProcessId));
            }
            //Filling Default Message ViewBag
            using (MessageTypeService messageTypeService = new MessageTypeService())
            {
                if (eventDTO.SubTypeMessageEventModel?.Type == (int)SubTypeMessageEventModel.e_Type.Message &&
                    eventDTO.MessageTypeID.HasValue)
                {
                    //If messageType was changed, it adds or removes extra params.
                    List <MessageTypeParamsModel> listMTParams = messageTypeService.GetInfo(eventDTO.MessageTypeID.Value).ParamsXmlModel;

                    //update list of parameter
                    eventDTO.SubTypeMessageEventModel.MessageParams = listMTParams.Select(c =>
                                                                                          new SubTypeMessageParamEventModel(eventDTO.SubTypeMessageEventModel.MessageParams.FirstOrDefault(d => d.Name == c.Name)?.Variable, c.Name, c.IsRequired)).ToList();
                }

                using (EmailAccountService emailAccountService = new EmailAccountService())
                {
                    List <QueryModel> list = new List <QueryModel>()
                    {
                        new QueryModel(((int)SubTypeEmailEventModel.e_FromType.CurrentUser).ToString(), "Current User"),
                        new QueryModel(((int)SubTypeEmailEventModel.e_FromType.CurrentThreadUser).ToString(), "Requested User")
                    };
                    return(new
                    {
                        SubTypeTimerEventModelIntervalTypes = EnumObjHelper.GetEnumList <SubTypeTimerEventModel.e_IntervalType>().Select(c => new QueryModel(c.Key.ToString(), c.Value)).ToList(),
                        SubTypeTimerEventModelSetTypes = EnumObjHelper.GetEnumList <SubTypeTimerEventModel.e_SetType>().Select(c => new QueryModel(c.Key.ToString(), c.Value)).ToList(),
                        SubTypeTimerEventModelTypes = EnumObjHelper.GetEnumList <SubTypeTimerEventModel.e_Type>().Where(c => eventDTO.TypeLU == (int)sysBpmsEvent.e_TypeLU.StartEvent || eventDTO.TypeLU == (int)sysBpmsEvent.e_TypeLU.boundary || c.Key != (int)SubTypeTimerEventModel.e_Type.Interval).Select(c => new QueryModel(c.Key.ToString(), c.Value)).ToList(),
                        SubTypeEmailEventModelToSystemicTypes = EnumObjHelper.GetEnumList <SubTypeEmailEventModel.e_ToSystemicType>().Select(c => new QueryModel(c.Key.ToString(), c.Value)).ToList(),
                        SubTypeEmailEventModelToTypes = EnumObjHelper.GetEnumList <SubTypeEmailEventModel.e_ToType>().Select(c => new QueryModel(c.Key.ToString(), c.Value)).ToList(),
                        SubTypeMessageEventModelKeyTypes = EnumObjHelper.GetEnumList <SubTypeMessageEventModel.e_KeyType>().Select(c => new QueryModel(c.Key.ToString(), c.Value)).ToList(),
                        SubTypeMessageEventModelTypes = EnumObjHelper.GetEnumList <SubTypeMessageEventModel.e_Type>().Select(c => new QueryModel(c.Key.ToString(), c.Value)).ToList(),
                        //eventDTO.MessageTypeID
                        MessageTypes = messageTypeService.GetList("", true).Select(c => new QueryModel(c.ID.ToString(), c.Name)).ToList(),
                        //eventDTO.SubTypeMessageEventModel?.Email?.From
                        EmailAccounts = emailAccountService.GetList((int)sysBpmsEmailAccount.e_ObjectTypeLU.Systemic, null, null).
                                        Select(c => new QueryModel(c.ID.ToString(), c.Email)).Union(list).ToList(),
                        Model = eventDTO,
                    });
                }
            }
        }
 public object PostLoadDesignCodeActionList(PostLoadDesignCodeActionListDTO model)
 {
     return(new
     {
         ListActionTypes = EnumObjHelper.GetEnumList <DCBaseModel.e_ActionType>().Select(c => new QueryModel(c.Key.ToString(), c.Value)).ToList(),
         model.ShapeId,
         DynamicFormId = model.DynamicFormId.ToGuidObjNull(),
         model.ParentShapeId,
         model.IsOutputYes,
         Name = model.Name.ToStringObj().Trim(),
         model.IsFirst,
         Base64Code = model.Action.ToStringObj(),
         FuncName = DesignCodeUtility.GetFunctionName(model.ShapeId),
         Model = DesignCodeUtility.GetObjectOfDesignCode <object>(model.Action.ToStringObj().FromBase64()),
     });
 }
        public object PostIndex(PostDesignCodePostIndexDTO requestModel)
        {
            Guid?           dynamicFormId = requestModel.DynamicFormId.ToGuidObjNull();
            DesignCodeModel codeModel     = DesignCodeUtility.GetDesignCodeFromXml(requestModel.DesignCode.ToStringObj());
            DesignCodeDTO   model         = new DesignCodeDTO()
            {
                Code          = codeModel?.Code,
                CodeType      = (DesignCodeDTO.e_CodeType)requestModel.CodeType,
                CallBack      = requestModel.CallBack.ToStringObj(),
                Assemblies    = codeModel?.Assemblies,
                ID            = string.IsNullOrWhiteSpace(codeModel.ID) ? Guid.NewGuid().ToString() : codeModel.ID,
                CodeObjects   = codeModel.CodeObjects,
                DynamicFormID = dynamicFormId,
                DesignCode    = codeModel.DesignCode,
                Diagram       = codeModel.Diagram.ToStringObj().Trim(),
            };

            if (model.CodeType == DesignCodeDTO.e_CodeType.ConditionCode)
            {
                Random           random           = new Random();
                DCConditionModel dcConditionModel = (DCConditionModel)model.CodeObjects?.FirstOrDefault() ??
                                                    new DCConditionModel(Guid.NewGuid().ToString(), "Condition", string.Empty, string.Empty, null, new List <DCRowConditionModel>(), true, "func" + random.Next(100, 100));
                using (VariableService variableService = new VariableService())
                    using (DynamicFormService dynamicFormService = new DynamicFormService())
                        return new
                               {
                                   OpenDirectly    = true,
                                   DesignCodeDTO   = model,
                                   ProcessControls = dynamicFormId != Guid.Empty && dynamicFormId.HasValue ?
                                                     dynamicFormService.GetControls(dynamicFormService.GetInfo(dynamicFormId.Value)).Select(c => new QueryModel(c.Key, c.Value)).ToList() : new List <QueryModel>(),
                                   ProcessVariables   = variableService.GetVariableAsComboTree(base.ProcessId, base.ApplicationPageId, null, "{0}"),
                                   ListOperationTypes = EnumObjHelper.GetEnumList <DCRowConditionModel.e_OperationType>().Select(c => new QueryModel(c.Key.ToString(), c.Value)).ToList(),
                                   Model = dcConditionModel
                               };
            }
            else
            {
                this.InitialData(model, dynamicFormId);
                return(model);
            }
        }
        public object GetIndex(string ElementId, Guid ProcessId)
        {
            using (TaskService taskService = new TaskService())
            {
                TaskDTO task = new TaskDTO(taskService.GetInfo(ElementId, ProcessId));

                using (DepartmentService departmentService = new DepartmentService())
                    using (UserService userService = new UserService())
                        //for access
                        using (LURowService luRowService = new LURowService())
                            using (DynamicFormService dynamicFormService = new DynamicFormService())
                                using (ProcessService processService = new ProcessService())
                                    using (StepService stepService = new StepService())
                                        return new
                                               {
                                                   ListSteps       = stepService.GetList(task.ID, null).Select(c => new StepDTO(c)).ToList(),
                                                   AllowEdit       = processService.GetInfo(ProcessId).AllowEdit(),
                                                   RoleAccessTypes = EnumObjHelper.GetEnumList <UserTaskRuleModel.e_RoleAccessType>().Select(c => new QueryModel(c.Key.ToString(), c.Value)).ToList(),
                                                   UserAccessTypes = EnumObjHelper.GetEnumList <UserTaskRuleModel.e_UserAccessType>().Select(c => new QueryModel(c.Key.ToString(), c.Value)).ToList(),
                                                   UserTypes       = EnumObjHelper.GetEnumList <UserTaskRuleModel.e_UserType>().Select(c => new QueryModel(c.Key.ToString(), c.Value)).ToList(),
                                                   Departments     = departmentService.GetList(true, "", null).Select(c => new QueryModel(c.ID.ToString(), c.Name)).ToList(),
                                                   Users           = userService.GetList("", null).Select(c => new QueryModel(c.ID.ToString(), c.FullName)).ToList(),
                                                   UsersJson       = (task.MarkerTypeLU.HasValue ? userService.GetList("", null) : new List <sysBpmsUser>()).Select(c => new ComboTreeModel()
                                            {
                                                id    = c.ID.ToString(),
                                                title = c.FullName
                                            }).ToList(),
                                                   OwnerTypes    = luRowService.GetList(sysBpmsLUTable.e_LUTable.LaneOwnerTypeLU.ToString()).Select(c => new QueryModel(c.CodeOf, c.NameOf)).ToList(),
                                                   RoleNames     = luRowService.GetList("DepartmentRoleLU").Select(c => new QueryModel(c.CodeOf, c.NameOf)).ToList(),
                                                   DynamicForms  = dynamicFormService.GetList(ProcessId, null, false, string.Empty, null, null).Select(c => new QueryModel(c.ID.ToString(), c.Name)).ToList(),
                                                   RoleNamesJson = luRowService.GetList("DepartmentRoleLU").Select(c => new ComboTreeModel()
                                            {
                                                id    = c.CodeOf,
                                                title = c.NameOf,
                                            }).ToList(),
                                                   Model = task,
                                               };
            }
        }
        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()
                               };
                }
            }
        }