Пример #1
0
 public ActionResult AddSolution(ComplaintActivity model)
 {
     using (var cmd = new TransactionScope())
     {
         try
         {
             if (ModelState.IsValid)
             {
                 var user = _user.GetUser(User.Identity.Name);
                 model.Date       = DateTime.Now;
                 model.RecordedBy = user.UserId;
                 //model.ResolvedBy = user.UserId;
                 //model.ResolvedDate = DateTime.Now;
                 _complaintActivity.Create(model);
                 int statusId;
                 //var compObj = _vComplaint.GetComplaint(model.ComplaintId);
                 var soln = _slnStatus.GetRecordById(model.SolutionStatusId);
                 if (soln.Name.ToUpper() == "RESOLVED FULLY")
                 {
                     statusId = 4;
                 }
                 else
                 {
                     if (soln.Name.ToUpper() == "REQUIRED TECHNICAL SKILL")
                     {
                         statusId = 3;
                     }
                     else
                     {
                         statusId = 2;
                     }
                 }
                 _complaint.UpdateStatus(model.SolutionStatusId, model.ComplaintId, statusId);
                 cmd.Complete();
                 TempData["Msg"] = _help.getMsg(AlertType.success.ToString(), "Resolution added successfully!");
                 return(RedirectToAction("Index"));
             }
             else
             {
                 cmd.Dispose();
                 return(Json(new { IsAuthenticated = true, IsSuccessful = false, Error = "Please fill the form correctly!" }));
             }
         }
         catch (Exception ex)
         {
             cmd.Dispose();
             return(Json(new { IsAuthenticated = true, IsSuccessful = false, Error = ex.Message }));
         }
     }
 }