Ejemplo n.º 1
0
        private void signUser_Click(object sender, EventArgs e)
        {
            int con = 0;

            if (consent.Checked)
            {
                con = 1;
            }

            if (!validator.email(email.Text))
            {
                validation.Text    = "Please Enter A Valid Email";
                validation.Visible = true;
                return;
            }

            if (controllerObj.editUser(userID, user.Text, password.Text, email.Text, con) == 0)
            {
                MessageBox.Show("An Error Happened While Updating Your Data.");
            }
            else
            {
                MessageBox.Show("Your Profile Has Been Updated Successfully. Please Re-Login To See The New Changes.");
                Hide();
                parent.Show();
            }
        }
        private void signUser_Click(object sender, EventArgs e)
        {
            if (user.TextLength == 0)
            {
                ToolTip tt = new ToolTip();
                tt.IsBalloon    = true;
                tt.InitialDelay = 0;


                tt.Show("Please Enter Your Username", this, 400, 65, 2000);
            }

            if (phone.TextLength < 7 || phone.TextLength > 15)
            {
                validation.Visible = true;
                validation.Text    = "Please Enter A Valid Phone Number";
                return;
            }

            if (email.TextLength == 0)
            {
                ToolTip tt = new ToolTip();
                tt.IsBalloon    = true;
                tt.InitialDelay = 0;


                tt.Show("Please Enter Your Email", this, 400, 20, 2000);
            }

            if (password.TextLength == 0)
            {
                ToolTip tt = new ToolTip();
                tt.IsBalloon    = true;
                tt.InitialDelay = 0;


                tt.Show("Please Enter Your password", this, 400, 110, 2000);
            }

            if (storename.TextLength == 0)
            {
                ToolTip tt = new ToolTip();
                tt.IsBalloon    = true;
                tt.InitialDelay = 0;


                tt.Show("Please Enter Your store name", this, 400, 155, 2000);
            }

            if (address.TextLength == 0)
            {
                ToolTip tt = new ToolTip();
                tt.IsBalloon    = true;
                tt.InitialDelay = 0;


                tt.Show("Please Enter Your store sddress", this, 400, 200, 2000);
            }

            if (phone.TextLength == 0)
            {
                ToolTip tt = new ToolTip();
                tt.IsBalloon    = true;
                tt.InitialDelay = 0;


                tt.Show("Please Enter Your store phone number", this, 400, 245, 2000);
            }

            if (controllerObj.checkUser(user.Text) != -1 && controllerObj.checkMail(email.Text) == -1)
            {
                validation.Visible = true;
                validation.Text    = "Username Already Exists";
                return;
            }
            if (controllerObj.checkUser(user.Text) == -1 && controllerObj.checkMail(email.Text) != -1)
            {
                validation.Visible = true;
                validation.Text    = "Email Already Exists";
                return;
            }
            if (controllerObj.checkUser(user.Text) != -1 && controllerObj.checkMail(email.Text) != -1)
            {
                validation.Visible = true;
                validation.Text    = "Email And Username Already Exist";
                return;
            }

            if (controllerObj.checkStorePhone(Convert.ToInt64(phone.Text)) != "N/A")
            {
                validation.Visible = true;
                validation.Text    = "Phone Number Already Exists";
                return;
            }

            if (controllerObj.checkStoreName(storename.Text) != "N/A")
            {
                validation.Visible = true;
                validation.Text    = "Store Name Exists";
                return;
            }

            if (controllerObj.checkStoreAddress(address.Text) != "N/A")
            {
                validation.Visible = true;
                validation.Text    = "Store Address Exists";
                return;
            }

            if (phone.TextLength == 0 || address.TextLength == 0 || storename.TextLength == 0 || password.TextLength == 0 || email.TextLength == 0 || user.TextLength == 0)
            {
                validation.Text    = "Please Enter All Data";
                validation.Visible = true;
                return;
            }

            if (!validator.email(email.Text))
            {
                validation.Visible = true;
                validation.Text    = "Please Enter A Valid Email";
                return;
            }
            if (controllerObj.signUp(email.Text, user.Text, password.Text, consent.Checked, "Store_WAITING_APPROVAL") == 0 || controllerObj.addStore(storename.Text, long.Parse(phone.Text), address.Text) == 0 || controllerObj.addStoreOwner(storename.Text, controllerObj.checkUser(user.Text)) == 0)
            {
                MessageBox.Show("A Problem Occured While Signing Up");
                return;
            }
            else
            {
                MessageBox.Show("Thank You ," + storename.Text + " For signing up. An Admin will review your request.");
            }
        }
        private void signUser_Click(object sender, EventArgs e)
        {
            if (user.TextLength == 0)
            {
                ToolTip tt = new ToolTip();
                tt.IsBalloon    = true;
                tt.InitialDelay = 0;


                tt.Show("Please Enter Username", this, 200, 70, 2000);
            }

            if (password.TextLength == 0)
            {
                ToolTip tt = new ToolTip();
                tt.IsBalloon    = true;
                tt.InitialDelay = 0;


                tt.Show("Please Enter Password", this, 200, 110, 2000);
            }

            if (email.TextLength == 0)
            {
                ToolTip tt = new ToolTip();
                tt.IsBalloon    = true;
                tt.InitialDelay = 0;


                tt.Show("Please Enter Email", this, 200, 30, 2000);
            }

            if (user.TextLength == 0 || password.TextLength == 0 || email.TextLength == 0)
            {
                return;
            }
            if (controllerObj.checkUser(user.Text) != -1 && controllerObj.checkMail(email.Text) == -1)
            {
                ERR.Visible = true;
                ERR.Text    = "Username Already Exists";
                return;
            }
            if (controllerObj.checkUser(user.Text) == -1 && controllerObj.checkMail(email.Text) != -1)
            {
                ERR.Visible = true;
                ERR.Text    = "Email Already Exists";
                return;
            }
            if (controllerObj.checkUser(user.Text) != -1 && controllerObj.checkMail(email.Text) != -1)
            {
                ERR.Visible = true;
                ERR.Text    = "Email And Username Already Exist";
                return;
            }

            if (!validator.email(email.Text))
            {
                ERR.Visible = true;
                ERR.Text    = "Please Enter A Valid Email";
                return;
            }



            if (controllerObj.signUp(email.Text, user.Text, password.Text, consent.Checked, "User") == 1)
            {
                MessageBox.Show("Welcome To LDBS, " + user.Text + ".");
                Form search = new Search("new", user.Text);
                this.Hide();
                search.Show();
            }
            else
            {
                MessageBox.Show("An Error has occured while creating a new account.");
            }
        }