Ejemplo n.º 1
0
 private void signUp_Click(object sender, EventArgs e)
 {
     if (String.IsNullOrEmpty(usernametxt.Text) || String.IsNullOrEmpty(passwordTxt.Text))
     {
         CustomMessabeBox customMessabeBox = new CustomMessabeBox();
         customMessabeBox.messageText("Please enter both credential!");
         customMessabeBox.messageType("Warning");
         customMessabeBox.messagebarColour("Red");
         customMessabeBox.ShowDialog();
     }
     else
     {
         DataSet data = DatabaseConnection.GetDataDB("*", "Users", "Username = '******'");
         if (data.Tables[0].Rows.Count == 0)
         {
             CustomMessabeBox customMessabeBox = new CustomMessabeBox();
             customMessabeBox.messageText("Wrong credential inputed!");
             customMessabeBox.messageType("Warning");
             customMessabeBox.messagebarColour("Red");
             customMessabeBox.ShowDialog();
         }
         else
         {
             login login = new login();
             login.ShowDialog();
         }
     }
 }
Ejemplo n.º 2
0
        private void signUp_Click(object sender, EventArgs e)
        {
            string shopName      = shopNametxt.Text;
            string firstname     = firstnameTxt.Text;
            string surname       = surnameTxt.Text;
            string contactNumber = contactNumberTxt.Text;
            string username      = usernametxt.Text;
            string password      = passwordTxt.Text;
            string confPassword  = confPasswordTxt.Text;
            string key           = keyTxt.Text;

            if (String.IsNullOrEmpty(shopName) || String.IsNullOrEmpty(firstname) || String.IsNullOrEmpty(surname) || String.IsNullOrEmpty(contactNumber) ||
                String.IsNullOrEmpty(username) || String.IsNullOrEmpty(password) || String.IsNullOrEmpty(confPassword) || String.IsNullOrEmpty(key))
            {
                messabeBox.messageText("Some information are empty!");
                messabeBox.messageType("Warning");
                messabeBox.messagebarColour("Red");
                messabeBox.ShowDialog();
            }
            else
            {
                if (password.Equals(confPassword))
                {
                    DatabaseConnection.InsetDataDB("ShopInfo", "ShopName,OwnerName,OwnerSurname,Key,Validated",
                                                   shopName + "," + firstname + "," + surname + "," + key + "," + "1");
                    DatabaseConnection.InsetDataDB("Users", "Firstname, Surname, Username, Password, Role, ContactNumber",
                                                   firstname + "," + surname + "," + username.ToLower() + "," + password + "," + "SuperAdmin" + "," + contactNumber);
                    this.Close();
                    messabeBox.messageText("Thank you for using Icarus");
                    messabeBox.ShowDialog();
                }
                else
                {
                    messabeBox.messageText("Passwords do not match!");
                    messabeBox.messageType("Warning");
                    messabeBox.messagebarColour("Red");
                    messabeBox.ShowDialog();
                }
            }
        }