private void button1_Click(object sender, EventArgs e) //Confirm { if (VF.Validate_Number(SSN.Text)) { bool Continue = true; DataTable SSNS = controller.RetrieveUserandPass(); for (int i = 0; i < SSNS.Rows.Count; i++) { if (SSN.Text.Trim() == SSNS.Rows[i][2].ToString().Trim()) { if (SSNS.Rows[i]["Username"].ToString().Trim() == SSN.Text) { Continue = false; } } } if (Continue) { controller.Register(Convert.ToInt32(SSN.Text), SSN.Text, "Patient", "", ""); ST.Text = "Registered Successfully!"; return; } else { ST.Text = "Not Registered!"; } } else { ST.Text = "Wrong info!"; } }
private void button1_Click(object sender, EventArgs e) //Confirm { if (HID.Text.Length == 0 || N.Text.Length == 0 || C.Text.Length == 0 || D.Text.Length == 0 || A.Text.Length == 0) { ST.Text = "Empty fields!"; return; } if (!VF.Validate_Number(HID.Text)) { ST.Text = "Hospital ID should be a number!"; return; } bool Continue = true; DataTable HIDS = controller.RetrieveHosID(); if (HIDS != null) { for (int i = 0; i < HIDS.Rows.Count; i++) { if (HID.Text.Trim() == HIDS.Rows[i][0].ToString().Trim()) { Continue = false; } } } if (Continue) { controller.AddHospital(Convert.ToInt32(HID.Text), N.Text, C.Text, D.Text, A.Text); ST.Text = "Hospital added successfully!"; return; } else { ST.Text = "Already registered!"; return; } }
private void button1_Click(object sender, EventArgs e) //Confirm registration { if (VF.Validate_Number(textBox1.Text)) { bool Continue = true; DataTable SSNS = controller.RetrieveSSN(); for (int i = 0; i < SSNS.Rows.Count; i++) { if (textBox1.Text.Trim() == SSNS.Rows[i][0].ToString().Trim()) { Continue = false; } } if (Continue) { int r = controller.Register(Convert.ToInt32(textBox1.Text), textBox1.Text, "Manager", "", ""); if (r != 0) { textBox2.Text = "Registered Successfully!"; } else { textBox2.Text = "Not Registered!"; } return; } else { textBox2.Text = "Already Registered!"; } } else { textBox2.Text = "Wrong info!"; } }
private void button1_Click(object sender, EventArgs e) //Confirm Registration { if (SSN.Text.Length == 0 || UN.Text.Length == 0 || PW.Text.Length == 0 || PN.Text.Length == 0 || C.Text.Length == 0 || D.Text.Length == 0 || AD.Text.Length == 0 || G.Text.Length == 0 || FH.Text.Length == 0 || N.Text.Length == 0 || BD.Text.Length == 0) { ST.Text = "Empty fields!"; return; } if (!VF.Validate_Number(SSN.Text)) { ST.Text = "SSN should be a number!"; return; } if (PW.Text.Length < 7) { ST.Text = "Enter stronger password"; return; } if (!VF.Validate_Number(PN.Text)) { ST.Text = "PhoneNo should be a number!"; return; } if (!VF.Validate_Number(H.Text) && radioButton8.Checked) { ST.Text = "Height should be a number!"; return; } if (!VF.Validate_Number(W.Text) && radioButton8.Checked) { ST.Text = "Weight should be a number!"; return; } if (!VF.Validate_Date(BD.Text)) { ST.Text = "Improper date form"; return; } bool Continue = false; DataTable SSNS = controller.RetrieveUserandPass(); for (int i = 0; i < SSNS.Rows.Count; i++) { if (SSN.Text.Trim() == SSNS.Rows[i]["SSN"].ToString().Trim()) { Continue = true; } } for (int i = 0; i < SSNS.Rows.Count; i++) { if (UN.Text == SSNS.Rows[i]["Username"].ToString().Trim()) { ST.Text = "UserName is already taken!!"; return; } } if (radioButton8.Checked && Continue) { controller.InsertPatientInfo(Convert.ToInt32(SSN.Text), N.Text, C.Text, D.Text, AD.Text, G.Text, Convert.ToInt32(PN.Text), BD.Text, Convert.ToInt32(W.Text), Convert.ToInt32(H.Text), BT.Text); controller.RegisterUpdate(Convert.ToInt32(SSN.Text), "Patient", enc.PasswordEncrypt(PW.Text), UN.Text, enc.PasswordEncrypt(FH.Text)); ST.Text = "Registered Successfully!"; } else if (radioButton7.Checked && Continue) { controller.InsertDoctorInfo(Convert.ToInt32(SSN.Text), N.Text, C.Text, D.Text, AD.Text, G.Text, Convert.ToInt32(PN.Text), BD.Text); controller.RegisterUpdate(Convert.ToInt32(SSN.Text), "Doctor", enc.PasswordEncrypt(PW.Text), UN.Text, enc.PasswordEncrypt(FH.Text)); ST.Text = "Registered Successfully!"; } else if (radioButton6.Checked && Continue) { controller.InsertNurseInfo(Convert.ToInt32(SSN.Text), N.Text, C.Text, D.Text, AD.Text, G.Text, Convert.ToInt32(PN.Text), BD.Text, Convert.ToInt32(EX.Text)); controller.RegisterUpdate(Convert.ToInt32(SSN.Text), "Nurse", enc.PasswordEncrypt(PW.Text), UN.Text, enc.PasswordEncrypt(FH.Text)); ST.Text = "Registered Successfully!"; } else if (radioButton5.Checked && Continue) { controller.InsertManagerInfo(Convert.ToInt32(SSN.Text), N.Text, C.Text, D.Text, AD.Text, G.Text, Convert.ToInt32(PN.Text), BD.Text); controller.RegisterUpdate(Convert.ToInt32(SSN.Text), "Manager", enc.PasswordEncrypt(PW.Text), UN.Text, enc.PasswordEncrypt(FH.Text)); ST.Text = "Registered Successfully!"; } else { ST.Text = "Wrong Info!"; } }