Esempio n. 1
0
        public ActionResult ProcessAppointment(int?id)
        {
            if (string.IsNullOrEmpty(Convert.ToString(Session["UserName"])))
            {
                return(RedirectToAction("Login", "Home"));
            }
            List <PatientAppointmentReportMV> detaillist = new List <PatientAppointmentReportMV>();

            var appoint     = db.LabAppointTables.Find(id);
            var testdetails = db.LabTestDetailsTables.Where(p => p.LabTestID == appoint.LabTestID);

            foreach (var item in testdetails)
            {
                var detail = new PatientAppointmentReportMV()
                {
                    DetailName      = item.Name,
                    LabAppointID    = appoint.LabAppointID,
                    LabTestDetailID = item.LabTestDetailID,
                    MaxValue        = item.MaxValue,
                    MinValue        = item.MinValue,
                    PatientValue    = 0
                };
                detaillist.Add(detail);
            }
            ViewBag.TestName = appoint.LabTestTable.Name;
            return(View(detaillist));
        }
Esempio n. 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 <PatientAppointmentReportMV> detaillist = new List <PatientAppointmentReportMV>();
            bool issubmit = false;

            for (int i = 0; i < LabTestDetailID.Length; i++)
            {
                var detail = new PatientAppointmentReportMV()
                {
                    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 (detail.PatientValue > 0)
                {
                    issubmit = true;
                }
                detaillist.Add(detail);
            }

            if (issubmit == true)
            {
                foreach (var item in detaillist)
                {
                    var ptintdetails = new PatientTestDetailTable()
                    {
                        LabAppointID    = item.LabAppointID,
                        LabTestDetailID = item.LabTestDetailID,
                        PatientValue    = item.PatientValue
                    };
                    db.PatientTestDetailTables.Add(ptintdetails);
                    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("PendingAppointment"));
            }
            else
            {
                ViewBag.Message = "Enter Patient Test details";
            }
            return(View(detaillist));
        }