Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (sname.Text == " " || email.Text == " " || t_shop.Text == " " || password.Text == " ")
            {
                MessageBox.Show("Enter All the Details ");
            }

            else
            if (password.Text == re_password.Text)
            {
                I = 0;

                QUERY = "select * from sreg where sname='" + sname.Text + "' ";
                CON1.Open();
                CMD = new OracleCommand(QUERY, CON1);

                RDR = CMD.ExecuteReader();

                while (RDR.Read())
                {
                    if (RDR["sname"] == sname.Text)
                    {
                        I = 1;
                    }
                    else
                    {
                        I = I;
                    }
                }
                RDR.Close();
                CON1.Close();

                if (I == 1)
                {
                    MessageBox.Show(" Shop Name exists");
                    sname.Text = " ";
                    sname.Focus();
                }
                else
                {
                    CON1.Open();
                    QUERY           = "Insert into sreg(sname,email,type_shop,password) values('" + sname.Text + "','" + email.Text + "','" + t_shop.Text + "','" + password.Text + "')";
                    CMD             = new OracleCommand(QUERY, CON1);
                    CMD.CommandType = CommandType.Text;
                    TEMP            = CMD.ExecuteNonQuery();
                    if (TEMP > 0)
                    {
                        MessageBox.Show(" REGISTRATION SUCCESSFULL");
                    }
                    else
                    {
                        MessageBox.Show("REGISTRATION FAILED");
                    }

                    clear();
                    next();
                }
            }
            else
            {
                MessageBox.Show("PASSWORDS DO NOT MATCH");
                password.Text    = "";
                re_password.Text = "";
                password.Focus();
            }

            void clear()
            {
                sname.Text = email.Text = t_shop.Text = password.Text = " ";
            }

            void next()
            {
                CLogin ss = new CLogin();

                ss.Show();
                this.Hide();
            }
        }