private void btLogin_Click(object sender, System.EventArgs e) { /*Patient patient = new Patient(); * patient.Role = "Doctor"; * Doctor doc = new Doctor(); * doc.Role = "Doctor"; * this.Hide(); * AppointmentForm appointmentForm = new AppointmentForm(doc); * appointmentForm.Show();*/ if (tbLogin.Text.Trim() != "" && tbLogin.Text.Trim().Length > 4 && tbLogin.Text.Trim().Length < 31 && tbPassword.Text.Trim() != "" && tbPassword.Text.Trim().Length > 4) { using (var client = new HaServiceClient()) { this.Enabled = false; Patient patient = client.VerefyAuth(tbLogin.Text.Trim(), tbPassword.Text.Trim()); Doctor doc = client.VerefyAuthDoc(tbLogin.Text.Trim(), tbPassword.Text.Trim()); if (patient != null) { MessageBox.Show("Login Successful!"); this.Hide(); AppointmentForm appointmentForm = new AppointmentForm(patient); appointmentForm.Show(); } else if (doc != null) { this.Hide(); AppointmentForm appointmentForm = new AppointmentForm(doc); appointmentForm.Show(); } else { MessageBox.Show("Invalid Login or Password"); } } } else { MessageBox.Show("Invalid Login or Password"); //return; } this.Enabled = true; }