예제 #1
0
 private void RegisterButton_Click(object sender, EventArgs e)
 {
     System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
     try
     {
         var register = new LoginViewBusiness();
         if (register.Register(firstNameField.Text, lastNameField.Text, emailField.Text, usernameField.Text, passwordField.Text, 1) == true)
         {
             var newForm = new LoginScreen();
             this.Hide();
             MessageBox.Show("Регистрацията ви е успешна");
             newForm.Show();;
         }
         else
         {
             errorMsgLabel.Text      = "Такъв потребител вече съществува";
             errorMsgLabel.ForeColor = Color.Red;
         };
     }
     catch (ArgumentNullException)
     {
         errorMsgLabel.Text      = "Не може да оставяте полета празни";
         errorMsgLabel.ForeColor = Color.Red;;
     }
 }
예제 #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            var reg = new LoginViewBusiness();

            try
            {
                if (reg.Register(RegFirstName.Text, RegLastName.Text, RegEmail.Text, RegUsername.Text, RegPass.Text, int.Parse(RegStorageId.Text)))
                {
                    label1.Text = "Succeeded";
                }
                else
                {
                    label1.Text = "Failed";
                }
            }
            catch (FormatException)
            {
                label1.Text = "Fields Cannot be Empty!";
            }

            //try
            //{
            //    var login = new LoginViewBusiness();
            //    if (login.Login(RegUsername.Text, RegPass.Text))
            //    {
            //        label1.Text = "Succeeded";
            //    }
            //    else label1.Text = "Failed";
            //}
            //catch (ArgumentNullException)
            //{
            //    label1.Text = "Login or Password fields are empty";
            //}
        }
예제 #3
0
 private void LoginButton_Click(object sender, EventArgs e)
 {
     System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
     try
     {
         var login = new LoginViewBusiness();
         if (login.Login(UsernameField.Text, PasswordField.Text) == true)
         {
             var    employeeName = new EmployeeBusiness();
             string firstName    = employeeName.GetEmployeeFirstName(UsernameField.Text);
             string lastName     = employeeName.GetEmployeeLastName(UsernameField.Text);
             var    newForm      = new MainScreen(firstName, lastName);
             this.Hide();
             newForm.Show();;
         }
         else
         {
             ErrorMsgLabel.Text      = "Грешно потребителско име или парола";
             ErrorMsgLabel.ForeColor = Color.Red;
         };
     }
     catch (ArgumentNullException)
     {
         ErrorMsgLabel.Text      = "Грешка във въведените данни";
         ErrorMsgLabel.ForeColor = Color.Red;;
     }
 }
예제 #4
0
        private void RegisterButton_Click(object sender, EventArgs e)
        {
            var register = new LoginViewBusiness();

            register.Register(firstNameField.Text, lastNameField.Text, emailField.Text, usernameField.Text, passwordField.Text, 1);
            this.Hide();
            var newForm = new LoginScreen();

            MessageBox.Show("Регистрацията ви е успешна");
            newForm.Show();
        }
예제 #5
0
        private void LoginButton_Click(object sender, EventArgs e)
        {
            ErrorMsgLabel.Text      = "Зареждане...";
            ErrorMsgLabel.ForeColor = Color.Blue;
            Thread.Sleep(1000);
            var login = new LoginViewBusiness();

            if (login.Login(UsernameField.Text, PasswordField.Text) == true)
            {
                this.Hide();
                var newForm = new MainMenu();
                newForm.Show();
            }
            else
            {
                ErrorMsgLabel.Text      = "Грешно потребителско име или парола";
                ErrorMsgLabel.ForeColor = Color.DarkRed;
                Thread.Sleep(1000);
                ErrorMsgLabel.ForeColor = Color.IndianRed;
                Thread.Sleep(1000);
                ErrorMsgLabel.ForeColor = Color.Red;
            }
        }