// GET: FollowClass1/Details/5 public ActionResult Details(int?id) { ViewBag.user = Session["uns"]; ViewBag.role = Session["rol"]; string user = ViewBag.user; string role = ViewBag.role; if ((Session["uns"] == null) || (Session["rol"].ToString() == "Admin") || (Session["rol"].ToString() == "Nurse") || (Session["rol"].ToString() == "Consultant")) { return(RedirectToAction("LoginPage", "LogClass1")); } else { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } FollowClass1 followClass1 = db.FollowClass1s.Find(id); if (followClass1 == null) { return(HttpNotFound()); } return(View(followClass1)); } }
public ActionResult DeleteConfirmed(int id) { FollowClass1 followClass1 = db.FollowClass1s.Find(id); db.FollowClass1s.Remove(followClass1); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create([Bind(Include = "fid,PatientId,pname,Appointment,AppointmentTime,DOB,Gender,Status,cname")] FollowClass1 followClass1) { try { if (ModelState.IsValid) { db.FollowClass1s.Add(followClass1); db.SaveChanges(); return(RedirectToAction("Index")); } } catch (Exception e1) { ViewBag.err2 = e1.Message.ToString(); } return(View(followClass1)); }
public ActionResult Edit([Bind(Include = "bid,PatientId,pname,Appointment,AppointmentTime,DOB,Gender,Prescription,Amount,Lab_Amount,Total_Amount,Vat,Net_Amount,Status,cname")] BillClass1 billClass1) { try { object o17 = billClass1.Status; string oo17 = o17.ToString(); if (ModelState.IsValid) { if (oo17 == "Bill_Inbox") { db.Entry(billClass1).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } else { FollowClass1 fc1 = new FollowClass1(); fc1.PatientId = billClass1.PatientId; fc1.pname = billClass1.pname; //fc1.Appointment = ""; //fc1.AppointmentTime = ""; fc1.DOB = billClass1.DOB; fc1.Gender = billClass1.Gender; fc1.cname = billClass1.cname; db2.FollowClass1s.Add(fc1); db2.SaveChanges(); //data send to followsup db.Entry(billClass1).State = EntityState.Modified; db.SaveChanges(); // update to bills //return RedirectToAction("Index"); return(Redirect("~/WebForm1.aspx?BillNo=" + billClass1.bid)); } } } catch (Exception e1) { ViewBag.err2 = e1.Message.ToString(); } return(View(billClass1)); //if (ModelState.IsValid) //{ // db.Entry(billClass1).State = EntityState.Modified; // db.SaveChanges(); // return RedirectToAction("Index"); //} //return View(billClass1); }
public ActionResult Edit([Bind(Include = "fid,PatientId,pname,Appointment,AppointmentTime,DOB,Gender,Status,cname")] FollowClass1 followClass1) { // try // { object o17 = followClass1.Status; string oo17 = o17.ToString(); if (ModelState.IsValid) { if (oo17 == "Followup_Inbox") { db.Entry(followClass1).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } else { SecClass1 sc1 = new SecClass1(); //int PatientIdx = db2.SecClass1s.Max(u => u.PatientId); sc1.PatientId = followClass1.PatientId; sc1.pname = followClass1.pname; sc1.Appointment = followClass1.Appointment; sc1.AppointmentTime = Convert.ToDateTime(followClass1.AppointmentTime); sc1.DOB = followClass1.DOB; if (followClass1.Gender == "Male") { sc1.Gender = Gender.Male; } if (followClass1.Gender == "Female") { sc1.Gender = Gender.Female; } object o8 = followClass1.cname; string oo8 = o8.ToString(); string sc = (from s in db1.Consultants where s.cname == oo8 select s.cid).First().ToString(); sc1.cid = Convert.ToInt32(sc); string surname = (from s1 in db2.SecClass1s where s1.PatientId == followClass1.PatientId select s1.SurName).First().ToString(); sc1.SurName = surname.ToString(); string religion = (from s1 in db2.SecClass1s where s1.PatientId == followClass1.PatientId select s1.Religion).First().ToString(); if (religion == "Christian") { sc1.Religion = Religion.Christian; } if (religion == "Hindu") { sc1.Religion = Religion.Hindu; } if (religion == "Muslim") { sc1.Religion = Religion.Muslim; } string ethinic = (from s1 in db2.SecClass1s where s1.PatientId == followClass1.PatientId select s1.EthnicOrigin).First().ToString(); if (ethinic == "African") { sc1.EthnicOrigin = EthiniOrigin.African; } if (ethinic == "Asian") { sc1.EthnicOrigin = EthiniOrigin.Asian; } if (ethinic == "European") { sc1.EthnicOrigin = EthiniOrigin.European; } if (ethinic == "Indian") { sc1.EthnicOrigin = EthiniOrigin.Indian; } string marital = (from s1 in db2.SecClass1s where s1.PatientId == followClass1.PatientId select s1.Maritalstatus).First().ToString(); if (marital == "Divorce") { sc1.Maritalstatus = Marital.Divorce; } if (marital == "Married") { sc1.Maritalstatus = Marital.Married; } if (marital == "Single") { sc1.Maritalstatus = Marital.Single; } if (marital == "Widow") { sc1.Maritalstatus = Marital.Widow; } string mobile = (from s1 in db2.SecClass1s where s1.PatientId == followClass1.PatientId select s1.ContactNumber).First().ToString(); sc1.ContactNumber = mobile.ToString(); db2.SecClass1s.Add(sc1); db2.SaveChanges(); //data send to secretary db.Entry(followClass1).State = EntityState.Modified; db.SaveChanges(); // update to followup return(RedirectToAction("Index")); } } //} //catch (Exception e1) { ViewBag.err2 = e1.Message.ToString(); } return(View(followClass1)); //if (ModelState.IsValid) //{ // db.Entry(followClass1).State = EntityState.Modified; // db.SaveChanges(); // return RedirectToAction("Index"); //} //return View(followClass1); }