private void button4_Click(object sender, EventArgs e)
        {
            this.Hide();
            libdash obj = new libdash();

            obj.ShowDialog();
        }
예제 #2
0
 //this button used to login librarian dashboard
 private void button4_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(textBox4.Text) && (!string.IsNullOrEmpty(textBox3.Text)))
     {
         string           connstring = "DATA SOURCE = localhost:1521 / xe; USER ID = C##LIBRARY; PASSWORD =mypswrd";
         OracleConnection conn       = new OracleConnection(connstring);
         conn.Open();
         OracleCommand cmd = new OracleCommand();
         cmd.CommandText = "SELECT *FROM LIBRARIAN WHERE LOWER(CNIC) = :USERNAME AND LOWER(PASSWORD) = :PSWRD";
         cmd.Connection  = conn;
         cmd.Parameters.Add(new OracleParameter(":username", textBox4.Text.ToLower()));
         cmd.Parameters.Add(new OracleParameter(":pswrd", textBox3.Text.ToLower()));
         cmd.CommandType = CommandType.Text;
         OracleDataReader dr = cmd.ExecuteReader();
         if (dr.Read())
         {
             cnic = textBox4.Text;
             libdash fm = new libdash();
             fm.ShowDialog();
             this.Close();
         }
         else
         {
             MessageBox.Show("The CNIC or Password is incorrect. Try Again!");
             textBox4.Focus();
             textBox4.SelectAll();
         }
         conn.Dispose();
     }
     else
     {
         MessageBox.Show("Please Enter CNIC and Password", "Student Login Form", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         textBox4.Select();
     }
 }