private void button2_Click(object sender, EventArgs e) { if ((textBox1.Text == "") && (textBox2.Text == "") && (textBox3.Text == "") && (textBox4.Text == "") && (textBox5.Text == "")) { if ((textBox6.Text == "") || (textBox7.Text == "") || (textBox8.Text == "") || (textBox9.Text == "")) { MessageBox.Show("Enter all the details properly "); } else if (textBox7.Text == textBox8.Text) { I = 0; QUERY = "select * from C_Create_Account where username='******' "; CON1.Open(); CMD = new OracleCommand(QUERY, CON1); RDR = CMD.ExecuteReader(); while (RDR.Read()) { if ((string)RDR["username"] == textBox6.Text) I = 1; else I = I; } RDR.Close(); CON1.Close(); if (I == 1) { MessageBox.Show(" username exists"); textBox6.Text = " "; textBox6.Focus(); } //check for email validation else if (!this.textBox9.Text.Contains('@') || !this.textBox9.Text.Contains('.')) { MessageBox.Show("Please Enter A Valid Email", "Invalid Email", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { CON1.Open(); QUERY = "Insert into C_Create_Account values('" + textBox6.Text + "','" + textBox7.Text + "','" + textBox8.Text + "','" + textBox9.Text + "')"; CMD = new OracleCommand(QUERY, CON1); CMD.CommandType = CommandType.Text; TEMP = CMD.ExecuteNonQuery(); if (TEMP > 0) { MessageBox.Show(" RECORD ADDED SUCESSFULLY"); Login op = new Login(); op.Show(); Hide(); } else MessageBox.Show("INSERT OPERATION FAILED "); textBox6.Text = ""; textBox7.Text = ""; textBox8.Text = ""; textBox9.Text = ""; } } else { MessageBox.Show("PASSWORDS DO NOT MATCH"); textBox7.Text = ""; textBox8.Text = ""; textBox7.Focus(); } } //for staff else { if ((textBox1.Text == " ") || (textBox2.Text == "") || (textBox3.Text == " ") || (textBox4.Text == " ") || (textBox5.Text == " ")) { MessageBox.Show("Enter all the details properly "); } else if (textBox7.Text == textBox8.Text) { I = 0; QUERY = "select * from S_Create_Account where username='******' "; CON1.Open(); CMD = new OracleCommand(QUERY, CON1); RDR = CMD.ExecuteReader(); while (RDR.Read()) { if ((string)RDR["username"] == textBox6.Text) I = 1; else I = I; } RDR.Close(); CON1.Close(); if (I == 1) { MessageBox.Show(" username exists"); textBox6.Text = " "; textBox6.Focus(); } //check for email validation else if (!this.textBox4.Text.Contains('@') || !this.textBox4.Text.Contains('.')) { MessageBox.Show("Please Enter A Valid Email", "Invalid Email", MessageBoxButtons.OK, MessageBoxIcon.Error); } //company code varification else if (textBox5.Text != Convert.ToString(12345)) { MessageBox.Show("Comapny code doesnt match. please enter the correct company code."); } else if (textBox5.Text == Convert.ToString(12345)) { CON1.Open(); QUERY = "Insert into S_Create_Account values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "')"; CMD = new OracleCommand(QUERY, CON1); CMD.CommandType = CommandType.Text; TEMP = CMD.ExecuteNonQuery(); if (TEMP > 0) { MessageBox.Show(" RECORD ADDED SUCESSFULLY"); Login op = new Login(); op.Show(); Hide(); } else MessageBox.Show("INSERT OPERATION FAILED "); textBox6.Text = ""; textBox7.Text = ""; textBox8.Text = ""; textBox9.Text = ""; } } else { MessageBox.Show("PASSWORDS DO NOT MATCH"); textBox7.Text = ""; textBox8.Text = ""; textBox7.Focus(); } } }
private void button1_Click(object sender, EventArgs e) { Login op = new Login(); op.Show(); Hide(); }