private void GetDoctors() { ClinicManagementSystemDataContext dbcontext = new ClinicManagementSystemDataContext(); DoctorDataGrid.DataSource = dbcontext.TBLDOCTORs; DoctorDataGrid.DataBind(); }
private void GetAppoinment() { ClinicManagementSystemDataContext dbcontext = new ClinicManagementSystemDataContext(); AppointmentDataGrid.DataSource = from appointment in dbcontext.TBLAPPOINTMENTs join patient in dbcontext.TBLPATIENTs on appointment.appointment_PatientID equals patient.patient_ID join doctor in dbcontext.TBLDOCTORs on appointment.appointment_DoctorID equals doctor.doctor_ID select new { appointment.appoinment_ID, patient.patient_Name, patient.patient_BirthDate, patient.patient_Phone, appointment.appointment_Date, doctor.doctor_Name, appointment.appointment_Status }; AppointmentDataGrid.DataBind(); // select new // { // Appoint_ID = appointment. // }; //Select appoinment_ID,TBLPATIENT.patient_Name,TBLPATIENT.patient_Phone,appointment_Date,TBLDOCTOR.doctor_Name,appointment_Status from TBLAPPOINTMENT JOIN TBLPATIENT ON TBLAPPOINTMENT.appointment_PatientID = TBLPATIENT.patient_ID JOIN TBLDOCTOR ON TBLAPPOINTMENT.appointment_DoctorID = TBLDOCTOR.doctor_ID; }
private void GetPatientData() { ClinicManagementSystemDataContext dbcontext = new ClinicManagementSystemDataContext(); PatientDataGrid.DataSource = dbcontext.TBLPATIENTs; PatientDataGrid.DataBind(); }
private void GetSelectedPatient() { ClinicManagementSystemDataContext dbcontext = new ClinicManagementSystemDataContext(); var selected_Patient = from sel_Patient in dbcontext.TBLPATIENTs where sel_Patient.patient_ID == Id_OfPatient select sel_Patient; SelectedPatientDetail.DataSource = selected_Patient; SelectedPatientDetail.DataBind(); }
// Done protected void PatientDataGrid_RowDeleting(object sender, GridViewDeleteEventArgs e) { patientid = Convert.ToInt32(PatientDataGrid.DataKeys[e.RowIndex].Values["patient_ID"].ToString()); if (patientid != 0) { using (ClinicManagementSystemDataContext dbcontext = new ClinicManagementSystemDataContext()) { TBLPATIENT patient = dbcontext.TBLPATIENTs.SingleOrDefault(p => p.patient_ID == patientid); dbcontext.TBLPATIENTs.DeleteOnSubmit(patient); dbcontext.SubmitChanges(); GetPatientData(); } } }
protected void Page_Load(object sender, EventArgs e) { ClinicManagementSystemDataContext dbcontext = new ClinicManagementSystemDataContext(); AppointmentDoctorList.DataSource = from doctor in dbcontext.TBLDOCTORs where doctor.is_Active.Equals('Y') select new { doctor.doctor_Name, doctor.doctor_ID }; AppointmentDoctorList.DataTextField = "doctor_Name"; AppointmentDoctorList.DataValueField = "doctor_ID"; AppointmentDoctorList.DataBind(); }
private void InsertPatient() { using (ClinicManagementSystemDataContext dbcontext = new ClinicManagementSystemDataContext()) { TBLPATIENT newPatient = new TBLPATIENT() { patient_Name = Patient_NameTB.Text, patient_Gender = GenderDropDownList.SelectedValue, patient_BirthDate = PatientBirthTB.Text, /* patient_BirthDate = DateTime.Parse(PatientBirth.Text),*/ patient_Height = Patient_Height.Text, patient_Weight = Int32.Parse(Patient_Weight.Text), patient_Phone = Patient_Phone.Text, patient_Email = Patient_EAddressTB.Text, patient_Address = PatientAddressTB.Text }; dbcontext.TBLPATIENTs.InsertOnSubmit(newPatient); dbcontext.SubmitChanges(); } }
private void GetUserAccounts() { ClinicManagementSystemDataContext dbcontext = new ClinicManagementSystemDataContext(); UserAccountDataGrid.DataSource = from userrole in dbcontext.TBLUSERROLEs join user in dbcontext.TBLUSERs on userrole.userID equals user.userID join role in dbcontext.TBLROLEs on userrole.roleID equals role.roleID select new { user.userID, user.userName, user.userEmail, user.userPhone, role.roleName, userrole.userRoleDesc, user.is_Active }; UserAccountDataGrid.DataBind(); }
protected void loginbutton_Click(object sender, EventArgs e) { if (loginEmailTB.Text != null && LoginPasswordTB.Text != null) { ClinicManagementSystemDataContext dbcontext = new ClinicManagementSystemDataContext(); var LinqQuery = (from userrole in dbcontext.TBLUSERROLEs join user in dbcontext.TBLUSERs on userrole.userID equals user.userID join role in dbcontext.TBLROLEs on userrole.roleID equals role.roleID where user.userEmail == loginEmailTB.Text && user.userpassword == LoginPasswordTB.Text && user.is_Active == 'Y' select new { user.userName, user.userEmail, user.userpassword, role.roleName, userrole.userRoleDesc }).SingleOrDefault(); //FirstOrDefault(); if (LinqQuery != null) { Session["Usr_Name"] = LinqQuery.userName; Session["Usr_Name"] = LinqQuery.userpassword; Session["Usr_Password"] = LinqQuery.userpassword; Session["Usr_Role"] = LinqQuery.roleName; Session["Usr_RoleDesc"] = LinqQuery.userRoleDesc; Response.Redirect("~/Home/HomeIndex.aspx"); } else { Console.WriteLine("Incorrect Username or Password"); } } }