public ActionResult Create(SLAViewModel ViewSLA) { CS_SLA sla = new CS_SLA(); int count = 0; // All priority from priority table var priority = _objPriority.GetAll(); foreach (var item in priority) { sla.CreatedOn = DateTime.Now; sla.LastModified = DateTime.Now; sla.MaximumResponseTime = 0; sla.MaximumResolveTime = 0; sla.PriorityName = item.Name; sla.ProjectId = ViewSLA.ProjId; sla.PriorityLevel = item.PriorityLevel; sla.Description = item.Description; sla.EscalationTime = 0; sla.IsActive = true; if (count == 0) { sla.IsDefault = true; count++; } else { sla.IsDefault = false; } _objSla.Insert(sla); } return(RedirectToAction(ActionName.FMSSLAEdit, ControllerName.FMSSLA, new { id = ViewSLA.ProjId })); }
public JsonResult SLASave(int slaId, int prjid, int pl, string pn, string res, string resolved, string escalation, bool isdefault, bool Isactive, string description) { int a = 0; if (isdefaultsExist(prjid, isdefault, slaId)) { a = 1; } else if (isPriorityNmExist(prjid, slaId, pn)) { a = 2; } else if (isLevelExist(prjid, slaId, pl)) { a = 3; } else if (IsValidTime(res)) { a = 4; } else if (IsValidTime(resolved)) { a = 5; } else if (IsValidTime(escalation)) { a = 6; } else { CS_SLA sla = new CS_SLA(); sla.LastModified = DateTime.Today; sla.MaximumResponseTime = Utility.StringToMinute(res); sla.MaximumResolveTime = Utility.StringToMinute(resolved); sla.EscalationTime = Utility.StringToMinute(escalation); sla.PriorityName = pn; sla.IsDefault = isdefault; sla.Description = description; sla.ProjectId = prjid; sla.IsActive = Isactive; sla.PriorityLevel = Convert.ToByte(pl); if (slaId == 0) { sla.CreatedOn = DateTime.Now; _objSla.Insert(sla); } else { sla.SLAId = slaId; sla.CreatedOn = _dbContext.CS_SLA.Where(w => w.SLAId == slaId).Select(s => s.CreatedOn).SingleOrDefault(); _objSla.Update(sla); } } return(this.Json(a, JsonRequestBehavior.AllowGet)); }
public JsonResult ChnageStatusbyAjax(int id) { CS_SLA Current = _objSla.FindById(id); if (Current.IsActive == true) { Current.IsActive = false; } else { Current.IsActive = true; } _objSla.Update(Current); return(this.Json(true, JsonRequestBehavior.AllowGet)); }