Exemplo n.º 1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string email = txtEmail.Text;
            string pass  = txtPassword.Text;

            if (email.Length >= 4 && pass.Length >= 4)
            {
                if (UserStore.Login(email, pass))
                {
                    TempEmployee.currentUser = UserStore.GetUserByEmail(email);
                    UserStack res = new UserStack();
                    this.Hide();
                    res.ShowDialog();
                    this.Close();
                }
            }
        }
        private void btnUser_Click(object sender, EventArgs e)
        {
            string name     = txtName.Text;
            string email    = txtEmail.Text;
            string password = txtPassword.Text;

            if (name.Trim().Length >= 3 && email.Trim().Length >= 5 && password.Trim().Length >= 4)
            {
                if (UserStore.CanCreateUser(email))
                {
                    User obj = new User(email, password, name);
                    UserStore.AddNewUser(obj);
                    TempEmployee.currentUser = obj;
                    UserStack usr = new UserStack();
                    this.Hide();
                    usr.ShowDialog();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Kjo email ekziston tashme !");
                }
            }
        }