예제 #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     Login op = new Login();
     op.Show();
     Hide();
 }
예제 #2
0
        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 button2_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "" && textBox2.Text == "" && textBox3.Text == "" && textBox4.Text == "")
            {
                if (textBox5.Text == "" || textBox6.Text == "" || textBox7.Text == "")
                {
                    MessageBox.Show("Enter All the Details ");
                }


                else
                if (textBox6.Text == textBox7.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"] == textBox5.Text)
                        {
                            I = 1;
                        }
                        else
                        {
                            I = I;
                        }
                    }
                    RDR.Close();
                    CON1.Close();

                    if (I == 1)
                    {
                        MessageBox.Show(" username exists");
                        textBox5.Text = "";
                        textBox5.Focus();
                    }
                    else
                    {
                        CON1.Open();
                        QUERY = "Update C_Create_Account set password='******', confirm_password='******' where username='******'";
                        // QUERY = "Update LAB Set PARTICULAR='" + TextBox2.Text + "',NAME_OF_SUP='" + TextBox3.Text.ToUpper() + "',ADDRESS='" + TextBox4.Text + "' Where ID='" + TextBox1.Text + "'";
                        CMD             = new OracleCommand(QUERY, CON1);
                        CMD.CommandType = CommandType.Text;
                        TEMP            = CMD.ExecuteNonQuery();
                        if (TEMP > 0)
                        {
                            MessageBox.Show(" PASSWORD CHANGED SUCESSFULLY");
                            Login op = new Login();
                            op.Show();
                            Hide();
                        }
                        else
                        {
                            MessageBox.Show("COULDEN'T CHANGE THE PASSWORD");
                        }

                        textBox5.Text = "";
                        textBox6.Text = "";
                        textBox7.Text = "";
                    }
                }
                else
                {
                    MessageBox.Show("PASSWORDS DO NOT MATCH");
                    textBox5.Text = "";
                    textBox6.Text = "";
                    textBox7.Focus();
                }
            }
            //for staff
            else
            {
                if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "")
                {
                    MessageBox.Show("Enter All the Details ");
                }


                else
                if (textBox2.Text == textBox3.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"] == textBox5.Text)
                        {
                            I = 1;
                        }
                        else
                        {
                            I = I;
                        }
                    }
                    RDR.Close();
                    CON1.Close();

                    if (I == 1)
                    {
                        MessageBox.Show(" username exists");
                        textBox5.Text = "";
                        textBox5.Focus();
                    }
                    else
                    {
                        if (textBox4.Text != Convert.ToString(12345))
                        {
                            MessageBox.Show("Comapny code doesnt match. please enter the correct company code.");
                        }

                        if (textBox4.Text == Convert.ToString(12345))
                        {
                            CON1.Open();
                            QUERY = "Update S_Create_Account set password='******', confirm_password='******' where username='******'";
                            // QUERY = "Update LAB Set PARTICULAR='" + TextBox2.Text + "',NAME_OF_SUP='" + TextBox3.Text.ToUpper() + "',ADDRESS='" + TextBox4.Text + "' Where ID='" + TextBox1.Text + "'";
                            CMD             = new OracleCommand(QUERY, CON1);
                            CMD.CommandType = CommandType.Text;
                            TEMP            = CMD.ExecuteNonQuery();
                            if (TEMP > 0)
                            {
                                MessageBox.Show(" PASSWORD CHANGED SUCESSFULLY");
                                Login op = new Login();
                                op.Show();
                                Hide();
                            }
                            else
                            {
                                MessageBox.Show("COULDEN'T CHANGE THE PASSWORD");
                            }

                            textBox5.Text = "";
                            textBox6.Text = "";
                            textBox7.Text = "";
                        }
                    }
                }
                else
                {
                    MessageBox.Show("PASSWORDS DO NOT MATCH");
                    textBox5.Text = "";
                    textBox6.Text = "";
                    textBox7.Focus();
                }
            }
        }