Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            con.Close();
            con.Open();
            SqlCommand cmd2 = new SqlCommand("select username password from userreg where username='******'", con);

            SqlDataReader dr = cmd2.ExecuteReader();
            if (dr.Read())
            {
                MessageBox.Show("username already exist");
                this.Hide();
                userregistration f3 = new userregistration();
                f3.Show();
                con.Close();
            }

            else if (textBox2.Text != textBox3.Text)
            {
                MessageBox.Show("Password doesn't match");
                this.Hide();
                userregistration f3 = new userregistration();
                f3.Show();
            }

            else
            {
                con.Close();
                if (!connectclient())
                {
                    MessageBox.Show("server is not connected");
                    textBox1.Text = "";
                    textBox2.Text = "";
                    textBox3.Text = "";
                    textBox4.Text = "";
                }
                else if (!connecttoserver())
                {
                    MessageBox.Show("Unable to connect to Server");
                    textBox1.Text = "";
                    textBox2.Text = "";
                    textBox3.Text = "";
                    textBox4.Text = "";
                }

                //    //string ss = System.Net.Dns.GetHostName();
                //string ss = System.Net.Dns.GetHostName(ss).GetValue(0).ToString();

            }
        }
Beispiel #2
0
 private void pictureBox2_Click(object sender, EventArgs e)
 {
     this.Hide();
     userregistration f2 = new userregistration();
     f2.Show();
 }
Beispiel #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.TextLength == 0)
            {
                MessageBox.Show("Enter UserName");
            }
            else if (textBox2.TextLength == 0)
            {
                MessageBox.Show("Enter Password");

            }
            else if (textBox3.TextLength == 0)
            {
                MessageBox.Show("Confirm Password Required");

            }

            else
            {

                if (this.IsValidEmail(txtEmailId.Text))
                {
                    MessageBox.Show(txtEmailId.Text + " is in a valid email format.", "Valid Email",
                        MessageBoxButtons.OK, MessageBoxIcon.Information);

                    con.Close();
                    con.Open();
                    SqlCommand cmd2 = new SqlCommand("select username password from userreg where username='******'", con);

                    SqlDataReader dr = cmd2.ExecuteReader();
                    if (dr.Read())
                    {
                        MessageBox.Show("username already exist");
                        this.Hide();
                        userregistration f3 = new userregistration();
                        f3.Show();
                        con.Close();
                    }

                    else if (textBox2.Text != textBox3.Text)
                    {
                        MessageBox.Show("Password doesn't match");
                        this.Hide();
                        userregistration f3 = new userregistration();
                        f3.Show();
                    }

                    else
                    {
                        con.Close();
                        if (!connectclient())
                        {
                            MessageBox.Show("server is not connected");
                            textBox1.Text = "";
                            textBox2.Text = "";
                            textBox3.Text = "";
                            txtEmailId.Text = "";
                        }
                        else if (!connecttoserver())
                        {
                            MessageBox.Show("Unable to connect to Server");
                            textBox1.Text = "";
                            textBox2.Text = "";
                            textBox3.Text = "";
                            txtEmailId.Text = "";
                        }

                        //    //string ss = System.Net.Dns.GetHostName();
                        //string ss = System.Net.Dns.GetHostName(ss).GetValue(0).ToString();

                    }

                }
                else
                {
                    MessageBox.Show(txtEmailId.Text + " is not in a valid email format.", "Invalid Email",
                        MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }

            }
        }