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"; } } } }