Exemple #1
0
        private void signin_btn_Click_1(object sender, EventArgs e)
        {
            if (email_txt2.Text == "admin" && pass_txt2.Text == "admin123")
            {
                admindashboard admindb = new admindashboard();
                admindb.Show();
            }
            else
            {
                //code for datastoring and validation
                cnn.Open();
                cmd.CommandText = ("select * from app_users where email='" + email_txt2.Text + "'and password='******'");
                cmd.Connection  = cnn;
                SqlDataReader rd = cmd.ExecuteReader();

                if (rd.HasRows)
                {
                    userdashboard userdb = new userdashboard();
                    userdb.Show();
                    LoginInfo.email = email_txt2.Text;
                    //MessageBox.Show(LoginInfo.email);
                }

                else
                {
                    msgrtn = "YOU ARE NOT REGISTERED \n PLEASE SIGNIN";
                    messagebox msgbox = new messagebox();
                    msgbox.labelmsg(msgrtn);
                    msgbox.Show();
                }
                rd.Close();
                cnn.Close();
            }
        }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            messagebox messagebox = new messagebox();

            messagebox.ShowDialog();
        }
Exemple #3
0
        private void singup_btn_Click(object sender, EventArgs e)
        {
            //code for datastoring and validation

            if (name_txt.Text == "")
            {
                namelbl.Text = "fill the feild";
            }
            else
            {
                namelbl.Text = "";
            }
            if (email_txt.Text == "")
            {
                emaillbl.Text = "fill the feild";
            }
            else
            {
                emaillbl.Text = "";
            }
            if (pass_txt.Text == "")
            {
                passlbl.Text = "fill the feild";
            }
            else
            {
                passlbl.Text = "";
            }


            if (!(name_txt.Text == "") && !namechk.Match(name_txt.Text).Success)
            {
                namelbl.Text = "Invalid name";
            }
            if (!(email_txt.Text == "") && !emailchk.Match(email_txt.Text).Success)
            {
                emaillbl.Text = "Invalid email";
            }
            if ((namechk.Match(name_txt.Text).Success) && (emailchk.Match(email_txt.Text).Success))
            {
                SqlCommand cmd1 = new SqlCommand();
                namelbl.Text  = "";
                emaillbl.Text = "";
                cnn.Open();
                cmd.CommandText = ("select 1 from app_users where email='" + email_txt.Text + "'");
                cmd.Connection  = cnn;
                SqlDataReader rd = cmd.ExecuteReader();

                if (!(rd.HasRows))
                {
                    cmd1.CommandText = "insert into app_users values('" + name_txt.Text + "', '" + email_txt.Text + "', '" + pass_txt.Text + "')";
                    rd.Close();
                    cmd1.Connection = cnn;
                    cmd1.ExecuteNonQuery();
                    msgrtn = "Registered successfully";
                    messagebox msgbox1 = new messagebox();
                    msgbox1.labelmsg(msgrtn);
                    msgbox1.Show();
                }
                else
                {
                    msgrtn = "this email is already REGISTERED !";
                    messagebox msgbox = new messagebox();
                    msgbox.labelmsg(msgrtn);
                    msgbox.Show();
                }
                cnn.Close();
            }
        }