示例#1
0
        public ActionResult ShowAppointment()
        {
            Appoinment_Entities appoinment_Entities_db = new Appoinment_Entities();
            appointmentInfo     appointments           = new appointmentInfo();

            appointments.doctor_Id = Convert.ToInt32(Session["LogedUserID"]);
            var appointment = appoinment_Entities_db.appointmentInfoes.Where(x => x.doctor_Id == appointments.doctor_Id && x.appointment_Status == false).ToList();

            if (appointment.Count != 0)
            {
                return(View(appointment));
            }
            else
            {
                return(View());
            }
        }
示例#2
0
        public ActionResult CreateAppointment(int doctorId, string appointmentTime)
        {
            Appoinment_Entities appoinment_Entities_db = new Appoinment_Entities();
            appointmentInfo     appointment            = new appointmentInfo();

            appointment.patient_Id = Convert.ToInt32(Session["LogedUserID"]);
            var patientAppointment = appoinment_Entities_db.appointmentInfoes.Where(
                i => i.patient_Id == appointment.patient_Id && i.appointment_Status == true).ToList();

            if (patientAppointment.Count == 0)
            {
                userLogin login = new userLogin();
                //appointment.appointment_Id = 1;
                //appointment.appointment_Id = appoinment_Entities_db.appointmentInfoes.Select(c => c.appointment_Id).Count() + 1;
                appointment.doctor_Id = doctorId;

                var doctorName = appoinment_Entities_db.userLogins.Where(
                    i => i.UserID == doctorId).Single().FullName;

                appointment.doctor_Name = doctorName;

                appointment.patient_Name = appoinment_Entities_db.userLogins.Where(
                    i => i.UserID == appointment.patient_Id).Single().FullName;
                DateTime date      = DateTime.Now;
                var      shortDate = date.Date;
                appointment.appointment_Date   = shortDate;
                appointment.appointment_Time   = TimeSpan.Parse(appointmentTime);
                appointment.appointment_Status = false;
                appoinment_Entities_db.appointmentInfoes.Add(appointment);
                appoinment_Entities_db.SaveChanges();
                return(Json("Success", JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json("Fail", JsonRequestBehavior.AllowGet));
            }
        }
示例#3
0
        public ActionResult ShowAppointment(int?patientId, string status)
        {
            Appoinment_Entities appoinment_Entities_db = new Appoinment_Entities();
            appointmentInfo     appointmentInfo        = new appointmentInfo();

            appointmentInfo.doctor_Id = Convert.ToInt32(Session["LogedUserID"]);
            appointmentInfo           = appoinment_Entities_db.appointmentInfoes.Where(x => x.patient_Id == patientId && x.doctor_Id == appointmentInfo.doctor_Id).FirstOrDefault();
            if (appointmentInfo != null)
            {
                if (status == "Confirm")
                {
                    appointmentInfo.appointment_Status = true;
                }
                else
                {
                    appointmentInfo.appointment_Status = false;
                }
                appoinment_Entities_db.appointmentInfoes.Add(appointmentInfo);
                appoinment_Entities_db.Entry(appointmentInfo).State = System.Data.Entity.EntityState.Modified;
                appoinment_Entities_db.SaveChanges();
                return(Json("Success", JsonRequestBehavior.AllowGet));
            }
            return(Json("Fail", JsonRequestBehavior.AllowGet));
        }