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_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 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); } }