예제 #1
0
        public ActionResult Profile(string message)
        {
            ViewBag.PatientProfile = "active";
            ViewBag.UpdateMessage  = message;
            int pid = (int)Session["PatientId"];

            List <DoctorAppointmentView> ProfileList = new List <DoctorAppointmentView>();
            Patient p = new Patient();

            using (var ctx = new HospitalContext())
            {
                List <Appointment> lap = (from a in ctx.Appointment
                                          where a.PatientId == pid && a.IsSeen == 2
                                          select a).ToList();
                foreach (Appointment q in lap)
                {
                    q.IsSeen = 1;
                }
                ctx.SaveChanges();

                Session["PatientNotify"] = 0;

                var data = (from a in ctx.Appointment
                            join d in ctx.Doctor on a.DoctorId equals d.Id
                            where a.PatientId == pid
                            select new
                {
                    aDate = a.Date,
                    aApproval = a.Approval,
                    aName = d.Name,
                    aPrescription = a.Prescription,
                    aDesignation = d.Designation,
                    aSerial = a.SerialNo
                });
                foreach (var d in data)
                {
                    DoctorAppointmentView dc = new DoctorAppointmentView();
                    dc.Name         = baseControl.Decrypt(d.aName);
                    dc.Designation  = baseControl.Decrypt(d.aDesignation);
                    dc.Approval     = d.aApproval;
                    dc.Date         = d.aDate;
                    dc.Prescription = d.aPrescription;
                    dc.Serial       = d.aSerial;
                    ProfileList.Add(dc);
                }
                // int id = Convert.ToInt32(Session["PatientId"]);
                var k = ctx.Patient.Where(e => e.Id == pid).Select(c => new { c.Name, c.Age, c.Address, c.PhoneNo });
                foreach (var i in k)
                {
                    p.Name    = baseControl.Decrypt(i.Name);
                    p.Address = baseControl.Decrypt(i.Address);
                    p.Age     = i.Age;
                    p.PhoneNo = baseControl.Decrypt(i.PhoneNo);
                }
                ViewBag.Patient = p;
            }
            return(View(ProfileList));
        }
예제 #2
0
        public ActionResult Information()
        {
            ViewBag.Information = "active";
            int id = Convert.ToInt32(Session["PatientId"]);
            List <DoctorAppointmentView> appointmentList = new List <DoctorAppointmentView>();

            using (var db = new MedicalContext())
            {
                List <PatientAppointmentModel> lappoint = (from a in db.Appointment
                                                           where a.PatientId == id && a.Accepted == 3
                                                           select a).ToList();
                foreach (PatientAppointmentModel p in lappoint)
                {
                    p.Accepted = 1;
                }
                db.SaveChanges();

                Session["PatientNotification"] = 0;



                var q = (from ab in db.Doctors
                         join p in db.Specialist on ab.SpecialistId equals p.Id

                         join a in db.Appointment on ab.Id equals a.DoctorId
                         where a.DoctorId == ab.Id && a.PatientId == id
                         select new
                {
                    appointmentDate = a.Date,
                    appointmentName = ab.Name,
                    appointmentSpecialist = p.Specialist,
                    appointmentPrescription = a.Prescription
                });
                foreach (var d in q)
                {
                    DoctorAppointmentView ap = new DoctorAppointmentView();
                    ap.DoctorName   = privacy.Decrypt(d.appointmentName);
                    ap.Date         = d.appointmentDate;
                    ap.Specialist   = d.appointmentSpecialist;
                    ap.Prescription = d.appointmentPrescription;

                    appointmentList.Add(ap);
                }
            }
            return(View(appointmentList));
        }