Esempio n. 1
0
 public ActionResult GetAllRolesByProcessId(int id)
 {
     WorkflowModel model = new WorkflowModel();
     Process process = this.processService.GetDataById(id);
     model.RoleList = this.service.GetRoleList(0, process.SystemCode);
     if (Request.IsAjaxRequest())
     {
         return PartialView("Partial/Requestor", model);
     }
     return View(model);
 }
Esempio n. 2
0
 public ActionResult GetClassificationBySubProcessId(int selectedValue, int filter)
 {
     List<SelectListItem> classificationList = new List<SelectListItem>();
     classificationList = service.GetClassificationList(selectedValue, filter);
     WorkflowModel model = new WorkflowModel();
     if (classificationList != null)
     {
         model.ClassificationList = classificationList;
         if (Request.IsAjaxRequest())
         {
             return PartialView("Partial/Classification", model);
         }
     }
     return View(model);
 }
Esempio n. 3
0
        public JsonResult New(WorkflowModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    Workflow workflow = new Workflow();
                    model.Process = this.processService.GetDataById(model.ProcessId);
                    model.SubProcess = this.subProcessService.GetDataById(model.SubProcessId ?? 0);
                    model.Classification = this.classificationService.GetDataById(model.ClassificationId ?? 0);

                    bool ifExists = this.workflowService.CheckDataAndCodeIfExist(model);
                    if (!ifExists)
                    {
                        workflow.Process = model.Process;
                        workflow.SubProcess = model.SubProcess;
                        workflow.Classification = model.Classification;
                        workflow.Code = model.Code;
                        workflow.Name = model.Name;
                        workflow.Description = model.Description;
                        workflow.Active = true;
                        workflow.DateCreated = DateTime.Now;
                        workflow.Requestor = model.RequestorCode != null ? string.Join(",", model.RequestorCode) : string.Empty;
                        workflow.CreatedBy = User.Identity.Name.ToString();
                        workflow.Requestor = string.Join(",", model.RequestorCode);
                        workflow.Id = this.workflowService.Create(workflow);
                        model.Id = workflow.Id;
                        return Json(new { result = Base.Encrypt(workflow.Id.ToString()), message = MessageCode.saved, code = StatusCode.saved, content=model.Name });
                    }
                    return Json(new { result = StatusCode.existed, message = MessageCode.existed, code = StatusCode.existed, content = model.Name });
                }
                return Json(new { result = StatusCode.failed, message = MessageCode.error, code = StatusCode.invalid, content = model.Name });

            }
            catch (Exception ex)
            {
                return Json(new { result = StatusCode.failed, message = ex.Message.ToString(), code = StatusCode.failed, content = model.Name });
            }
        }
Esempio n. 4
0
 public ActionResult New()
 {
     WorkflowModel model = new WorkflowModel();
     model.ProcessList = this.service.GetProcessList(0);
     return View(model);
 }
Esempio n. 5
0
        public JsonResult Manage(WorkflowModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    model.Process = this.processService.GetDataById(model.ProcessId);
                    model.SubProcess = this.subProcessService.GetDataById(model.SubProcessId ?? 0);
                    model.Classification = this.classificationService.GetDataById(model.ClassificationId ?? 0);

                    bool ifExists = this.workflowService.CheckDataIfExists(model);
                    if (!ifExists)
                    {
                        Workflow workflow = new Workflow();
                        Process process = new Process();
                        SubProcess subProcess = new SubProcess();
                        Classification classification = new Classification();
                        process = this.processService.GetDataById(model.ProcessId);
                        subProcess = this.subProcessService.GetDataById(model.SubProcessId ?? 0);
                        classification = this.classificationService.GetDataById(model.ClassificationId ?? 0);
                        workflow = this.workflowService.GetDataById(model.Id);
                        workflow.Process = process;
                        workflow.SubProcess = subProcess;
                        workflow.Classification = classification;
                        workflow.Code = model.Code;
                        workflow.Name = model.Name;
                        workflow.Description = model.Description;
                        workflow.Active = model.Active;
                        workflow.Requestor = model.RequestorCode != null ? string.Join(",", model.RequestorCode) : string.Empty;
                        workflow.DateModified = DateTime.Now;
                        workflow.ModifiedBy = User.Identity.Name.ToString();
                        this.workflowService.SaveChanges(workflow);
                        return Json(new { result = Base.Encrypt(workflow.Id.ToString()), message = MessageCode.saved, code = StatusCode.saved, content= MessageCode.saved });

                    }
                    return Json(new { result = StatusCode.existed, message = MessageCode.existed, code = StatusCode.existed });
                }
                return Json(new { result = StatusCode.failed, message = MessageCode.error, code = StatusCode.invalid });
            }
            catch (Exception ex)
            {
                return Json(new { result = StatusCode.failed, message = ex.Message.ToString(), code = StatusCode.failed });
            }
        }
Esempio n. 6
0
        public ActionResult Manage(long id)
        {
            try
            {
                WorkflowModel model = new WorkflowModel();
                Workflow workflow = this.workflowService.GetDataById(id);
                if (workflow != null)
                {
                    model.Id = workflow.Id;
                    model.Code = workflow.Code;
                    model.Name = workflow.Name;
                    model.Description = workflow.Description;
                    model.Active = workflow.Active;
                    model.ProcessId = workflow.Process.Id;

                    Process process = this.processService.GetDataById(model.ProcessId);
                    model.RoleList = this.service.GetRoleList(workflow.Requestor.Split(new string[] { "," },StringSplitOptions.None), process.SystemCode);

                    model.ProcessList = this.service.GetProcessList(workflow.Process.Id);
                    model.SubProcessId = workflow.SubProcess!=null ? workflow.SubProcess.Id : 0;
                    if (model.SubProcessId != 0)
                    { model.SubProcessList = this.service.GetSubProcessList(workflow.SubProcess.Id); }
                    model.ClassificationId = workflow.Classification!=null ? workflow.Classification.Id : 0;
                    if(model.ClassificationId!=0)
                    {model.ClassificationList = this.service.GetClassificationList(workflow.Classification.Id);}
                }
                if (model != null)
                    return View(model);
            }
            catch (Exception)
            {

            }
            return RedirectToAction("Index");
        }
Esempio n. 7
0
 public ActionResult GetSubProcessByProcessId(int selectedValue, int filter)
 {
     List<SelectListItem> subProcessList = new List<SelectListItem>();
     subProcessList = service.GetSubProcessList(selectedValue, filter);
     WorkflowModel model = new WorkflowModel();
     if (subProcessList != null)
     {
         model.SubProcessList = subProcessList;
         if (Request.IsAjaxRequest())
         {
             return PartialView("Partial/SubProcess",model);
         }
     }
     return View(model);
 }