Esempio n. 1
0
        public ActionResult LabAppointment(LabAppointTable appointment)
        {
            if (string.IsNullOrEmpty(Convert.ToString(Session["UserName"])))
            {
                return(RedirectToAction("Login", "Home"));
            }

            appointment.IsComplete  = false;
            appointment.IsFeeSubmit = false;

            if (ModelState.IsValid)
            {
                var checktransection = db.LabAppointTables.Where(c => c.TransectionNo == appointment.TransectionNo).FirstOrDefault();
                if (checktransection == null)
                {
                    var find = db.LabAppointTables.Where(p => p.LabTimeSlotID == appointment.LabTimeSlotID && p.LabID == appointment.LabID && p.AppointDate == appointment.AppointDate).FirstOrDefault();
                    if (find == null)
                    {
                        db.LabAppointTables.Add(appointment);
                        db.SaveChanges();
                        ViewBag.Message = "Appointment Submited Success ";
                    }
                    else
                    {
                        ViewBag.Message = "Time Slot Is Already Assign ";
                    }
                }
                else
                {
                    ViewBag.Message = "Transection No Is Already Used . ";
                }
            }
            ViewBag.LabTimeSlotID = new SelectList(db.LabTimeSlotTables.Where(d => d.LabID == appointment.LabID && d.IsActive == true), "LabTimeSlotID", "Name", "0");
            return(View(appointment));
        }
Esempio n. 2
0
 public ActionResult ChangeStatus(LabAppointTable app)
 {
     if (string.IsNullOrEmpty(Convert.ToString(Session["UserName"])))
     {
         return(RedirectToAction("Login", "Home"));
     }
     if (ModelState.IsValid)
     {
         db.Entry(app).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("PendingAppointment"));
     }
     ViewBag.LabTimeSlotID = new SelectList(db.LabTimeSlotTables.Where(d => d.LabID == app.LabID), "LabTimeSlotID", "Name", app.LabTimeSlotID);
     return(View(app));
 }
Esempio n. 3
0
        public ActionResult LabAppointment(int?id)
        {
            if (string.IsNullOrEmpty(Convert.ToString(Session["UserName"])))
            {
                return(RedirectToAction("Login", "Home"));
            }

            int labid   = db.LabTestTables.Find(id).LabID;
            var patient = (PatientTable)Session["Patient"];

            var appointment = new LabAppointTable()
            {
                LabID     = labid,
                LabTestID = (int)id,
                PatientID = patient.PatientID
            };

            ViewBag.LabTestID     = new SelectList(db.LabTestTables.Where(d => d.LabID == id), "LabTimeSlotID", "Name", "0");
            ViewBag.LabTimeSlotID = new SelectList(db.LabTimeSlotTables.Where(d => d.LabID == id && d.IsActive == true), "LabTimeSlotID", "Name", "0");

            return(View(appointment));
        }