public DynamicFormDTO GetInfo(Guid Id) { using (DynamicFormService dynamicFormService = new DynamicFormService()) { return(new DynamicFormDTO(dynamicFormService.GetInfo(Id))); } }
public object GetEditApplicationPage(Guid ApplicationPageID) { //base.SetMenuIndex(AdminMenuIndex.ApplicationPageEdit); using (DynamicFormService dynamicFormService = new DynamicFormService()) { DynamicFormDTO dynamicFormDTO = new DynamicFormDTO(dynamicFormService.GetInfoByPageID(ApplicationPageID)); using (LURowService luRowService = new LURowService()) { dynamicFormDTO.ApplicationPageDTO.ListGroupLU = luRowService.GetList(sysBpmsLUTable.e_LUTable.ApplicationPageGroupLU.ToString()).Select(c => new LURowDTO(c)).ToList(); } using (ApplicationPageAccessService applicationPageAccessService = new ApplicationPageAccessService()) using (LURowService luRowService = new LURowService()) using (UserService userService = new UserService()) using (DepartmentService departmentService = new DepartmentService()) return(Json(new { ListApplicationPageAccess = applicationPageAccessService.GetList(dynamicFormDTO.ApplicationPageID, null).Select(c => new ApplicationPageAccessDTO(c)).ToList(), ListDepartments = departmentService.GetList(true, "", null).Select(c => new DepartmentDTO(c)).ToList(), ListRoles = luRowService.GetList(sysBpmsLUTable.e_LUTable.DepartmentRoleLU.ToString()).Select(c => new LURowDTO(c)).ToList(), ListUsers = userService.GetList("", null).Select(c => new UserDTO(c)).ToList(), Model = dynamicFormDTO })); } }
public object GetPopUp(Guid formID) { using (DynamicFormService dynamicFormService = new DynamicFormService()) { sysBpmsDynamicForm dynamicForm = dynamicFormService.GetInfo(formID); Guid applicationId = dynamicForm.ApplicationPageID.Value; EngineSharedModel engineSharedModel = new EngineSharedModel(applicationId, base.MyRequest.GetList(this.IsEncrypted, base.ApiSessionId).ToList(), base.ClientUserName, base.ApiSessionId); using (ApplicationPageEngine applicationPageEngine = new ApplicationPageEngine(engineSharedModel)) { GetFormResponseModel responseVM = applicationPageEngine.GetForm(); if (responseVM.EngineFormModel != null) { string popUpUrl = UrlUtility.GetCartableApiUrl(base.MyRequest, base.PortalSettings.DefaultPortalAlias, nameof(CartablePageController.GetPopUp), nameof(CartablePageController), ""); string postUrl = UrlUtility.GetCartableApiUrl(base.MyRequest, base.PortalSettings.DefaultPortalAlias, nameof(CartablePageController.PostPopUp), nameof(CartablePageController), "", UrlUtility.GetParamsAsArray(new HttpRequestWrapper(base.MyRequest), new string[] { $"applicationPageId={applicationId}" }).ToArray()); responseVM.EngineFormModel.SetUrls(popUpUrl, postUrl, new HttpRequestWrapper(base.MyRequest), base.PortalSettings.DefaultPortalAlias, FormTokenUtility.GetFormToken(base.ApiSessionId, responseVM?.EngineFormModel?.FormModel?.ContentHtml?.DynamicFormID ?? Guid.Empty, responseVM?.EngineFormModel?.FormModel?.IsEncrypted ?? false)); } return(new { Model = responseVM?.EngineFormModel, MessageList = responseVM?.ListMessageModel.Select(c => new PostMethodMessage(c.Message, c.DisplayMessageType)), RedirectUrl = base.GetRedirectUrl(responseVM?.RedirectUrlModel), Result = true, }); } } }
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 GetPreviewForm(Guid FormId) { using (DynamicFormService dynamicFormService = new DynamicFormService()) { try { EngineFormModel engineForm = dynamicFormService.PreviewForm(FormId, base.userName); engineForm.SetUrls(string.Empty, string.Empty, new HttpRequestWrapper(base.MyRequest), base.PortalSettings.DefaultPortalAlias, FormTokenUtility.GetFormToken(HttpContext.Current.Session.SessionID, engineForm?.FormModel?.ContentHtml?.DynamicFormID ?? Guid.Empty, engineForm?.FormModel?.IsEncrypted ?? false)); return(new { Model = engineForm, Result = true, }); } catch (Exception ex) { return(new { MessageList = new List <PostMethodMessage>() { new PostMethodMessage(ex.ToString(), DisplayMessageType.error) }, Result = false }); } } }
public object PostLoadEmailForm(PostLoadEmailFormDTO model) { Guid? dynamicFormId = model.DynamicFormId.ToGuidObjNull(); DCEmailModel designCode = null; if (!string.IsNullOrWhiteSpace(model.XmlB64Model)) { designCode = DesignCodeUtility.GetObjectOfDesignCode <DCEmailModel>(model.XmlB64Model.ToStringObj().FromBase64()); designCode.IsOutputYes = model.IsOutputYes; } else { designCode = new DCEmailModel(Guid.NewGuid().ToString(), "Email", model.ShapeId.ToStringObj(), model.ParentShapeId.ToStringObj(), model.IsOutputYes, model.IsFirst.ToBoolObj(), string.Empty, Guid.Empty, "", "", ""); } using (DynamicFormService dynamicFormService = new DynamicFormService()) using (EmailAccountService emailAccountService = new EmailAccountService()) return new { ListEmailAccounts = emailAccountService.GetList((int)sysBpmsEmailAccount.e_ObjectTypeLU.Systemic, null, null).Select(c => new QueryModel(c.ID.ToString(), c.Email)).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 }; }
public DynamicFormDTO GetInfo(Guid applicationPageId) { using (DynamicFormService dynamicFormService = new DynamicFormService()) { return(new DynamicFormDTO(dynamicFormService.GetInfoByPageID(applicationPageId))); } }
public object GetThreadDetail(Guid ThreadID) { using (ThreadService threadService = new ThreadService()) { using (ThreadTaskService threadTaskService = new ThreadTaskService()) { using (DynamicFormService dynamicFormService = new DynamicFormService()) { ThreadDetailDTO threadDetailDTO = new ThreadDetailDTO( threadService.GetInfo(ThreadID, new string[] { nameof(sysBpmsThread.User), nameof(sysBpmsThread.Process) }), threadTaskService.GetList(ThreadID, (int)sysBpmsTask.e_TypeLU.UserTask, null, null, new string[] { $"{nameof(sysBpmsThreadTask.Task)}.{nameof(sysBpmsThreadTask.Task.Element)}", nameof(sysBpmsThreadTask.User) }).Select(c => new ThreadHistoryDTO(c)).ToList()); List <sysBpmsDynamicForm> listForms = dynamicFormService.GetList(threadDetailDTO.ProcessID, null, null, "", true, null); using (ProcessEngine processEngine = new ProcessEngine(new EngineSharedModel(ThreadID, threadDetailDTO.ProcessID, this.MyRequest.GetList(false, HttpContext.Current.Session.SessionID).ToList(), base.UserInfo.Username, HttpContext.Current.Session.SessionID))) { foreach (var item in listForms) { var result = processEngine.GetContentHtmlByFormID(item.ID, true); EngineFormModel engineFormModel = new EngineFormModel(result.FormModel, ThreadID, null, threadDetailDTO.ProcessID); engineFormModel.GetPopUpUrl = UrlUtility.GetCartableApiUrl(base.MyRequest, base.PortalSettings.DefaultPortalAlias, "GetPopUp", "CartableThread", ""); threadDetailDTO.ListOverviewForms.Add(engineFormModel); } } return(threadDetailDTO); } } } }
public object ExecuteCode(string controlId, Guid formId, string commandId, Guid?threadId = null, Guid?applicationPageId = null) { using (DynamicFormService dynamicFormService = new DynamicFormService()) { sysBpmsDynamicForm dynamicForm = dynamicFormService.GetInfo(formId); object control = dynamicForm.FindControl(controlId); DesignCodeModel designCode = null; if (control is DataGridHtml) { designCode = ((DataGridHtml)control).GetCommandCode(commandId); } EngineSharedModel engineSharedModel = applicationPageId.HasValue ? new EngineSharedModel(applicationPageId.Value, HttpContext.Current.Request.GetList(base.IsEncrypted, base.ApiSessionId).ToList(), base.ClientUserName, base.ApiSessionId) : new EngineSharedModel(threadId, dynamicForm.ProcessId, HttpContext.Current.Request.GetList(base.IsEncrypted, base.ApiSessionId).ToList(), base.ClientUserName, base.ApiSessionId); UnitOfWork unitOfWork = new UnitOfWork(); DynamicCodeEngine dynamicCodeEngine = new DynamicCodeEngine(engineSharedModel, unitOfWork); var result = dynamicCodeEngine.ExecuteScriptCode(designCode, new CodeBaseSharedModel(null)); //If in code any variable is set, it Will save them all at the end dynamicCodeEngine.SaveExternalVariable(result); return(new { result = result?.Result, listMessage = result?.CodeBaseShared.MessageList.Select(c => new { DisplayMessageType = c.DisplayMessageType.ToString(), c.Message }) }); } }
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)); }
public object GetPopUp(Guid threadTaskID, Guid formID) { using (ThreadTaskService threadTaskService = new ThreadTaskService()) { using (DynamicFormService dynamicFormService = new DynamicFormService()) { sysBpmsThreadTask threadTask = threadTaskService.GetInfo(threadTaskID, new string[] { nameof(sysBpmsThreadTask.Thread) }); using (ProcessEngine ProcessEngine = new ProcessEngine(new EngineSharedModel(threadTask.ThreadID, threadTask.Thread.ProcessID, this.MyRequest.GetList(dynamicFormService.GetInfo(formID).ConfigXmlModel.IsEncrypted, base.ApiSessionId).ToList(), base.ClientUserName, base.ApiSessionId))) { GetTaskFormResponseModel responseVM = ProcessEngine.GetForm(threadTaskID, formID); if (responseVM.EngineFormModel != null) { string popUpUrl = UrlUtility.GetCartableApiUrl(base.MyRequest, base.PortalSettings.DefaultPortalAlias, nameof(CartableThreadController.GetPopUp), nameof(CartableThreadController), "", "threadTaskID=" + threadTaskID); string postUrl = UrlUtility.GetCartableApiUrl(base.MyRequest, base.PortalSettings.DefaultPortalAlias, nameof(CartableThreadController.PostPopUp), nameof(CartableThreadController), "", UrlUtility.GetParamsAsArray(new HttpRequestWrapper(base.MyRequest), new string[] { $"formID={formID}", $"threadTaskID={threadTaskID}", $"stepID={responseVM.EngineFormModel.FormModel.StepID}" }).ToArray()); responseVM.EngineFormModel.SetUrls(popUpUrl, postUrl, new HttpRequestWrapper(base.MyRequest), base.PortalSettings.DefaultPortalAlias, FormTokenUtility.GetFormToken(base.ApiSessionId, responseVM.EngineFormModel?.FormModel?.ContentHtml?.DynamicFormID ?? Guid.Empty, responseVM?.EngineFormModel?.FormModel?.IsEncrypted ?? false)); } return(new { Model = responseVM?.EngineFormModel, MessageList = responseVM?.ListMessageModel.Select(c => new PostMethodMessage(c.Message, c.DisplayMessageType)), RedirectUrl = base.GetRedirectUrl(responseVM?.RedirectUrlModel), Result = true, }); } } } }
public bool GetConfirmResult(string controlId, Guid formId, bool isGridCommand, string gridId = "", Guid?threadId = null, Guid?applicationPageId = null) { using (DynamicFormService dynamicFormService = new DynamicFormService()) { sysBpmsDynamicForm dynamicForm = dynamicFormService.GetInfo(formId); object control = dynamicForm.FindControl(isGridCommand ? gridId : controlId); DesignCodeModel designCode = null; if (control is ButtonHtml) { designCode = ((ButtonHtml)control).ConfirmDesignCodeModel; } if (control is DataGridHtml) { designCode = ((DataGridHtml)control).GetConfirmCode(controlId); } EngineSharedModel engineSharedModel = applicationPageId.HasValue ? new EngineSharedModel(applicationPageId.Value, HttpContext.Current.Request.GetList(base.IsEncrypted, base.ApiSessionId).ToList(), base.ClientUserName, base.ApiSessionId) : new EngineSharedModel(threadId, dynamicForm.ProcessId, HttpContext.Current.Request.GetList(base.IsEncrypted, base.ApiSessionId).ToList(), base.ClientUserName, base.ApiSessionId); UnitOfWork unitOfWork = new UnitOfWork(); return(new DynamicCodeEngine(engineSharedModel, unitOfWork).ExecuteBooleanCode(designCode)); } }
public object GetThreadDetail(Guid ThreadID) { using (ThreadService threadService = new ThreadService()) { using (ThreadTaskService threadTaskService = new ThreadTaskService()) { using (DynamicFormService dynamicFormService = new DynamicFormService()) { ThreadDetailDTO threadDetailDTO = new ThreadDetailDTO( threadService.GetInfo(ThreadID, new string[] { nameof(sysBpmsThread.User), nameof(sysBpmsThread.Process) }), threadTaskService.GetList(ThreadID, (int)sysBpmsTask.e_TypeLU.UserTask, null, null, new string[] { $"{nameof(sysBpmsThreadTask.Task)}.{nameof(sysBpmsThreadTask.Task.Element)}", nameof(sysBpmsThreadTask.User) }).Select(c => new ThreadHistoryDTO(c)).ToList()); List <sysBpmsDynamicForm> listForms = dynamicFormService.GetList(threadDetailDTO.ProcessID, null, null, "", true, null); using (ProcessEngine processEngine = new ProcessEngine(new EngineSharedModel(ThreadID, threadDetailDTO.ProcessID, this.MyRequest.GetList(false, base.ApiSessionId).ToList(), base.ClientUserName, base.ApiSessionId))) { foreach (var item in listForms) { var result = processEngine.GetContentHtmlByFormID(item.ID, true); EngineFormModel engineFormModel = new EngineFormModel(result.FormModel, ThreadID, null, threadDetailDTO.ProcessID); string popUpUrl = UrlUtility.GetCartableApiUrl(base.MyRequest, base.PortalSettings.DefaultPortalAlias, nameof(CartableThreadController.GetPopUp), nameof(CartableThreadController), ""); engineFormModel.SetReadOnlyUrls(popUpUrl, new HttpRequestWrapper(base.MyRequest), base.PortalSettings.DefaultPortalAlias, FormTokenUtility.GetFormToken(base.ApiSessionId, engineFormModel?.FormModel?.ContentHtml?.DynamicFormID ?? Guid.Empty, engineFormModel?.FormModel?.IsEncrypted ?? false)); threadDetailDTO.ListOverviewForms.Add(engineFormModel); } } return(threadDetailDTO); } } } }
public object PostIndex(Guid threadTaskID, Guid stepID, bool?goNext = null, string controlId = "") { using (ThreadTaskService threadTaskService = new ThreadTaskService()) { using (DynamicFormService dynamicFormService = new DynamicFormService()) { sysBpmsThreadTask threadTask = new ThreadTaskService().GetInfo(threadTaskID, new string[] { nameof(sysBpmsThreadTask.Thread) }); using (ProcessEngine processEngine = new ProcessEngine(new EngineSharedModel(threadTask.Thread, threadTask.Thread.ProcessID, this.MyRequest.GetList(dynamicFormService.GetInfoByStepID(stepID).ConfigXmlModel.IsEncrypted, base.ApiSessionId).ToList(), base.ClientUserName, base.ApiSessionId))) { PostTaskFormResponseModel responseVM = processEngine.PostTaskForm(threadTaskID, stepID, goNext, controlId); if (!responseVM.IsSuccess) { return(new EngineFormResponseDTO(redirectUrl: base.GetRedirectUrl(responseVM.RedirectUrlModel), reloadForm: false, null, false, messageList: responseVM.ListMessageModel, false)); } else { if (responseVM.IsSubmit) { if (responseVM.IsNextPrevious == true) { return(new EngineFormResponseDTO( redirectUrl: base.GetRedirectUrl(responseVM.RedirectUrlModel), reloadForm: true, listDownloadModel: responseVM.ListDownloadModel, messageList: responseVM.ListMessageModel ) { StepID = responseVM.StepID.Value, }); } else { return(new EngineFormResponseDTO( redirectUrl: string.IsNullOrWhiteSpace(base.GetRedirectUrl(responseVM.RedirectUrlModel)) ? "CartableManage" : base.GetRedirectUrl(responseVM.RedirectUrlModel), reloadForm: false, listDownloadModel: responseVM.ListDownloadModel, messageList: responseVM.ListMessageModel )); } } else { return new EngineFormResponseDTO( redirectUrl: base.GetRedirectUrl(responseVM.RedirectUrlModel), reloadForm: true, listDownloadModel: responseVM.ListDownloadModel, messageList: responseVM.ListMessageModel ) { StepID = responseVM.StepID.Value, } }; } } } } } }
public object PostLoadCallMethodForm(PostLoadCallMethodFormDTO model) { Guid?dynamicFormId = model.DynamicFormId.ToGuidObjNull(); DCCallMethodModel designCode = null; if (!string.IsNullOrWhiteSpace(model.XmlB64Model.ToStringObj())) { designCode = DesignCodeUtility.GetObjectOfDesignCode <DCCallMethodModel>(model.XmlB64Model.ToStringObj().FromBase64()); designCode.IsOutputYes = model.IsOutputYes; } else { designCode = new DCCallMethodModel(Guid.NewGuid().ToString(), string.Empty, model.ShapeId.ToStringObj(), model.ParentShapeId.ToStringObj(), model.IsOutputYes, model.IsFirst, model.DefaultMethodID, model.DefaultMethodGroupType); } using (DynamicFormService dynamicFormService = new DynamicFormService()) return new { 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 ThreadDetailDTO GetThreadDetails(Guid threadId) { using (ThreadService threadService = new ThreadService()) { using (ThreadTaskService threadTaskService = new ThreadTaskService()) { using (DynamicFormService dynamicFormService = new DynamicFormService()) { ThreadDetailDTO threadDetailDTO = new ThreadDetailDTO( threadService.GetInfo(threadId, new string[] { nameof(sysBpmsThread.User), nameof(sysBpmsThread.Process) }), threadTaskService.GetList(threadId, (int)sysBpmsTask.e_TypeLU.UserTask, null, null, new string[] { $"{nameof(sysBpmsThreadTask.Task)}.{nameof(sysBpmsThreadTask.Task.Element)}", nameof(sysBpmsThreadTask.User) }).Select(c => new ThreadHistoryDTO(c)).ToList()); List <sysBpmsDynamicForm> listForms = dynamicFormService.GetList(threadDetailDTO.ProcessID, null, null, "", true, null); using (ProcessEngine processEngine = new ProcessEngine(new EngineSharedModel(threadId, threadDetailDTO.ProcessID, this.MyRequest.GetList(false, base.ApiSessionId).ToList(), base.ClientUserName, base.ApiSessionId))) { foreach (var item in listForms) { var result = processEngine.GetContentHtmlByFormID(item.ID, true); EngineFormModel engineFormModel = new EngineFormModel(result.FormModel, threadId, null, threadDetailDTO.ProcessID); engineFormModel.GetPopUpUrl = string.Empty; threadDetailDTO.ListOverviewForms.Add(engineFormModel); } } return(threadDetailDTO); } } } }
public object GetAddEditFormDesign(Guid?ID = null) { using (DynamicFormService dynamicFormService = new DynamicFormService()) { DynamicFormDTO dynamicFormDTO = new DynamicFormDTO(ID.HasValue ? dynamicFormService.GetInfo(ID.Value) : dynamicFormService.GetInfoByPageID(base.ApplicationPageId.Value)); if (dynamicFormDTO != null) { using (VariableService variableService = new VariableService()) return(Json(new { //it is used in dataGrid seting for binging form to openForm Column Item Type. ProcessForms = dynamicFormService.GetList(dynamicFormDTO.ProcessId, null, base.ApplicationPageId.HasValue, string.Empty, null, null).Select(c => new { value = c.ID, text = c.Name }).ToList(), //it is used for binding variable of entity type to fileupload controls. EntityVariables = variableService.GetList(dynamicFormDTO.ProcessId, base.ApplicationPageId, (int)sysBpmsVariable.e_VarTypeLU.Object, "", null, true).Select(c => new { text = c.Name, value = c.ID }).ToList(), //it is used for binding variable of list type to list controls like dropdownlist or checkboxlist and uploader. ListVariables = variableService.GetList(dynamicFormDTO.ProcessId, base.ApplicationPageId, (int)sysBpmsVariable.e_VarTypeLU.List, "", null, true).Select(c => new { text = c.Name, value = c.Name }).ToList(), Model = dynamicFormDTO })); } else { return(new PostMethodMessage(SharedLang.Get("NotFound.Text"), DisplayMessageType.error)); } } }
public List <ComboSearchItem> GetList(Guid?processId = null, string query = "") { using (DynamicFormService dynamicFormService = new DynamicFormService()) { return(dynamicFormService.GetList(processId, null, null, query, null, null).Select(c => new ComboSearchItem(c.ID.ToString(), c.Name)).ToList()); } }
public List <ComboSearchItem> GetList(string query = "") { using (DynamicFormService dynamicFormService = new DynamicFormService()) { return(dynamicFormService.GetList(null, null, true, query, null, null).Select(c => new ComboSearchItem(c.ApplicationPageID.ToString(), c.Name)).ToList()); } }
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)); } } }
public void GetDynamicFormActionAsync_ReturnsDynamicFormDataIfAModelWithNameModelNameExistsAndHasADynamicFormAttribute() { // Arrange Mock <Assembly> mockAssembly = new Mock <Assembly>(); mockAssembly.Setup(a => a.ExportedTypes).Returns(new Type[] { _testType }); Mock <IAssemblyService> mockAssemblyService = new Mock <IAssemblyService>(); mockAssemblyService. Setup(a => a.GetReferencingAssemblies(It.Is <string>(s => s == _testAssemblyName))). Returns(new Assembly[] { mockAssembly.Object }); Mock <IDynamicFormBuilder> mockDynamicFormBuilder = new Mock <IDynamicFormBuilder>(); mockDynamicFormBuilder. Setup(d => d.BuildDynamicFormData(It.Is <TypeInfo>(ti => ti == _testType.GetTypeInfo()))). Returns(_testDynamicFormData); DynamicFormService dynamicFormService = new DynamicFormService(mockDynamicFormBuilder.Object, mockAssemblyService.Object); // Act DynamicFormData result = dynamicFormService.GetDynamicFormAction(_testTypeName); // Assert mockAssembly.VerifyAll(); mockAssemblyService.VerifyAll(); mockDynamicFormBuilder.VerifyAll(); Assert.NotNull(result); }
public object GetList([System.Web.Http.FromUri] DynamicFormIndexSearchDTO indexSearchVM) { using (DynamicFormService dynamicFormService = new DynamicFormService()) { indexSearchVM.Update(dynamicFormService.GetList(indexSearchVM.ProcessId, null, !indexSearchVM.ProcessId.HasValue, indexSearchVM.Name, null, indexSearchVM.GetPagingProperties).Select(c => new DynamicFormDTO(c)).ToList()); return(indexSearchVM); } }
public ActionResult Settings() { var settings = new SingleActionSettingDTO(base.PortalSettings.PortalId, ModuleContext.Configuration.ModuleSettings); try { if (!string.IsNullOrWhiteSpace(settings.WebApiAddress)) { settings.ProcessName = settings.ProcessID.HasValue ? new EngineProcessProxy(settings.WebApiAddress, settings.WebServicePass, base.User.Username, ApiUtility.GetIPAddress(), base.Session.SessionID, false).GetInfo(settings.ProcessID.Value)?.Name : ""; settings.ProcessEndFormName = settings.ProcessEndFormID.HasValue ? new EngineFormProxy(settings.WebApiAddress, settings.WebServicePass, base.User.Username, ApiUtility.GetIPAddress(), base.Session.SessionID, false).GetInfo(settings.ProcessEndFormID.Value)?.Name : "";; settings.ApplicationName = settings.ApplicationPageID.HasValue ? new EngineApplicationProxy(settings.WebApiAddress, settings.WebServicePass, base.User.Username, ApiUtility.GetIPAddress(), base.Session.SessionID, false).GetInfo(settings.ApplicationPageID.Value)?.Name : ""; } else { if (settings.ProcessID.HasValue) { using (ProcessService processService = new ProcessService()) settings.ProcessName = processService.GetInfo(settings.ProcessID.Value).Name; } if (settings.ProcessEndFormID.HasValue) { using (DynamicFormService dynamicFormService = new DynamicFormService()) settings.ProcessEndFormName = dynamicFormService.GetInfo(settings.ProcessEndFormID.Value).Name; } if (settings.ApplicationPageID.HasValue) { using (DynamicFormService dynamicFormService = new DynamicFormService()) settings.ApplicationName = dynamicFormService.GetInfoByPageID(settings.ApplicationPageID.Value).Name; } } if (string.IsNullOrWhiteSpace(settings.ApplicationName) && string.IsNullOrWhiteSpace(settings.ProcessName)) { settings.ProcessID = null; settings.ApplicationPageID = null; } } catch { } if (!string.IsNullOrWhiteSpace(settings.WebApiAddress)) { ViewBag.ApplicationPageUrl = ApiUtility.GetGeneralApiUrl(base.Request, base.ModuleContext.TabModuleId, base.PortalSettings.DefaultPortalAlias, "GetList", "EngineApplication", FormTokenUtility.GetFormToken(base.Session.SessionID, Guid.Empty, false), true); ViewBag.ProcessFormUrl = ApiUtility.GetGeneralApiUrl(base.Request, base.ModuleContext.TabModuleId, base.PortalSettings.DefaultPortalAlias, "GetList", "EngineForm", FormTokenUtility.GetFormToken(base.Session.SessionID, Guid.Empty, false), true); ViewBag.ProcessUrl = ApiUtility.GetGeneralApiUrl(base.Request, base.ModuleContext.TabModuleId, base.PortalSettings.DefaultPortalAlias, "GetList", "EngineProcess", FormTokenUtility.GetFormToken(base.Session.SessionID, Guid.Empty, false), true); } else { ViewBag.ApplicationPageUrl = UrlUtility.GetApiUrl(base.Request, base.PortalSettings.DefaultPortalAlias, "GetList", "EngineApplication", FormTokenUtility.GetFormToken(base.Session.SessionID, Guid.Empty, false)); ViewBag.ProcessFormUrl = UrlUtility.GetApiUrl(base.Request, base.PortalSettings.DefaultPortalAlias, "GetList", "EngineForm", FormTokenUtility.GetFormToken(base.Session.SessionID, Guid.Empty, false)); ViewBag.ProcessUrl = UrlUtility.GetApiUrl(base.Request, base.PortalSettings.DefaultPortalAlias, "GetList", "EngineProcess", FormTokenUtility.GetFormToken(base.Session.SessionID, Guid.Empty, false)); } ViewBag.Url = base.ActivePage.FullUrl + "/controller/Settings/action/UpdatePass"; return(View(settings)); }
public PostFormResponseModel PostForm(Guid applicationPageId, string controlId = "") { using (DynamicFormService dynamicFormService = new DynamicFormService()) { List <QueryModel> baseQueryModel = base.MyRequest.GetList(base.IsEncrypted, base.ApiSessionId).ToList(); using (ApplicationPageEngine applicationPageEngine = new ApplicationPageEngine(new EngineSharedModel(applicationPageId, baseQueryModel, base.ClientUserName, base.ApiSessionId))) { return(applicationPageEngine.PostForm(controlId)); } } }
public object GetJavaScriptIndex([System.Web.Http.FromUri] JavaScriptDesignCodeDTO codeVM) { if (codeVM != null && codeVM.Code.ToStringObj().ToLower().Trim() == "null") { codeVM.Code = string.Empty; } using (DynamicFormService dynamicFormService = new DynamicFormService()) codeVM.GetControls = dynamicFormService.GetControls(dynamicFormService.GetInfo(codeVM.DynamicFormId)).Select(c => new QueryModel(c.Key, c.Value)).ToList(); codeVM.GetAllJavaMethods = DesignCodeUtility.GetAllJavaMethods().Select(c => new QueryModel(c, c)).ToList(); return(codeVM); }
public object GetAddEditStyleSheet(Guid DynamicFormId) { using (DynamicFormService dynamicFormService = new DynamicFormService()) { sysBpmsDynamicForm dynamicForm = dynamicFormService.GetInfo(DynamicFormId); return(Json(new { StyleCode = dynamicForm.ConfigXmlModel.StyleSheetCode.ToStringObj(), DynamicFormId })); } }
public GetFormResponseModel GetForm(Guid?applicationPageId = null, Guid?formID = null) { using (DynamicFormService dynamicFormService = new DynamicFormService()) { applicationPageId = applicationPageId ?? dynamicFormService.GetInfo(formID.Value).ApplicationPageID; List <QueryModel> baseQueryModel = base.MyRequest.GetList(base.IsEncrypted, base.ApiSessionId).ToList(); using (ApplicationPageEngine applicationPageEngine = new ApplicationPageEngine(new EngineSharedModel(applicationPageId.Value, baseQueryModel, base.ClientUserName, base.ApiSessionId))) { return(applicationPageEngine.GetForm()); } } }
public object PostLoadExpressionCodeForm(PostLoadExpressionCodeFormDTO model) { DCExpressionModel designCode; Guid?dynamicFormId = model.DynamicFormId.ToGuidObjNull(); if (!string.IsNullOrWhiteSpace(model.Data)) { designCode = DesignCodeUtility.GetObjectOfDesignCode <DCExpressionModel>(model.Data.FromBase64()); designCode.IsOutputYes = model.IsOutputYes; if (string.IsNullOrWhiteSpace(designCode.FuncName)) { designCode.FuncName = DesignCodeUtility.GetFunctionName(designCode.ShapeID); } } else { designCode = new DCExpressionModel(Guid.NewGuid().ToString(), model.Name.ToStringObj(), model.ShapeId.ToStringObj(), model.ParentShapeId.ToStringObj(), "", model.IsOutputYes, model.IsFirst.ToBoolObj(), null); } designCode.Assemblies = string.Join(",", designCode.Assemblies.ToStringObj().Split(',').Select(c => c.Trim()).ToList()); designCode.ExpressionCode = designCode.ExpressionCode.ToStringObj().Replace("\\", "\\\\"); using (DocumentFolderService documentFolderService = new DocumentFolderService()) using (DepartmentService departmentService = new DepartmentService()) using (LURowService luRowService = new LURowService()) using (VariableService variableService = new VariableService()) using (DynamicFormService dynamicFormService = new DynamicFormService()) return new { GetAllSysMethods = DesignCodeUtility.GetAllSysMethods().Select(c => new { Key = c }).ToList(), GetVariableMethods = DesignCodeUtility.GetVariableMethods().Select(c => new { Key = c }).ToList(), GetMessageMethods = DesignCodeUtility.GetMessageMethods().Select(c => new { Key = c }).ToList(), GetAccessMethods = DesignCodeUtility.GetAccessMethods().Select(c => new { Key = c }).ToList(), GetHelperMethods = DesignCodeUtility.GetHelperMethods().Select(c => new { Key = c }).ToList(), GetDocumentMethods = DesignCodeUtility.GetDocumentMethods().Select(c => new { Key = c }).ToList(), GetAllSysProperties = DesignCodeUtility.GetAllSysProperties().Select(c => new { Key = c }).ToList(), AssembliesJson = (Directory.Exists(BPMSResources.FilesRoot + BPMSResources.AssemblyRoot) ? new DirectoryInfo(BPMSResources.FilesRoot + BPMSResources.AssemblyRoot).GetFiles("*.dll").Select(c => new AssemblyDTO(c)).Select(c => new ComboTreeModel() { id = c.FileName, title = c.FileName }).ToList() : new List <ComboTreeModel>()), ApplicationPages = dynamicFormService.GetList(null, null, true, string.Empty, null, null).Select(c => new QueryModel(c.ApplicationPageID.ToString(), c.Name)).ToList(), DepartmentRoles = luRowService.GetList("DepartmentRoleLU").Select(c => new LURowDTO(c)).ToList(), DepartmentList = departmentService.GetList(true, "", null).Select(c => new { ID = $"new Guid(\"{ c.ID }\")", c.Name }), DocumentFolders = documentFolderService.GetList(null, "", "", true).Select(c => new QueryModel(c.ID.ToString(), c.DisplayName)).ToList(), ProcessVariables = variableService.GetVariableAsComboTree(base.ProcessId, base.ApplicationPageId, null, "{0}"), 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 HttpResponseMessage GetChartElement(Guid formId, string controlId, Guid?threadId = null) { sysBpmsDynamicForm dynamicForm = new DynamicFormService().GetInfo(formId); ChartHtml control = (ChartHtml)dynamicForm.FindControl(controlId); EngineSharedModel engineSharedModel = dynamicForm.ProcessId.HasValue ? new EngineSharedModel(threadId, dynamicForm.ProcessId, base.MyRequest.GetList(base.IsEncrypted, base.ApiSessionId).ToList(), base.ClientUserName, base.ApiSessionId) : new EngineSharedModel(dynamicForm.ApplicationPageID.Value, base.MyRequest.GetList(base.IsEncrypted, base.ApiSessionId).ToList(), base.ClientUserName, base.ApiSessionId); control.Helper = HtmlElementHelper.MakeModel(engineSharedModel, new UnitOfWork(), HtmlElementHelperModel.e_FormAction.Onload, dynamicForm); control.FillData(); return(Request.CreateResponse(HttpStatusCode.OK, control)); }