Esempio n. 1
0
 public BankAccountEdit()
 {
     InitializeComponent();
     Bank = new BankAccount();
     Cust = new Customer();
     AccountNo.Enabled = true;
     Interest.Enabled  = true;
     OpenDate.Enabled  = true;
     Info.Text         = "Enter Account #. then any fields may be changed";
     AccountNo.Focus();
 }
 //*************************************************************************************************************//
 public CustomerEdit( )
 //*************************************************************************************************************//
 {
     InitializeComponent( );
     Cust          = new Customer( );
     Bank          = new BankAccount( );
     act1.ReadOnly = false;
     act2.ReadOnly = false;
     act3.ReadOnly = false;
     act4.ReadOnly = false;
     AccountNo.Focus( );
 }
Esempio n. 3
0
        //*************************************************************************************************************************************************//
        // Find the customer record
        private void findbank_Click_1(object sender, EventArgs e)
        //*************************************************************************************************************************************************//
        {
            accno = AccountNo.Text;
            if (accno == "")
            {
                MessageBox.Show("You MUST enter a valid Bank Account number. They start at 1050000", "A/C number entry Error");
                // lots of work to prefill  # and put cursor at end of it with text
                // unselected. so user can just start typing numbers
                AccountNo.Text = "123";
                AccountNo.Focus();
                AccountNo.SelectionLength = 0;
                AccountNo.SelectionStart  = AccountNo.Text.Length;
                return;
            }
            if (Convert.ToInt32(accno) < 1050000)
            {
                MessageBox.Show("Invalid Entry - The Bank Account numbers start at 105000.", "File number entry Error");
                return;
            }
            // housekeeping
            allbankaccounts.Items.Clear();
            // Now get the bank account for this customer
            //Now we know the "main" Bank Account # anyway to read details of
            try
            {
                Bank = Search.FindBankObjectfromBankNo(accno);
                if (Bank == null)
                {
                    MessageBox.Show("There was a problem finding the BankAccount # " + accno + " you entered...\n              Please try again ! ", "File Access problem"); return;
                }
            }
            catch
            {
                MessageBox.Show("There was a problem finding the BankAccount file " + accno, "File Access problem");
                return;
            }
            Custno.Text         = Bank.CustAccountNumber.ToString();
            AccountBalance.Text = Bank.Balance.ToString();
            Interest.Text       = Bank.InterestRate.ToString();
            OpenDate.Text       = Bank.DateOpened.ToShortDateString();
            if (Bank.Status == 0)
            {
                status.Text = "**Closed**";
            }
            else if (Bank.Status == 1)
            {
                status.Text = "Active";
            }
            else if (Bank.Status == 2)
            {
                status.Text = "Suspended";
            }
            try
            {
                Cust = Customer.GetCustomerAccount(Bank.CustAccountNumber.ToString());
                if (Cust == null)
                {
                    MessageBox.Show("Unable to find the Customer Record from LinkedList", "Database system ERROR");
                    button1_Click_1(sender, e);         // Clear the data form the screen
                    return;
                }
            }
            catch
            {
                new Exception(" Unable to load Customer account in bankaccountedit.cs, Line 55");
            }
            int typevalue = 0;

            for (int i = 0; i < 4; i++)
            {
                if (Cust.accountnums[i] > 0)
                {
                    typevalue = Cust.accounttypes[i];
                    string output = Cust.accountnums[i].ToString() + "\t" + typevalue.ToString();
                    allbankaccounts.Items.Add(output);
                }
            }

            /*				if ( Cust . accountnums [ i ] . ToString ( ) == AccountNo . Text )
             *                                          {
             *                                                  // got the matching account
             *                                                  // load thre combo of bank accounts
             *                                                  if ( Cust . accountnums [i ] > 0 )
             *                                                  {
             *                                                          typevalue = Cust . accounttypes [ i ];
             *                                                          string output = Cust . accountnums [ 0 ] . ToString ( ) + "\t" + typevalue . ToString ( );
             *                                                          allbankaccounts . Items . Add ( output );
             *                                                  }
             *          /*
             *                                                  if ( Cust . accountnums [ 1 ] > 0 )
             *                                                  {
             *                                                          typevalue = Cust . accounttypes [ 1 ];
             *                                                          string output = Cust . accountnums [ 1 ] . ToString ( ) + "\t" + typevalue . ToString ( );
             *                                                          allbankaccounts . Items . Add ( output );
             *                                                  }
             *                                                  if ( Cust . accountnums [ 2 ] > 0 )
             *                                                  {
             *                                                          typevalue = Cust . accounttypes [ 2 ];
             *                                                          string output = Cust . accountnums [ 2 ] . ToString ( ) + "\t" + typevalue . ToString ( );
             *                                                          allbankaccounts . Items . Add ( output );
             *                                                  }
             *                                                  if ( Cust . accountnums [ 3 ] > 0 )
             *                                                  {
             *                                                          typevalue = Cust . accounttypes [ 3 ];
             *                                                          string output = Cust . accountnums [ 3 ] . ToString ( ) + "\t" + typevalue . ToString ( );
             *                                                          allbankaccounts . Items . Add ( output );
             *                                                  }
             *
             *                                          }
             */
            AccountType.SelectedIndex     = typevalue - 1;
            allbankaccounts.SelectedItem  = 1;
            allbankaccounts.SelectedIndex = 0;// Text = allbankaccounts. SelectedItem. ToString ( );
            SaveBankButton.Enabled        = true;
            button1.Enabled = true;
            Exit.Enabled    = true;
            // fill out ALL the fields
            // Customer first
            fname.Text    = Cust.FirstName;
            lname.Text    = Cust.LastName;
            day.Text      = Cust.DOB.Day.ToString();
            month.Text    = Cust.DOB.Month.ToString();
            year.Text     = Cust.DOB.Year.ToString();
            day.Text      = Cust.DOB.Day.ToString();
            month.Text    = Cust.DOB.Month.ToString();
            year.Text     = Cust.DOB.Year.ToString();
            fname.Text    = Cust.FirstName;
            lname.Text    = Cust.LastName;
            addr1.Text    = Cust.Address1;
            addr2.Text    = Cust.Address2;
            town.Text     = Cust.Town;
            county.Text   = Cust.County;
            postcode.Text = Cust.PostCode;
            phone.Text    = Cust.PhoneNumber;
            mobile.Text   = Cust.MobileNumber;

            /*                  // Bank account fields //
             *        internal Int32 BankAccountNumber = 0;	  // Secondary key
             *                                                          internal Int32 CustAccountNumber = 0; // major key
             *                                                          internal Int16 AccountType = 0;        // minor key
             *                                                          internal decimal  Balance = 0.00;
             *                                                          internal DateTime DateOpened;
             *                                                          internal DateTime DateClosed;// We do not fill this out.
             *                                                          internal decimal  InterestRate = 3.75;    // Default value only
             *                                                          internal Int16 Status = 1; // Status can be 0-Closed, 1- Active, 2-Suspended
             */
        }