private void loginButton_Click(object sender, EventArgs e) { try { DoctorSystem doctor = new DoctorSystem(this); id = ıdtextBox.Text; controlid = controlıdtxtbox.Text; if (ıdtextBox.Text == "" && passwordtextBox.Text != "") { MessageBox.Show("Please enter your ID", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (passwordtextBox.Text == "" && ıdtextBox.Text != "") { MessageBox.Show("Please enter your Password", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (ıdtextBox.Text == "" && passwordtextBox.Text == "") { MessageBox.Show("Please enter your ID and Password", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { conn = new SqlConnection("Data Source=DESKTOP-UQ0368S\\SQLEXPRESS; Initial Catalog=Hospital_Appointment_System; User Id=sa; password=sqlserver;"); kmt = new SqlCommand(); conn.Open(); kmt.Connection = conn; kmt.CommandText = "SELECT * FROM Doctor WHERE doctorID='" + ıdtextBox.Text + "' AND password='******'"; dr = kmt.ExecuteReader(); if (controlıdtxtbox.Text == "7564") { if (dr.Read()) { doctor.textBox1.Text = id; doctor.Show(); this.Hide(); } else { MessageBox.Show("Wrong ID or Password!"); } } else { MessageBox.Show("Wrong Control ID!"); } conn.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void signupButton_Click(object sender, EventArgs e) { doctor.Show(); this.Hide(); }