Beispiel #1
0
        public void Create(ComplaintActivity model)
        {
            try
            {
                _context.ComplaintActivities.Add(model);
                _context.SaveChanges();
            }
            catch (System.Data.Entity.Core.UpdateException e)
            {
            }

            catch (System.Data.Entity.Infrastructure.DbUpdateException ex) //DbContext
            {
                Console.WriteLine(ex.InnerException);
            }

            catch (Exception ex)
            {
                Console.WriteLine(ex.InnerException);
                throw;
            }
            //    catch (Exception e)
            //    {
            //        throw;
            //    }
        }
Beispiel #2
0
        public ActionResult AddSolution(int id)
        {
            var obj = new ComplaintActivity();

            obj.ComplaintId = id;
            //ViewBag.SolutionType = _slnType.GetAll();
            ViewBag.SolutionStatus = _slnStatus.GetAll();
            ViewBag.Complaint      = _vComplaint.GetComplaint(id);
            return(PartialView(obj));
        }
Beispiel #3
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 }));
         }
     }
 }