Exemplo n.º 1
0
        private void AdminRegbtn_Click(object sender, EventArgs e)
        {
            string ps = PasswordTboxR.Text;

            #region Condition
            if (
                string.IsNullOrWhiteSpace(FirstnameTbox.Text) &&
                string.IsNullOrWhiteSpace(LastnameTbox.Text) &&
                string.IsNullOrWhiteSpace(UsernameTboxR.Text) &&
                string.IsNullOrWhiteSpace(PasswordTboxR.Text) &&
                string.IsNullOrWhiteSpace(CPassTbox.Text)
                )
            {
                MessageBox.Show("Please Fill All The Fields");
                //return;
            }

            #endregion
            else if (UsernameTboxR.Text.Length < 8)
            {
                MessageBox.Show("Username must contain minimum 8 charaters....!");
            }

            else if (ps.Length < 5)
            {
                MessageBox.Show("Password must contain minimum 5 charaters....!");
            }

            else if (PasswordTboxR.Text != CPassTbox.Text)
            {
                MessageBox.Show("Password Doesnt Match!");
            }

            else
            {
                AdminModel am = new AdminModel()
                {
                    Firstname = FirstnameTbox.Text,
                    Lastname  = LastnameTbox.Text,
                    Username  = UsernameTboxR.Text,
                    Password  = PasswordTboxR.Text,
                };

                var push         = client.Set("admin/admininfo/" + UsernameTboxR.Text + "/", am);
                var isadminexist = client.Set("admin/isadminexist", "YES");
                RegPanel.Hide();
                Regbtn.Hide();
                MessageBox.Show("Thank You, " + FirstnameTbox.Text + " " + LastnameTbox.Text + "\nYour Registration is Successfull! \nYou can login now....");
            }
        }
Exemplo n.º 2
0
        public static bool IsEqual(AdminModel user1, AdminModel user2)
        {
            if (user1 == null || user2 == null)
            {
                return(false);
            }

            if (user1.Username != user2.Username)
            {
                error = "Username does not exist!";
                return(false);
            }

            else if (user1.Password != user2.Password)
            {
                error = "Username and Password does not match!";
                return(false);
            }

            return(true);
        }