Ejemplo n.º 1
0
        private void btnSignOut_Click(object sender, EventArgs e)
        {
            UserSingleton.LogOutUser();
            this.Hide();

            SignInRegPg.GetInstance();
        }
Ejemplo n.º 2
0
        private void btnSignOut_Click(object sender, EventArgs e)
        {
            this.Hide();

            SignInRegPg.GetInstance();

        }
Ejemplo n.º 3
0
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     //Application.Run(new MainForm());
     //Application.Run(new HomePage());
     Application.Run(SignInRegPg.GetInstance()); // new sign in page.
     //Application.Run(new ShoppingPg());
 }
Ejemplo n.º 4
0
 public static SignInRegPg GetInstance()
 {
     if (instance == null)
     {
         instance = new SignInRegPg();
         instance.InitializeComponent();
     }
     instance.Initialize();
     instance.Show();
     return(instance);
 }
Ejemplo n.º 5
0
        private void btnBackToLoginPg_Click(object sender, EventArgs e)
        {
            FirstNameBox.Text   = "";
            LastNameBox.Text    = "";
            PhoneNumberBox.Text = "";
            AddressBox.Text     = "";
            EmailBox.Text       = "";
            UsernameBox.Text    = "";
            PasswordBox.Text    = "";
            this.Hide();

            SignInRegPg.GetInstance();
        }
Ejemplo n.º 6
0
        private void SaveUserButton_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(FirstNameBox.Text))
            {
                MessageBox.Show("Please Enter First Name");
                return;
            }
            else if (String.IsNullOrEmpty(LastNameBox.Text))
            {
                MessageBox.Show("Please Enter Last Name");
                return;
            }
            else if (String.IsNullOrEmpty(PhoneNumberBox.Text))
            {
                MessageBox.Show("Please Enter Phone Number");
                return;
            }
            else if (String.IsNullOrEmpty(AddressBox.Text))
            {
                MessageBox.Show("Please Enter Address");
                return;
            }
            if (String.IsNullOrEmpty(EmailBox.Text))
            {
                MessageBox.Show("Please Enter Email");
                return;
            }
            else if (String.IsNullOrEmpty(UsernameBox.Text))
            {
                MessageBox.Show("Please Enter Username");
                return;
            }
            else if (String.IsNullOrEmpty(PasswordBox.Text))
            {
                MessageBox.Show("Please Enter Password");
            }
            LoginCTRL loginctrl = new LoginCTRL();

            foreach (Login l in loginctrl.getAllLogins())
            {
                if (l.UserName == UsernameBox.Text)
                {
                    MessageBox.Show("Username Already Exists");
                    return;
                }
            }
            User user = new User();

            user.FirstName   = FirstNameBox.Text;
            user.LastName    = LastNameBox.Text;
            user.PhoneNumber = PhoneNumberBox.Text;
            user.Address     = AddressBox.Text;
            user.Email       = EmailBox.Text;
            DateTime dateValue;

            if (DateTime.TryParse(DOBBox.Text, out dateValue))
            {
                user.DateOfBirth = dateValue;
            }
            else
            {
                MessageBox.Show("DATE OF BIRTH MUST BE OF TYPE MM/DD/YYYY");
                return;
            }
            if (MaleButton.Checked)
            {
                user.Gender = "male";
            }
            else
            {
                user.Gender = "female";
            }
            user.IsAdmin = false;
            user.ID      = loginctrl.saveLoginInfo(UsernameBox.Text, PasswordBox.Text);
            UserCTRL userctrl = new UserCTRL();

            userctrl.addUser(user, user.ID);
            MessageBox.Show("REGISTRATION COMPLETE, PLEASE LOGIN");
            FirstNameBox.Text   = "";
            LastNameBox.Text    = "";
            PhoneNumberBox.Text = "";
            AddressBox.Text     = "";
            EmailBox.Text       = "";
            UsernameBox.Text    = "";
            PasswordBox.Text    = "";
            this.Hide();

            SignInRegPg.GetInstance();
        }