public ActionResult EditComplaintTracker(int Id) { viewComplaintTracker complaint; if (Id != 0) { complaint = CMSService.GetComplaintTracker(Id); complaint.ListContracts = CMSService.ListOfContracts(username).ToList(); //if (User.IsInRole("CMS_IDOAStaff")) //{ // complaint.AgencyTypeDescription = "IDoA Staff"; //} //else if (User.IsInRole("CMS_RAAAdmin")) //{ // var psa = CMSService.GetPSAByUserName(username); // complaint.AgencyTypeDescription = psa.AreaName; // complaint.ContractId = psa.Id; //} //else if (User.IsInRole("CMS_Supervisor")) //{ // complaint.ListContracts = CMSService.ListOfContracts(username).ToList(); // if (complaint.ListContracts.Count == 1) // { // complaint.AgencyTypeDescription = complaint.ListContracts.FirstOrDefault().ContractName; // complaint.ContractId = complaint.ListContracts.FirstOrDefault().Id; // } //} } else { complaint = new viewComplaintTracker(); if (User.IsInRole("CMS_IDOAStaff")) { complaint.AgencyTypeDescription = "IDoA Staff"; } else if (User.IsInRole("CMS_RAAAdmin")) { var psa = CMSService.GetPSAByUserName(username); complaint.AgencyTypeDescription = psa.AreaName; complaint.ContractId = psa.Id; } else if (User.IsInRole("CMS_Supervisor")) { complaint.ListContracts = CMSService.ListOfContracts(username).ToList(); if (complaint.ListContracts.Count == 1) { complaint.AgencyTypeDescription = complaint.ListContracts.FirstOrDefault().ContractName; complaint.ContractId = complaint.ListContracts.FirstOrDefault().Id; } } complaint.UserCreated = username; } return(View(complaint)); }
public ActionResult SubmitComplaintTracker(viewComplaintTracker complaint) { complaint.UserCreated = username; complaint.UserUpdated = username; complaint.StatusId = 24; complaint.Id = CMSService.SaveComplaintTracker(complaint); var redirectUrl = new UrlHelper(Request.RequestContext).Action("ListComplaintTrackers", "QualityAssurance"); return(Json(redirectUrl, JsonRequestBehavior.AllowGet)); }
public ActionResult SaveComplaintTracker(viewComplaintTracker complaint) { complaint.UserCreated = username; complaint.UserUpdated = username; if (complaint.StatusId == null) { complaint.StatusId = 3; } complaint.Id = CMSService.SaveComplaintTracker(complaint); return(RedirectToAction("ListComplaintTrackers", "QualityAssurance")); }
public ActionResult ListComplaintTrackers() { viewComplaintTracker viewtracker = new viewComplaintTracker(); if (User.IsInRole("CMS_IDOAStaff")) { viewtracker.ListComplaintTracker = CMSService.ListComplaintTracker().ToList(); } else if (User.IsInRole("CMS_RAAAdmin")) { //int UserPSAId = 0; //var userpsa = new APS.Data.Entities.viewPSA(); var userpsa = APSCaseService.ListOfPSAsByUserName(username).FirstOrDefault(); //viewtracker.ListComplaintTracker = CMSService.ListComplaintTracker().Where(i => userpsa.ListOfContracts.Any(s => s.Id == i.ContractId)).ToList(); viewtracker.ListComplaintTracker = CMSService.ListComplaintTracker().Where(i => userpsa.Id == i.ContractId || userpsa.ListOfContracts.Any(s => s.Id == i.ContractId)).ToList(); } else if (User.IsInRole("CMS_Supervisor")) { viewtracker.ListComplaintTracker = CMSService.ListComplaintTracker().Where(i => (i.ContractId != null && i.ContractId != 0) && contractids.Contains((int)i.ContractId)).ToList(); } return(View(viewtracker)); }