Beispiel #1
0
        private void signIn()
        {
            lblErrorID.Visibility = Visibility.Hidden;
            if (txbID.Text == "" || bl.isNotDigit(txbID.Text))
            {
                lblErrorID.Visibility = Visibility.Visible;
                return;
            }

            try
            {
                host.HostKey = int.Parse(txbID.Text);
                bl.GetHost(host.HostKey);
                Window HostSignIn = new HostSignInWindow(host.HostKey);
                this.Hide();
                HostSignIn.ShowDialog();
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "שגיאה", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.None, MessageBoxOptions.RtlReading);
            }
        }
        private void btnAdd_Click_1(object sender, RoutedEventArgs e)
        {
            Refresh();
            bool isReturn = false;

            if (txbName.Text == "" || bl.isHaveDigit(txbName.Text))
            {
                lblErrorName.Visibility = Visibility.Visible;
                isReturn = true;
            }
            if (txbFamilyName.Text == "" || bl.isHaveDigit(txbFamilyName.Text))
            {
                lblErrorFamilyName.Visibility = Visibility.Visible;
                isReturn = true;
            }
            if (!bl.IsValidEmail(txbMail.Text.ToString()))
            {
                lblErrorMail.Visibility = Visibility.Visible;
                isReturn = true;
            }
            if (bl.isNotDigit(txbID.Text))
            {
                lblErrorID.Visibility = Visibility.Visible;
                isReturn = true;
            }
            if (bl.isNotDigit(txbPhone.Text))
            {
                lblErrorPhone.Visibility = Visibility.Visible;
                isReturn = true;
            }
            if (rbtnNo.IsChecked == false & rbtnYes.IsChecked == false)
            {
                lblErrorColectionClearens.Visibility = Visibility.Visible;
                isReturn = true;
            }
            if (cmbBank.SelectedIndex < 0)
            {
                lblErrorBank.Visibility = Visibility.Visible;
                isReturn = true;
            }
            if (cmbBankBranch.SelectedIndex < 0)
            {
                lblErrorBranch.Visibility = Visibility.Visible;
                isReturn = true;
            }
            if (bl.isNotDigit(txbBank.Text))
            {
                lblErrorBankNumber.Visibility = Visibility.Visible;
                isReturn = true;
            }

            if (isReturn)
            {
                return;
            }


            try
            {
                BankBranch bankBranch = new BankBranch()
                {
                    BankNumber    = ((BankBranch)cmbBank.SelectedItem).BankNumber,
                    BankName      = ((BankBranch)cmbBank.SelectedItem).BankName,
                    BranchAddress = ((BankBranch)cmbBankBranch.SelectedItem).BranchAddress,
                    BranchCity    = ((BankBranch)cmbBankBranch.SelectedItem).BranchCity,
                    BranchNumber  = ((BankBranch)cmbBankBranch.SelectedItem).BranchNumber
                };

                host.BankBranchDetails = bankBranch;

                bl.addHost(host);

                Window HostSignIn = new HostSignInWindow(host.HostKey);
                this.Hide();
                HostSignIn.ShowDialog();
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "שגיאה");
            }
        }