public JsonResult AddIPDPatientPhoto(IPDPatient patient) { var profile = Request.Files; string imgname = string.Empty; string ImageName = string.Empty; //Following code will check that image is there //If it will Upload or else it will use Default Image if (System.Web.HttpContext.Current.Request.Files.AllKeys.Any()) { var logo = System.Web.HttpContext.Current.Request.Files["file"]; if (logo.ContentLength > 0) { var profileName = Path.GetFileName(logo.FileName); var ext = Path.GetExtension(logo.FileName); ImageName = profileName; var comPath = Server.MapPath("/DataImages/") + ImageName; logo.SaveAs(comPath); patient.PatientPhoto = comPath; Session["PatientPhoto"] = "~/DataImages/" + profileName; } } else { patient.PatientPhoto = Server.MapPath("/DataImages/") + "patientphoto.jpg"; } int response = 1; return(Json(response, JsonRequestBehavior.AllowGet)); }
public JsonResult IPDPatient(IPDPatient p) { try { p.PatientPhoto = Session["PatientPhoto"].ToString(); if (dl.InsertIpdPatient_Sp(p) > 0) { TempData["MSG"] = "Patient Added Successfully."; } } catch (Exception ex) { TempData["MSG"] = "Something went wrong."; return(Json(new { data = "error" }, JsonRequestBehavior.AllowGet)); } int response = 1; return(Json(response, JsonRequestBehavior.AllowGet)); }
public ActionResult IPDPatient() { List <IPDPatient> PatientList = new List <IPDPatient>(); Property p = new Property(); DataSet ds = new DataSet(); p.OnTable = "FetchIpdPatient"; ds = dl.FetchIpdPatient_sp(p); List <SelectListItem> DoctorList = new List <SelectListItem>(); DoctorList.Add(new SelectListItem { Text = "Select", Value = "" }); foreach (DataRow dr in ds.Tables[1].Rows) { DoctorList.Add(new SelectListItem { Text = dr["FullName"].ToString(), Value = dr["FullName"].ToString() }); } ViewBag.DoctorList = new SelectList(DoctorList, "Value", "Text"); foreach (DataRow item in ds.Tables[0].Rows) { IPDPatient m = new IPDPatient(); m.IPDNo = item["IPDNo"].ToString(); //m.PatientId = item["PatientId"].ToString(); m.Name = item["Name"].ToString(); m.GuardianName = item["GuardianName"].ToString(); m.Phone = item["Phone"].ToString(); m.Gender = item["Gender"].ToString(); m.ConsultantDoctor = item["ConsultantDoctor"].ToString(); PatientList.Add(m); } ViewBag.PatientList = PatientList; return(View()); }