public JsonResult New(ClassificationModel model)
        {
            try
            {
                Classification classification = new Classification();
                model.SubProcess = this.subProcessService.GetDataById(model.SubProcessId);
                if (ModelState.IsValid)
                {
                    bool ifExists = this.classificationService.CheckDataAndCodeIfExist(model);
                    if (!ifExists)
                    {
                        classification.SubProcess = model.SubProcess;
                        classification.Code = model.Code.ToUpper();
                        classification.Name = model.Name;
                        classification.Description = model.Description;
                        classification.Active = true;
                        classification.DateCreated = DateTime.Now;
                        classification.CreatedBy = User.Identity.Name.ToString();
                        classification.Id = this.classificationService.Create(classification);
                        model.Id = classification.Id;
                        return Json(new { result = Base.Encrypt(classification.Id.ToString()), message = MessageCode.saved, code = StatusCode.saved, content=model.Name });
                    }
                    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, content=model.Name });
            }
        }
 public JsonResult Manage(ClassificationModel model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             model.SubProcess = this.subProcessService.GetDataById(model.SubProcessId);
             bool ifExists = this.classificationService.CheckDataIfExists(model);
             if (!ifExists)
             {
                 Classification classification = new Classification();
                 SubProcess subProcess = new SubProcess();
                 subProcess = this.subProcessService.GetDataById(model.SubProcessId);
                 classification = this.classificationService.GetDataById(model.Id);
                 classification.SubProcess = subProcess;
                 classification.Code = model.Code;
                 classification.Name = model.Name;
                 classification.Description = model.Description;
                 classification.Active = model.Active;
                 classification.DateModified = DateTime.Now;
                 classification.ModifiedBy = User.Identity.Name.ToString();
                 this.classificationService.SaveChanges(classification);
                 return Json(new { result = Base.Encrypt(classification.Id.ToString()), message = MessageCode.modified, code = StatusCode.modified, content= model.Name });
             }
             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, content = model.Name });
     }
 }
 public ActionResult New()
 {
     ClassificationModel model = new ClassificationModel();
     model.SubProcessList = this.service.GetSubProcessList(0);
     return View(model);
 }
        public ActionResult Manage(int id)
        {
            try
            {
                ClassificationModel model = new ClassificationModel();
                Classification classification = this.classificationService.GetDataById(id);

                model.Id = classification.Id;
                model.Active = classification.Active;
                model.Code = classification.Code;
                model.Name = classification.Name;
                model.Description = classification.Description;
                model.DateCreated = classification.DateCreated;
                model.CreatedBy = classification.CreatedBy;
                model.SubProcessId = classification.SubProcess.Id;
                model.SubProcessList = this.service.GetSubProcessList(classification.SubProcess.Id);
                if (model != null)
                    return View(model);
            }
            catch (Exception)
            {

            }
            return RedirectToAction("Index");
        }