Exemplo n.º 1
0
        public JsonResult HoverResult()
        {
            int pid = (int)Session["PatientId"];
            List <PatientAppointmentView> patient = new List <PatientAppointmentView>();

            using (var ctx = new HospitalContext())
            {
                var k = from a in ctx.Appointment
                        join d in ctx.Doctor on a.DoctorId equals d.Id
                        where a.PatientId == pid && a.IsSeen == 2
                        select new
                {
                    DName = d.Name,
                    Appr  = a.Approval,
                };
                foreach (var d in k)
                {
                    PatientAppointmentView pp = new PatientAppointmentView();
                    pp.Name     = baseControl.Decrypt(d.DName);
                    pp.Approval = d.Appr;
                    patient.Add(pp);
                }
            }
            return(Json(patient));
        }
Exemplo n.º 2
0
        public JsonResult GetAppointments(int session, int docId, string date)
        {
            List <PatientAppointmentView> pt = new List <PatientAppointmentView>();

            using (var ctx = new HospitalContext())
            {
                var data = (from a in ctx.Appointment
                            join p in ctx.Patient on a.PatientId equals p.Id
                            where a.DoctorId == docId && a.Date == date && a.Session == session && a.Approval < 3
                            select new
                {
                    pId = a.Id,
                    pName = p.Name,
                    pAddress = p.Address,
                    pPhone = p.PhoneNo,
                    pApprove = a.Approval,
                    pNote = a.Note
                });
                foreach (var dc in data)
                {
                    PatientAppointmentView p = new PatientAppointmentView();
                    p.AppointmentId = dc.pId;
                    p.Name          = baseControl.Decrypt(dc.pName);
                    p.Address       = baseControl.Decrypt(dc.pAddress);
                    p.PhoneNo       = baseControl.Decrypt(dc.pPhone);
                    p.Approval      = dc.pApprove;
                    p.Note          = baseControl.Decrypt(dc.pNote);
                    pt.Add(p);
                }
            }
            return(Json(pt));
        }
Exemplo n.º 3
0
        public JsonResult GetPatient(int id)
        {
            List <PatientAppointmentView> pt = new List <PatientAppointmentView>();
            int    doc  = (int)Session["DoctorId"];
            string date = DateTime.Today.ToString("MM/dd/yyyy");

            using (var ctx = new HospitalContext())
            {
                var data = from a in ctx.Appointment
                           join p in ctx.Patient
                           on a.PatientId equals p.Id
                           where a.DoctorId == doc && a.Session == id && a.Approval == 1 && a.Date == date
                           orderby a.SerialNo ascending
                           select new
                {
                    pId   = a.Id,
                    pName = p.Name,
                    pAge  = p.Age,
                    pNote = a.Note
                };
                foreach (var dc in data)
                {
                    PatientAppointmentView p = new PatientAppointmentView();
                    p.AppointmentId = dc.pId;
                    p.Name          = baseControl.Decrypt(dc.pName);
                    p.Age           = dc.pAge;
                    p.Note          = baseControl.Decrypt(dc.pNote);
                    pt.Add(p);
                }
            }
            return(Json(pt));
        }