public ActionResult TestReport() { List <RadiologyTestReport> CategoryList = new List <RadiologyTestReport>(); Property p = new Property(); DataSet ds = new DataSet(); p.OnTable = "FetchRadiologyTest"; ds = dl.FetchRadiologyReport_sp(p); try { foreach (DataRow item in ds.Tables[2].Rows) { RadiologyTestReport m = new RadiologyTestReport(); m.BillId = item["BillId"].ToString(); m.PatientId = item["PatientId"].ToString(); m.Name = item["Name"].ToString(); m.EmployeeId = item["EmployeeId"].ToString(); m.FullName = item["FullName"].ToString(); m.ReportingDate = item["ReportingDate"].ToString(); m.Description = item["Description"].ToString(); m.Attachment = item["Attachment"].ToString(); m.AppliedCharge = item["AppliedCharge"].ToString(); CategoryList.Add(m); } ViewBag.CategoryList = CategoryList; } catch (Exception ex) { } return(View()); }
public ActionResult PatientTestReport(RadiologyTestReport p, List <HttpPostedFileBase> Attachment) { string fileLocation = ""; string ItemUploadFolderPath = "~/DataImages/"; try { try { if (Attachment.Count > 0) { foreach (HttpPostedFileBase file in Attachment) { try { if (file.ContentLength == 0) { continue; } if (file.ContentLength > 0) { fileLocation = HelperFunctions.renameUploadFile(file, ItemUploadFolderPath); if (fileLocation == "") { fileLocation = ""; } } } catch (Exception ex) { } if (fileLocation == "" || fileLocation == null) { p.Attachment = p.Attachment; } else { p.Attachment = fileLocation; } } } } catch (Exception ex) { } } catch (Exception ex) { } try { if (dl.InsertRadiologyTestReport_Sp(p) > 0) { TempData["MSG"] = "Data Saved Successfully."; } } catch (Exception ex) { TempData["MSG"] = "Something went wrong."; return(Redirect("/Radiology/RadiologyTest")); } TempData["MSG"] = "Data Saved Successfully."; return(Redirect("/Radiology/RadiologyTest")); }