Пример #1
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";
            //}
        }
Пример #2
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;;
     }
 }
Пример #3
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();
        }