public ActionResult GetResultData() { var dc = new PinereDataContext(PinereConstant.PinereConnectionString); List <SearchResult> ResultList = new List <SearchResult>(); try { var Result = (from a in dc.GetPasienListForRS(0) select a); Result = Result.OrderByDescending(o => o.KKPId); ResultList = (from a in Result select new SearchResult { NamaAirline = a.NamaAirline, NomorPenerbangan = a.NomorPenerbangan, NamaPasien = a.NamaPasien, TanggalLahir = DataRepository.GetDateStringFromDate(a.TanggalLahir), HasilDiagnosa = a.Diagnosa, RujukRS = a.Rujuk_RS_Dis, RSFlag = a.RS_Flag.ToString(), HasilLab = a.Hasil_Lab, ActionEdit = Url.Action("View", new { @KKPId = a.KKPId }) }).ToList(); } catch (Exception e) { throw new Exception(e.Message); } return(Json(new { iTotalRecords = ResultList.Count(), iTotalDisplayRecords = ResultList.Count(), aaData = ResultList }, JsonRequestBehavior.AllowGet)); }
public ActionResult GetResultData() { string responsibleId = string.Empty; string responsibleName = string.Empty; using (var dca = new PinereDataContext(PinereConstant.PinereConnectionString)) { var resp = dca.GetResponsibleByUserName(User.Identity.Name, "rs").SingleOrDefault(); if (!User.IsInRole("admin")) { if (resp != null) { responsibleId = resp.Id.Value.ToString(); responsibleName = resp.Name; } } } var dc = new PinereDataContext(PinereConstant.PinereConnectionString); List <SearchResult> ResultList = new List <SearchResult>(); try { var Result = (from a in dc.GetPasienListForRS(int.Parse(responsibleId)) select a); Result = Result.OrderByDescending(o => o.KKPId); ResultList = (from a in Result select new SearchResult { NamaAirline = a.NamaAirline, NomorPenerbangan = a.NomorPenerbangan, NamaPasien = a.NamaPasien, TanggalLahir = DataRepository.GetDateStringFromDate(a.TanggalLahir), HasilDiagnosa = a.Diagnosa, RujukRS = a.Rujuk_RS_Dis, RSFlag = a.RS_Flag.ToString(), NamaRS = a.NamaRS, ActionEdit = Url.Action("Input", new { @KKPId = a.KKPId }) }).ToList(); } catch (Exception e) { throw new Exception(e.Message); } return(Json(new { iTotalRecords = ResultList.Count(), iTotalDisplayRecords = ResultList.Count(), aaData = ResultList }, JsonRequestBehavior.AllowGet)); }