Example #1
0
        public IActionResult Lab(LabVM bd, string Payment, string offlinepay)
        {
            int Patient_Reg_Id = (int)HttpContext.Session.GetInt32("User_Reg_Id");
            int Patient_Id     = _HDB.Patients.Where(f => f.Registration_Id == Patient_Reg_Id).Select(h => h.Id).SingleOrDefault();
            int sp_Id          = (int)HttpContext.Session.GetInt32("Sp_Id");

            int     staff_id = _HDB.Staff.Where(w => w.Specialization_Id == sp_Id).Select(e => e.Id).SingleOrDefault();
            Patient p;

            p = _HDB.Patients.FirstOrDefault(s => s.Id == Patient_Id);
            p.Medical_Record = bd.MedicalRecord;
            _HDB.Update(p);
            _HDB.SaveChanges();
            Follow_Up fup = new Follow_Up();

            fup.Patient_Id = Patient_Id;
            fup.Status     = "Pending";
            fup.Staff_Id   = staff_id;
            _HDB.Add(fup);
            _HDB.SaveChanges();

            Follow_Up_History fuph = new Follow_Up_History();

            fuph.Date = bd.Date + "T" + bd.Hour;
            fuph.Follow_Up_Type_Id = bd.Id;            ////Done
            fuph.Follow_Up_Id      = fup.Id;

            _HDB.Add(fuph);
            _HDB.SaveChanges();
            ViewBag.message = "Your Time has been recorded";
            HttpContext.Session.SetInt32("choose_test", (int)bd.Id);
            // bool ofon = _HDB.Payments.Where(o => o.Patient_Id == Patient_Id).Select(i => i.Online).FirstOrDefault();
            if (Payment == "PayOnline")
            {
                return(RedirectToAction("Payment", "Patient"));
            }
            else //if (offlinepay == "offlinepay")
            {
                return(RedirectToAction("offlinepay", "Patient"));
            }
        }
Example #2
0
        public IActionResult Doctor(DoctorVM doc, string Payment, string offlinepay)
        {
            int Patient_Reg_Id = (int)HttpContext.Session.GetInt32("User_Reg_Id");
            int Patient_Id     = _HDB.Patients.Where(f => f.Registration_Id == Patient_Reg_Id).Select(h => h.Id).SingleOrDefault();

            Patient p;

            p = _HDB.Patients.FirstOrDefault(s => s.Id == Patient_Id);
            p.Medical_Record = doc.MedicalRecord;
            _HDB.Update(p);
            _HDB.SaveChanges();

            Follow_Up fup = new Follow_Up();

            fup.Patient_Id = Patient_Id;
            fup.Staff_Id   = doc.Id;
            fup.Status     = "Pending";

            _HDB.Add(fup);
            _HDB.SaveChanges();

            Follow_Up_History fuph = new Follow_Up_History();

            fuph.Date = doc.Date + "T" + doc.Hour;
            fuph.Follow_Up_Type_Id = 2;
            fuph.Follow_Up_Id      = fup.Id;

            _HDB.Add(fuph);
            _HDB.SaveChanges();
            ViewBag.message = "Your Time has been recorded";
            HttpContext.Session.SetInt32("choose_test", 2);

            if (Payment == "PayOnline")
            {
                return(RedirectToAction("Payment", "Patient"));
            }
            else //if (offlinepay == "offlinepay")
            {
                return(RedirectToAction("offlinepay", "Patient"));
            }
        }