private void button3_Click(object sender, EventArgs e) { staffcontrol op = new staffcontrol(); op.Show(); Hide(); }
private void button1_Click(object sender, EventArgs e) { if ((textBox1.Text == " ") || (textBox2.Text == "") || (comboBox4.Text == "") || (comboBox4.Text == "--SELECT--")) { MessageBox.Show("Enter the all the details"); } // for staff else { if (comboBox4.SelectedItem.ToString() == "Staff") { int FLAG = 0; string STR = ""; QUERY = "select * from S_CREATE_ACCOUNT where username ='******' "; CMD = new OracleCommand(QUERY, CON1); CON1.Open(); RDR = CMD.ExecuteReader(); while (RDR.Read()) { STR = (string)RDR["password"]; FLAG = 1; } RDR.Close(); CON1.Close(); if (FLAG == 0) { MessageBox.Show(" username doesnt exist", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); clearform(); } else if (textBox2.Text == STR) { staffcontrol op = new staffcontrol(); op.Show(); Hide(); Hide(); } else { MessageBox.Show("Username and Password doesnt match.Please enter correct username and Password", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox2.Text = " "; textBox2.Focus(); } } // for customer else { int FLAG1 = 0; string STR1 = ""; QUERY = "select * from C_CREATE_ACCOUNT where username ='******' "; CMD = new OracleCommand(QUERY, CON1); CON1.Open(); RDR = CMD.ExecuteReader(); while (RDR.Read()) { STR1 = (string)RDR["password"]; FLAG1 = 1; } RDR.Close(); CON1.Close(); if (FLAG1 == 0) { MessageBox.Show(" username doesnt exist", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); clearform(); } else if (textBox2.Text == STR1) { //fatch the email adderss of the user QUERY = "select email from C_CREATE_ACCOUNT where username ='******' "; CMD = new OracleCommand(QUERY, CON1); getname = textBox1.Text; CON1.Open(); RDR = CMD.ExecuteReader(); while (RDR.Read()) { getemail = (string)RDR["email"]; } RDR.Close(); CON1.Close(); //value passed to the constructor of another form // MessageBox.Show(getemail); // Booking m = new Booking(getemail); customercontrol op = new customercontrol(); op.Show(); Hide(); Hide(); } else { MessageBox.Show("Username and Password doesnt match.Please enter correct username and Password", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox2.Text = " "; textBox2.Focus(); } } } }