private void signin() { if (textBox1.TextLength > 3 || textBox2.TextLength > 3) { string message = null; var passwordClient = new PasswordServiceClient(); int[] idAndType = passwordClient.authenticatePerson(textBox1.Text, textBox2.Text, ref message); label1.Text = message; if (idAndType != null) new Thread(() => new AdminMenu().ShowDialog()).Start(); } else { label1.Text = "Incorrect length"; } }
protected void LogIn(object sender, EventArgs e) { Labell.Visible = false; string message = null; var passwordClient = new PasswordServiceClient(); string[] idAndType = passwordClient.authenticatePerson(Loginn.Text, Password.Text, ref message); if (idAndType != null && idAndType[1].Equals("2")) { int id = 0; Int32.TryParse(idAndType[0], out id); Patient patientClient = new PatientServiceClient().GetPatient(id); patientClient.sessionID = idAndType[2]; Session["patientObj"] = patientClient; Response.Redirect("~/Default.aspx"); } else { Labell.Visible = true; Labell.Text = "Try once again"; } }
private void signin() { string message = null; if (textBox1.TextLength > 3 || textBox2.TextLength > 3) { var passwordClient = new PasswordServiceClient(); string[] idAndType = passwordClient.authenticatePerson(textBox1.Text, textBox2.Text, ref message); if (idAndType != null) { int id = -1; Int32.TryParse(idAndType[0], out id); if (idAndType[1].Equals("0")) { Admin adminClient = new AdminServiceClient().GetAdmin(id); adminClient.sessionID = idAndType[2]; new Thread(() => new AdminMenu().ShowDialog()).Start(); Dispose(); } else if(idAndType[1].Equals("1")) { var doctorClient = new DoctorServiceClient().GetDoctor(id); doctorClient.sessionID = idAndType[2]; new Thread(() => new DoctorMenu(doctorClient).ShowDialog()).Start(); Dispose(); } else new Thread(() => new ErrorWindow("Wrong username or password").ShowDialog()).Start(); } else { new Thread(() => new ErrorWindow("Wrong username or password").ShowDialog()).Start(); } } else { new Thread(() => new ErrorWindow("Incorrect length").ShowDialog()).Start(); } }