Пример #1
0
 public object PostAddEditFormDesign(PostAddEditFormDesignDTO model)
 {
     using (DynamicFormService dynamicFormService = new DynamicFormService())
     {
         sysBpmsDynamicForm dynamicForm = dynamicFormService.GetInfo(model.DynamicFormId);
         if (dynamicForm != null)
         {
             ResultOperation resultOperation = dynamicForm.Update(model.DesignJson);
             if (!resultOperation.IsSuccess)
             {
                 return(new PostMethodMessage(resultOperation.GetErrors(), DisplayMessageType.error));
             }
             resultOperation = dynamicFormService.GetSourceCode(dynamicForm);
             if (!resultOperation.IsSuccess)
             {
                 return(new PostMethodMessage(resultOperation.GetErrors(), DisplayMessageType.error));
             }
             resultOperation = dynamicFormService.Update(dynamicForm, base.userName);
             if (resultOperation.IsSuccess)
             {
                 return(new PostMethodMessage(SharedLang.Get("Success.Text"), DisplayMessageType.success));
             }
             else
             {
                 return(new PostMethodMessage(resultOperation.GetErrors(), DisplayMessageType.error));
             }
         }
         else
         {
             return(new PostMethodMessage(SharedLang.Get("NotFound.Text"), DisplayMessageType.error));
         }
     }
 }
Пример #2
0
        public object PostEditApplicationPage(PostEditApplicationPageDTO model)
        {
            using (DynamicFormService dynamicFormService = new DynamicFormService())
            {
                sysBpmsDynamicForm dynamicForm = dynamicFormService.GetInfo(model.DynamicFormDTO.ID);
                dynamicForm.Update(null, model.DynamicFormDTO.ApplicationPageID, model.DynamicFormDTO.Name, model.DynamicFormDTO.Version, model.DynamicFormDTO.ShowInOverview);

                DynamicFormConfigXmlModel configXmlModel = dynamicForm.ConfigXmlModel;
                configXmlModel.IsEncrypted = model.DynamicFormDTO.IsEncrypted;
                dynamicForm.Update(configXmlModel);

                dynamicFormService.Update(dynamicForm, base.userName);

                using (ApplicationPageService applicationPageService = new ApplicationPageService())
                {
                    sysBpmsApplicationPage applicationPage = applicationPageService.GetInfo(model.DynamicFormDTO.ApplicationPageID.Value);
                    applicationPage.Update(model.DynamicFormDTO.ApplicationPageDTO.GroupLU, model.DynamicFormDTO.ApplicationPageDTO.Description, model.DynamicFormDTO.ApplicationPageDTO.ShowInMenu);
                    applicationPageService.Update(applicationPage);

                    using (ApplicationPageAccessService applicationPageAccessService = new ApplicationPageAccessService())
                    {
                        List <sysBpmsApplicationPageAccess> newApplicationPageAccess =
                            (model.listRole ?? new List <ApplicationPageAccessDTO>()).Select(c => new sysBpmsApplicationPageAccess().Update(c.ID, model.DynamicFormDTO.ApplicationPageID.Value, c.DepartmentID, c.RoleLU, c.UserID, c.AllowAdd, c.AllowEdit, c.AllowDelete, c.AllowView)).ToList()
                            .Union((model.listUser ?? new List <ApplicationPageAccessDTO>()).Select(c => new sysBpmsApplicationPageAccess().Update(c.ID, model.DynamicFormDTO.ApplicationPageID.Value, c.DepartmentID, c.RoleLU, c.UserID, c.AllowAdd, c.AllowEdit, c.AllowDelete, c.AllowView))).ToList();
                        applicationPageAccessService.AddEdit(applicationPage.ID, newApplicationPageAccess);
                    }
                }
            }
            return(new PostMethodMessage(SharedLang.Get("Success.Text"), DisplayMessageType.success));
        }
Пример #3
0
        public object PostAddEditStyleSheet(PostAddEditStyleSheetDTO model)
        {
            using (DynamicFormService dynamicFormService = new DynamicFormService())
            {
                sysBpmsDynamicForm dynamicForm = dynamicFormService.GetInfo(model.DynamicFormId);

                DynamicFormConfigXmlModel configXmlModel = dynamicForm.ConfigXmlModel;
                configXmlModel.StyleSheetCode = model.StyleCode;
                dynamicForm.Update(configXmlModel);
                ResultOperation resultOperation = dynamicFormService.Update(dynamicForm, base.userName);

                if (!resultOperation.IsSuccess)
                {
                    return(new PostMethodMessage(resultOperation.GetErrors(), DisplayMessageType.error));
                }

                return(new PostMethodMessage(SharedLang.Get("Success.Text"), DisplayMessageType.success));
            }
        }
Пример #4
0
        public object PostAddEdit(DynamicFormDTO dynamicFormDTO)
        {
            sysBpmsDynamicForm dynamicForm;
            ResultOperation    resultOperation = new ResultOperation();

            using (DynamicFormService dynamicFormService = new DynamicFormService())
            {
                if (dynamicFormDTO.ID != Guid.Empty)
                {
                    dynamicForm = dynamicFormService.GetInfo(dynamicFormDTO.ID);
                    dynamicForm.Update(dynamicFormDTO.ProcessId, dynamicFormDTO.ApplicationPageID, dynamicFormDTO.Name, dynamicFormDTO.Version, dynamicFormDTO.ShowInOverview);

                    DynamicFormConfigXmlModel configXmlModel = dynamicForm.ConfigXmlModel;
                    configXmlModel.IsEncrypted = dynamicFormDTO.IsEncrypted;
                    dynamicForm.Update(configXmlModel);

                    resultOperation = dynamicFormService.Update(dynamicForm, base.userName);
                }
                else
                {
                    dynamicForm = new sysBpmsDynamicForm().Update(dynamicFormDTO.ProcessId, dynamicFormDTO.ApplicationPageID, dynamicFormDTO.Name, dynamicFormDTO.Version, dynamicFormDTO.ShowInOverview);

                    DynamicFormConfigXmlModel configXmlModel = dynamicForm.ConfigXmlModel;
                    configXmlModel.IsEncrypted = dynamicFormDTO.IsEncrypted;
                    dynamicForm.Update(configXmlModel);
                    //make applicationPage if processId is null.
                    sysBpmsApplicationPage sysAppPage = !dynamicForm.ProcessId.HasValue ?
                                                        new sysBpmsApplicationPage().Update(dynamicFormDTO.ApplicationPageDTO.GroupLU, string.Empty, dynamicFormDTO.ApplicationPageDTO.ShowInMenu) : null;

                    resultOperation        = dynamicFormService.Add(dynamicForm, sysAppPage, base.userName);
                    base.ApplicationPageId = dynamicForm.ApplicationPageID;
                }
            }
            if (resultOperation.IsSuccess)
            {
                return(new PostMethodMessage(SharedLang.Get("Success.Text"), DisplayMessageType.success, new DynamicFormDTO(dynamicForm)));
            }
            else
            {
                return(new PostMethodMessage(resultOperation.GetErrors(), DisplayMessageType.error));
            }
        }