protected void btn_search_Click( object sender, EventArgs e ) { //defaultstatus(); string input = this.txtbox_search.Text.ToString(); BusinessTier.Admin admin = new BusinessTier.Admin(); Data.DataBase.doctorsDataTable table = new Data.DataBase.doctorsDataTable(); if ( input.Length > 0 ) { table = admin.SearchDoctorByID(input); if ( table.Rows.Count > 0 ) { this.gv_doctorview.DataSource = table; this.gv_doctorview.DataBind(); } else { this.lbl_searchwarning.Text = "Invalid ID, Please confirm the IDs before search..."; this.lbl_searchwarning.BackColor = System.Drawing.Color.Red; } } else { table = admin.SelectAllDoctors(); this.gv_doctorview.DataSource = table; this.gv_doctorview.DataBind(); } }
protected void btn_update_Click( object sender, EventArgs e ) { string pid = this.txtbox_pid.Text.Trim().ToString().ToUpper(); string did = this.txtbox_did.Text.Trim().ToString().ToUpper(); string cid = this.txtbox_cid.Text.Trim().ToString().ToUpper(); BusinessTier.Admin admin = new BusinessTier.Admin(); if ( pid.Length > 0 && did.Length > 0 && cid.Length > 0 ) { if ( admin.CheckPatientBeforeAssign(pid) == true ) { if ( admin.isMember(did) == true && admin.isMember(cid) == true ) { admin.updateAssignment(pid, did, cid); } else { this.lbl_didwarning.Text = "Check if this ID is exsited"; this.lbl_cidwarning.Text = "Check if this ID is exsited"; } } else { this.lbl_pidwarning.Text = "No such patient ID"; } } }
protected void btn_adddoctor_Click( object sender, EventArgs e ) { //defaultstatus(); string did = this.txtbox_did.Text; string name = this.txtbox_name.Text; string gender = this.txtbox_gender.Text; string tempage = this.txtbox_age.Text; //int age = int.Parse(this.txtbox_age.Text); if ( did.Length > 0 && name.Length > 0 && gender.Length > 0 && tempage.Length > 0 ) { BusinessTier.Admin admin = new BusinessTier.Admin(); Data.DataBase.doctorsDataTable table = new Data.DataBase.doctorsDataTable(); table = admin.SearchDoctorByID(did); if ( table.Rows.Count > 0 ) { this.lbl_idwarning.Text = "This ID is already exsit"; this.lbl_idwarning.BackColor = System.Drawing.Color.Red; } else { int age = int.Parse(tempage); admin.AddDoctor(did, name, gender, age); this.gv_doctorview.DataSource = admin.SelectAllDoctors(); this.gv_doctorview.DataBind(); } } else { errorWarning(); } }
protected void btn_addcare_Click( object sender, EventArgs e ) { //defaultStatus(); string cid = this.txtbox_careID.Text; string name = txtbox_name.Text; string gender = txtbox_gender.Text; string contactno = txtbox_contactno.Text; int age = int.Parse(this.txtbox_age.Text); if ( cid.Length > 0 && name.Length > 0 && gender.Length > 0 && contactno.Length > 0 && age.ToString().Length > 0 ) { BusinessTier.Admin admin = new BusinessTier.Admin(); Data.DataBase.caretakersDataTable table = new Data.DataBase.caretakersDataTable(); table = admin.SearchCareTakerByID(cid); if ( table.Rows.Count > 0 ) { this.lbl_idwarning.Text = "This ID is already exsit"; this.lbl_idwarning.BackColor = System.Drawing.Color.Red; } else { admin.AddCareTaker(cid, name, gender, contactno, age); this.gv_caretakerview.DataSource = admin.SelectAllCareTakers(); this.gv_caretakerview.DataBind(); } } else { errorWarning(); } }
protected void btn_addpatient_Click( object sender, EventArgs e ) { //defaultstatus(); string pid = this.txtbox_patientid.Text; string name = this.txtbox_name.Text; string gender = this.txtbox_gender.Text; string tempdate = this.txtbox_birthday.Text; string tempage = this.txtbox_age.Text; string medical = this.txtbox_medical.Text; if ( pid.Length > 0 && name.Length > 0 && gender.Length > 0 && tempdate.Length > 0 && tempage.Length > 0 && medical.Length > 0 ) { BusinessTier.Admin admin = new BusinessTier.Admin(); Data.DataBase.patientsDataTable table = new Data.DataBase.patientsDataTable(); table = admin.SearchPatientByID(pid); if ( table.Rows.Count > 0 ) { this.lbl_idwarning.Text = "This ID is already exsit"; this.lbl_idwarning.BackColor = System.Drawing.Color.Red; } else { try { int age = int.Parse(tempage); DateTime date = DateTime.Parse(tempdate); admin.AddPatient(pid, name, gender, date.Date, age, medical); } catch ( Exception ex ) { this.lbl_agewarning.Text = ex.Message.ToString(); this.lbl_birthdaywarning.Text = ex.Message.ToString(); } } } else { errorWarning(); } }
protected void Button1_Click(object sender, EventArgs e) { Data.DataBase.usersDataTable users = new Data.DataBase.usersDataTable(); BusinessTier.Admin admin = new BusinessTier.Admin(); // Saves info on the login page. string id = TextBox1.Text; string password = TextBox2.Text; string role = DropDownList1.Text; if ( admin.isMember(id) ) { users = admin.UserLogin(id, password, role); if ( users.Rows.Count > 0 ) { Session.Add("RoleID", id); Session.Add("Role", role); //Redirect to second page. if ( role == "A" ) { Server.Transfer("Home_Admin_Assignments.aspx"); } if ( role == "D" ) { Server.Transfer("Home_Doctor.aspx"); } if ( role == "C" ) { Server.Transfer("Home_Caretaker.aspx"); } } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "loginerror('detailErroe');", true); } } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "loginerror('noneUser');", true); } }
protected void btn_add_Click( object sender, EventArgs e ) { string pid = this.txtbox_pid.Text.Trim().ToString().ToUpper(); string did = this.txtbox_did.Text.Trim().ToString().ToUpper(); string cid = this.txtbox_cid.Text.Trim().ToString().ToUpper(); bool hasThePatient; bool hasTheDoctor; bool hasTheCare; if ( pid.Length > 0 && did.Length > 0 && cid.Length > 0 ) { BusinessTier.Admin admin = new BusinessTier.Admin(); hasThePatient = admin.CheckPatientBeforeAssign(pid); hasTheDoctor = admin.isMember(did); hasTheCare = admin.isMember(cid); if ( hasThePatient == true ) { this.lbl_pidwarning.Text = "Duplicate patient ID"; } if ( hasThePatient == false ) { if ( hasTheCare == true && hasTheDoctor == true ) { admin.AddAssignment(pid, did, cid); this.gv_assignments.DataSource = admin.SelectAllAssignments(); this.gv_assignments.DataBind(); } else { this.lbl_didwarning.Text="Check this ID before assgin"; this.lbl_cidwarning.Text="Check this ID before assign"; } } } }
protected void btn_update_Click( object sender, EventArgs e ) { //defaultstatus(); string did = this.txtbox_did.Text; string name = this.txtbox_name.Text; string gender = this.txtbox_gender.Text; string tempage = this.txtbox_age.Text; if ( did.Length > 0 && name.Length > 0 && gender.Length > 0 && tempage.ToString().Length > 0 ) { Data.DataBase.doctorsDataTable table = new Data.DataBase.doctorsDataTable(); BusinessTier.Admin admin = new BusinessTier.Admin(); table = admin.SearchDoctorByID(did); if ( table.Rows.Count > 0 ) { int age = int.Parse(tempage); admin.UpdateDoctorByID(name, gender, age, did); } else { this.lbl_idwarning.Text = "This ID is not exsit"; this.lbl_idwarning.BackColor = System.Drawing.Color.Red; } } else { errorWarning(); } }
protected void gv_doctorview_RowDeleting( object sender, GridViewDeleteEventArgs e ) { //defaultstatus(); BusinessTier.Admin admin = new BusinessTier.Admin(); string D_id = this.gv_doctorview.Rows[e.RowIndex].Cells[2].Text; admin.DeleteDoctor(D_id); }
protected void gv_assignments_RowDeleting( object sender, GridViewDeleteEventArgs e ) { defaultStatus(); BusinessTier.Admin admin = new BusinessTier.Admin(); int assign_id = int.Parse(this.gv_assignments.Rows[e.RowIndex].Cells[2].Text); string pid = this.gv_assignments.Rows[e.RowIndex].Cells[3].Text; if ( admin.SearchPatientByID(pid).Rows.Count > 0 ) { Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "deleteError()", true); } else { admin.DeleteAssignmentByID(assign_id); } }
protected void search_btn_Click1( object sender, EventArgs e ) { Data.DataBase.assignmentsDataTable table = new Data.DataBase.assignmentsDataTable(); BusinessTier.Admin admin = new BusinessTier.Admin(); string input = this.textbox_assgin.Text.ToString(); if ( input.Length > 0 ) { int assign_id = int.Parse(input); table = admin.SelectAssignmentByID(assign_id); } else { table = admin.SelectAllAssignments(); } this.gv_assignments.DataSource = table; this.gv_assignments.DataBind(); }
protected void gv_caretakerview_RowDeleting( object sender, GridViewDeleteEventArgs e ) { BusinessTier.Admin admin = new BusinessTier.Admin(); string care_ID = this.gv_caretakerview.Rows[e.RowIndex].Cells[2].Text; admin.DeleteCareTaker(care_ID); }
public UnitTest1() { admin = new BusinessTier.Admin(); }