Ejemplo n.º 1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (!collectionClearance.IsPressed)
            {
                throw new Exception("WPF: You can't sign up if you don't agree to our clearence about collection from bank accounts.");
            }
            if (!BL_Factory.GetBL_Factory().IsDigitsOnly(numberphone.Text))
            {
                throw new Exception("WPF: You can only write numbers in your numberphone.");
            }
            if (!BL_Factory.GetBL_Factory().IsDigitsOnly(banknumber.Text))
            {
                throw new Exception("WPF: You can only write numbers in your banknumber.");
            }
            Host host = new Host();

            host.privateName         = privatename.Text;
            host.lastName            = familyname.Text;
            host.phoneNumber         = int.Parse(numberphone.Text);
            host.mailAddress         = emailaddres.Text;
            host.bankAccountNumber   = int.Parse(banknumber.Text);
            host.collectionClearance = collectionClearance.IsPressed;
            host.key = Configuration.hostSerialKey++;
            bl.AddHost(host);
            App.page1.main.Content = new MainWindow();
        }
        private void Sumbit_Click(object sender, RoutedEventArgs e)
        {
            This_Host.FhoneNumber         = FhoneFill.Text.ToString();
            This_Host.MailAddress         = email.Text.ToString();
            This_Host.BankAccountNumber   = Convert.ToInt32(BankAccountNumberFill.Text);
            This_Host.CollectionClearance = CheckEnums.CheckYes_Or_No(ComboBox_of_YesOrNo.SelectionBoxItem.ToString());

            BankBranch BankAccuont = new BankBranch();

            BankAccuont.BankName      = BankNameFill.Text.ToString();
            BankAccuont.BankNumber    = int.Parse(BankAccountNumberFill.Text); // מספר חשבון בנק
            BankAccuont.BranchNumber  = int.Parse(BankNumberFill.Text);        //מספר סניף
            BankAccuont.BranchAddress = BranchAddressFill.Text.ToString();
            BankAccuont.BranchCity    = BranchCityFill.Text.ToString();

            This_Host.BankAccuont = BankAccuont;

            bl.AddHost(this.This_Host);


            Window_Password window = new Window_Password();

            window.Show();
            this.Close();
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            bL = Factory_BL.getBL();
            Host host = new Host();

            if (bL.IsHostExists(email.Text))
            {
                if (bL.CheckPass(email.Text, pword.Text))
                {
                    this.Close();
                    HostInterface hostInterface = new HostInterface(email.Text);
                    hostInterface.ShowDialog();
                }
                else
                {
                    MessageBox.Show($"The combination of email address and password you entered does not match.", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            else
            {
                if (email.Text == "" || pword.Text == "" || First_name.Text == "" || Last_Name.Text == "" || Phone_number.Text == "" || BankAccountNumber.Text == "")
                {
                    MessageBox.Show($"Please fill all the fields!", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else
                {
                    bL.SetHostKey(host);
                    host.MailAddress       = email.Text;
                    host.Password          = pword.Text;
                    host.FirstName         = First_name.Text;
                    host.LastName          = Last_Name.Text;
                    host.PhoneNumber       = Phone_number.Text;
                    host.BankAccountNumber = int.Parse(BankAccountNumber.Text);
                    if (CollectionClearanceCheckBox.IsChecked == true)
                    {
                        login_button.IsEnabled = false;
                        bL.AddHost(host);
                        this.Close();
                        new HostInterface(email.Text).ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("please accept collections clearance!");
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void CompleteHostRegistration()
        {
            Host host = GetHost(newUser);

            host.BankBranchDetails = new BankBranch()
            {
                BankName = "", BankNumber = 0, BranchAddress = "", BranchCity = "", BranchNumber = 0
            };
            try
            {
                bl.AddHost(host);
                Window hostRegistrationWindow = new HostRegistrationWindow(host);
                hostRegistrationWindow.Show();
                Close();
            }
            catch (BlArgumentNullException)
            {
                MessageBox.Show("There was a problem. Please try again later.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            catch (BlMailAlreadyExistException)
            {
                MessageBox.Show("Mail address already exist in the system. Please try another address.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            catch (BlNickAlreadyExistException)
            {
                MessageBox.Show("Nickname already exist in the system. Please try another nickname.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            catch (BlUsernameInvalidException)
            {
                MessageBox.Show("Username invalid.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            catch (BlPasswordInvalidException)
            {
                MessageBox.Show("Password invalid.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            catch (BlInvalidEmailException)
            {
                MessageBox.Show("Mail address invalid.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            catch (BlFileErrorException)
            {
                MessageBox.Show("There was file error. Please try again later.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Ejemplo n.º 5
0
 private void RegisterButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         myIBL.AddHost(host);
         Window NewLoginWindow = new LoginWindow();
         NewLoginWindow.Show();
         this.Close();
     }
     catch (NotValidPhoneNumberException)
     {
         PhoneNumber.Focus();
         MessageBox.Show("The PhoneNumber you entered is invalid.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     catch (Exception)
     {
         MessageBox.Show("There was a problem!!", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Ejemplo n.º 6
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            if (famillyNameTextBox.Text == "" || privateNameTextBox.Text == "" || mailAddressTextBox.Text == "" || phoneNumberTextBox.Text == "" || hostKeyTextBox.Text == "")
            {
                MessageBox.Show("tu dois remplir tout les champ");
            }
            if (famillyNameTextBox.Text != "" || privateNameTextBox.Text != "" || mailAddressTextBox.Text != "" || phoneNumberTextBox.Text != "" || hostKeyTextBox.Text != "")
            {
                host.FamillyName = famillyNameTextBox.Text;
                host.PrivateName = privateNameTextBox.Text;
                host.MailAddress = mailAddressTextBox.Text;
                host.PhoneNumber = int.Parse(phoneNumberTextBox.Text);
                host.HostKey     = int.Parse(hostKeyTextBox.Text);
                instance.AddHost(host);
                MessageBox.Show("you have been recordeed with success", host.ToString());
                this.Close();
            }

            // MessageBox.Show(host.ToString());
        }
Ejemplo n.º 7
0
        public void saveHost()
        {
            BE.Host host = new BE.Host();
            host.PrivateName1         = privateName1TextBox.Text;
            host.FamilyName1          = familyName1TextBox.Text;
            host.MailAddress1         = mailAddress1TextBox.Text;
            host.PhoneNumber1         = phoneNumber1TextBox.Text;
            host.BankAccountNumber1   = int.Parse(bankAccountNumber1TextBox.Text);
            host.CollectionClearance1 = bool.Parse(collectionClearance1CheckBox.IsChecked.ToString());
            host.BankBranchDetails1   = banky;
            XElement username = new XElement("username", textBoxUserName.Text);
            XElement password = new XElement("password", passwordBox1.Password);

            bl.AddHost(host, textBoxUserName.Text, passwordBox1.Password);
            MessageBox.Show("added to the system, Host Key: " + host.HostKey1);
            SignInPage login = new SignInPage();

            login.Show();
            Close();
        }