Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            dbcontext.Doctors.Load();
            SQL.Patient me = (from x in dbcontext.Patients
                              where x.Email.Equals(User.Identity.Name)
                              select x).First();

            List <SQL.Message> msgList = (from x in dbcontext.Messages
                                          where x.TO.Equals(User.Identity.Name)
                                          select x).ToList();

            GridView1.DataSource = msgList;
            GridView1.DataBind();

            if (!IsPostBack)
            {
                var result = from x in dbcontext.Doctors.Local
                             select new
                {
                    Name = x.FirstName + ", " + x.LastName,
                    x.Email
                };

                DropDownList1.DataTextField  = "Name";
                DropDownList1.DataValueField = "Email";
                DropDownList1.DataSource     = result;
                DropDownList1.DataBind();
            }
        }
Ejemplo n.º 2
0
        protected void aptGridView_SelectedIndexChanged(object sender, EventArgs e)
        {
            //if (!IsPostBack)
            //{
            SQL.HealthclinicEntities dbcon = new SQL.HealthclinicEntities();

            dbcon.Appointments.Load();

            SQL.Patient patient = (from x in dbcon.Patients
                                   where x.Email.Equals(User.Identity.Name)
                                   select x).First();

            int something = Convert.ToInt32(aptGridView.SelectedDataKey[0]);

            SQL.Appointment apt = (from x in dbcon.Appointments
                                   where x.AppointmentID == something
                                   select x).First();



            SQL.Doctor doc = (from x in dbcon.Doctors
                              where x.DoctorID == apt.DoctorID
                              select x).First();

            var testShite = (from a in dbcon.Appointments
                             select new
            {
                aptID = a.AppointmentID,
                aptPatient = a.PatientID,
                aptDoctor = a.DoctorID,
                aptDate = a.AppointmentDate,
                aptTime = a.AppointmentTime,
                aptLoc = a.AppointmentLocation,
                aptDept = a.DepartmentID,
                aptHospital = a.HospitalID,
                aptReason = a.Reason
            }).ToList();

            string[] potentialKeys = { "AppointmentID" };


            aptGridView.DataSource   = testShite;
            aptGridView.DataKeyNames = potentialKeys;

            lblPName.Text  = "Patient name: " + patient.LastName + "," + patient.FirstName;
            lblDName.Text  = "Doctor name: " + doc.LastName + "," + doc.FirstName;
            lblLoc.Text    = "Appointment location: " + apt.AppointmentLocation;
            lblDate.Text   = "Appointment date: " + apt.AppointmentDate + "@" + apt.AppointmentTime;
            lblReason.Text = "Reason: " + apt.Reason;


            //}
        }
Ejemplo n.º 3
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            IEnumerable <SQL.Appointment> testAppointmentList =
                (from testDate in dbcontext.Appointments.Local
                 where testDate.AppointmentDate.Equals(startDateTextBox.Text)
                 orderby testDate.AppointmentTime
                 select testDate).AsEnumerable();

            foreach (SQL.Appointment testDate in testAppointmentList)
            {
                if (appointmentsDropDownList.SelectedValue.Equals(testDate.AppointmentTime))
                {
                    appointmentsDropDownList.SelectedValue.Remove(appointmentsDropDownList.SelectedIndex);
                }
            }


            /*
             * var userID = User.Identity.GetUserId();
             *
             * dbcontext.Patients.Load();
             * //SQL.Patient myPatient = new SQL.Patient();
             *
             * SQL.Patient myPatient = (from y in dbcontext.Patients.Local
             *                              where y.Email.Equals(userID)
             *                              select y).First();
             * SQL.Patient np = myPatient;
             */
            dbcontext.Appointments.Load();
            SQL.Patient patient = (from x in dbcontext.Patients
                                   where x.Email.Equals(User.Identity.Name)
                                   select x).First();

            SQL.Appointment myAppointment = new SQL.Appointment();
            myAppointment.AppointmentDate     = Convert.ToDateTime(startDateTextBox.Text);
            myAppointment.AppointmentTime     = TimeSpan.Parse(appointmentsDropDownList.SelectedValue);
            myAppointment.PatientID           = patient.PatientID;
            myAppointment.DoctorID            = Convert.ToInt32(doctorDropDownList.SelectedValue);
            myAppointment.HospitalID          = Convert.ToInt32(locationDropDownList.SelectedValue);
            myAppointment.AppointmentLocation = Convert.ToInt32(locationDropDownList.SelectedValue);
            myAppointment.DepartmentID        = Convert.ToInt32(departmentDropDownList.SelectedValue);
            myAppointment.Reason = reasonTextBox.Text;

            dbcontext.Appointments.Add(myAppointment);
            dbcontext.SaveChanges();
        }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SQL.HealthclinicEntities dbcon = new SQL.HealthclinicEntities();

            dbcon.Appointments.Load();
            try
            {
                SQL.Patient patient = (from x in dbcon.Patients
                                       where x.Email.Equals(User.Identity.Name)
                                       select x).First();

                List <SQL.Appointment> apts = (from x in dbcon.Appointments
                                               where x.PatientID == patient.PatientID
                                               select x).ToList();

                aptGridView.DataSource = apts;
                //aptGridView.DataKeyNames = "AppointmentID";
                aptGridView.DataBind();
            }
            catch (InvalidOperationException)
            {
                throw;
            }
        }