public ActionResult ExistingSR(ExistingSR esr) { ViewData["Status"] = getStatus(); try { string MID = System.Web.HttpContext.Current.Session["id"].ToString(); string Role = System.Web.HttpContext.Current.Session["Role"].ToString(); ViewBag.ExistingSR = findExistingSR(esr, Role, MID); } catch (Exception e) { Log.CreateLog(e); } return(View()); }
public IEnumerable <object> findExistingSR(ExistingSR esr, string Role, string MID) { string ServiceRequest_ID = esr.SR_Number; int? SRID; if (ServiceRequest_ID == null) { SRID = null; } else { SRID = Convert.ToInt32(ServiceRequest_ID.TrimStart('S', 'R', '0')); } DateTime?FromDate; if (esr.SR_Ticket_From == DateTime.MinValue) { FromDate = null; } else { FromDate = esr.SR_Ticket_From; } DateTime?TillDate; if (esr.SR_Ticket_To == DateTime.MinValue) { TillDate = null; } else { TillDate = esr.SR_Ticket_To; } int?Status = 0; if (esr.Status == 0) { Status = null; } else { Status = esr.Status; } SRNumber assetObj = new SRNumber(); return(assetObj.findExistingSR(SRID, FromDate, TillDate, Status, Role, MID)); }