Пример #1
0
        public ActionResult ProcessAppointment(int?id)
        {
            if (string.IsNullOrEmpty(Convert.ToString(Session["UserName"])))
            {
                return(RedirectToAction("Login", "Home"));
            }
            List <PatientAppointmentMV> detaillist = new List <PatientAppointmentMV>();
            var appoint     = db.LabAppointTables.Find(id);
            var testdetails = db.LabTestDetailsTables.Where(p => p.LabTestID == appoint.LabTestID);

            foreach (var item in testdetails)
            {
                var details = new PatientAppointmentMV()
                {
                    DetailName      = item.Name,
                    LabAppointID    = appoint.LabAppointID,
                    LabTestDetailID = item.LabTestDetailID,
                    MaxValue        = item.MaxValue,
                    MinValue        = item.MinValue,
                    PatientValue    = 0
                };
                detaillist.Add(details);
            }
            ViewBag.TestName = appoint.LabTestTable.Name;

            return(View(detaillist));
        }
Пример #2
0
        public ActionResult ProcessAppointment(FormCollection collection)
        {
            if (string.IsNullOrEmpty(Convert.ToString(Session["UserName"])))
            {
                return(RedirectToAction("Login", "Home"));
            }
            string[] LabTestDetailID = collection["item.LabTestDetailID"].Split(',');
            string[] LabAppointID    = collection["item.LabAppointID"].Split(',');
            string[] DetailName      = collection["item.DetailName"].Split(',');
            string[] MinValue        = collection["item.MinValue"].Split(',');
            string[] MaxValue        = collection["item.MaxValue"].Split(',');
            string[] PatientValue    = collection["item.PatientValue"].Split(',');
            List <PatientAppointmentMV> detaillist = new List <PatientAppointmentMV>();

            bool issubmit = false;

            for (int i = 0; i < LabTestDetailID.Length; i++)
            {
                var details = new PatientAppointmentMV()
                {
                    DetailName      = DetailName[i],
                    LabAppointID    = Convert.ToInt32(LabAppointID[i]),
                    LabTestDetailID = Convert.ToInt32(LabTestDetailID[i]),
                    MaxValue        = Convert.ToInt32(MaxValue[i]),
                    MinValue        = Convert.ToInt32(MinValue[i]),
                    PatientValue    = Convert.ToInt32(PatientValue[i])
                };
                if (details.PatientValue > 0)
                {
                    issubmit = true;
                }
                detaillist.Add(details);
            }
            if (issubmit == true)
            {
                foreach (var item in detaillist)
                {
                    var pdetails = new PatientTestDetailTable()
                    {
                        LabAppointID    = item.LabAppointID,
                        LabTestDetailID = item.LabTestDetailID,
                        PatientValue    = item.PatientValue
                    };
                    db.PatientTestDetailTables.Add(pdetails);
                    db.SaveChanges();
                }
                int appointid = Convert.ToInt32(LabAppointID[0]);
                var appoint   = db.LabAppointTables.Find(appointid);
                appoint.IsComplete      = true;
                db.Entry(appoint).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("PendingAppoint"));
            }
            else
            {
                ViewBag.Message = "Please Enter Patient Test Details";
            }
            return(View(detaillist));
        }