Esempio n. 1
0
        //get and populate full account and holder details (for edit and view)
        private void GetAndPopulateAccountAndHolderDetails(int accNumber)
        {
            Account        acc;
            BLLAccountMgmt bllAM = new BLLAccountMgmt();

            acc = bllAM.GetAccountDetailsBLL(accNumber);


            //get holder details
            int           holderID = acc.AccountHolderID;
            AccountHolder accHold;

            accHold = bllAM.GetAccHolderDetailsBLL(holderID);

            if (accHold.FirstName != null)
            {
                //display holder details
                txtManAccPFullDetFName.Text          = accHold.FirstName;
                txtManAccPFullDetLName.Text          = accHold.Surname;
                txtManAccPFullDetEmail.Text          = accHold.Email;
                txtManAccPFullDetPho.Text            = accHold.Phone;
                txtManAccPFullDetAddr1.Text          = accHold.Address1;
                txtManAccPFullDetAddr2.Text          = accHold.Address2;
                txtManAccPFullDetCity.Text           = accHold.City;
                cmbManAccPFullDetCounty.SelectedItem = accHold.County;
                txtManAccPFullDetAccHolder.Text      = accHold.ID.ToString();

                //display account details
                txtManAccPFullDetAccNo.Text  = acc.Id.ToString();
                txtManAccPFullDetSortC.Text  = acc.SortCode;
                txtManAccPFullDetIntBal.Text = acc.Balance.ToString();



                if (acc.Type.ToString().ToLower() == "current")
                {
                    rbtManAccPFullDetCurrent.Checked = true;
                    txtManAccPFullDetIntRate.Enabled = false;
                }

                else if (acc.Type.ToString().ToLower() == "savings")
                {
                    rbtManAccPFullDetSavings.Checked = true;
                    txtManAccPFullDetOverdr.Enabled  = false;
                }


                txtManAccPFullDetOverdr.Text  = acc.OverdraftLimit.ToString();
                txtManAccPFullDetIntRate.Text = acc.InterestRate.ToString();
            }

            else
            {
                MessageBox.Show("Entered account does not exist");
                BackToHomeGridView();
            }
        }
Esempio n. 2
0
        // Method to load account holder only
        private bool LoadAccountHolder(int holderId, ref AccountHolder holder)
        {
            bool          loaded;
            AccountHolder tempHolder;

            loaded = false;

            BLLAccountMgmt bllAM = new BLLAccountMgmt();

            tempHolder = bllAM.GetAccHolderDetailsBLL(holderId);

            if ((tempHolder != null) && (tempHolder.ID != 0))
            {
                loaded = true;
                // if account holder is not a default empty one, assign reference
                holder = tempHolder;
            }

            return(loaded);
        }
Esempio n. 3
0
        //CLICK Next, go to full details page to create account
        private void btnAccManPNewAccNext_Click(object sender, EventArgs e)
        {
            //an option not selected
            if (!rbtnAccManPNewAccNewMem.Checked && !rbtnAccManPNewAccExistingMem.Checked)
            {
                MessageBox.Show("Please select one option");
            }


            //an option is selected
            else
            {
                //****** Existing holder  /   New holder options ********

                string nextHolderID;
                string nextAccNo;
                int    accHolderID = 0;


                //prepare full details panel for adding an account to an EXISTING holder
                if (rbtnAccManPNewAccExistingMem.Checked)
                {
                    //read-only holder fields
                    txtManAccPFullDetFName.ReadOnly = true;
                    txtManAccPFullDetLName.ReadOnly = true;
                    txtManAccPFullDetPho.ReadOnly   = true;
                    txtManAccPFullDetEmail.ReadOnly = true;
                    txtManAccPFullDetAddr1.ReadOnly = true;
                    txtManAccPFullDetAddr2.ReadOnly = true;
                    txtManAccPFullDetCity.ReadOnly  = true;
                    cmbManAccPFullDetCounty.Enabled = false;


                    //validate user input - account holder ID
                    int    outInt;
                    string input = txtManAccPNewAccAccHolder.Text;

                    bool isAnInt = int.TryParse(input, out outInt);

                    if (!isAnInt)
                    {
                        MessageBox.Show("Please enter a  valid account holder ID");
                        txtManAccPNewAccAccHolder.Text = "";
                    }


                    if (isAnInt)
                    {
                        //prepare next panel and display it

                        //read only acc holder details
                        txtManAccPFullDetAccHolder.ReadOnly = true;
                        //read only account details
                        txtManAccPFullDetSortC.ReadOnly = true;
                        txtManAccPFullDetAccNo.ReadOnly = true;



                        //hide/show relevant buttons
                        btnManAccPFullDetSerialize.Visible   = false;
                        btnManAccPFullDetDeserialize.Visible = false;
                        btnManAccPFullDetCancel.Visible      = true;
                        btnManAccPFullDetSaveEdit.Visible    = false;
                        btnManAccPFullDetClose.Visible       = false;
                        btnManAccPFullDetSubmitNew.Visible   = true;

                        //display full details panel
                        panelManAccFullDet.Visible       = true;
                        panelManAccEditSearch.Visible    = true;
                        panelManAccViewAccSearch.Visible = true;


                        //grab holder ID
                        accHolderID = int.Parse(txtManAccPNewAccAccHolder.Text);

                        AccountHolder ah;

                        BLLAccountMgmt bllAM = new BLLAccountMgmt();
                        ah = bllAM.GetAccHolderDetailsBLL(accHolderID); //get holder details

                        nextAccNo = bllAM.GetNextAccNoBLL().ToString(); //get next account number


                        if (ah.FirstName != null) //check if holder details arrived from DB
                        {
                            //holder details
                            txtManAccPFullDetFName.Text          = ah.FirstName;
                            txtManAccPFullDetLName.Text          = ah.Surname;
                            txtManAccPFullDetEmail.Text          = ah.Email;
                            txtManAccPFullDetPho.Text            = ah.Phone;
                            txtManAccPFullDetAddr1.Text          = ah.Address1;
                            txtManAccPFullDetAddr2.Text          = ah.Address2;
                            txtManAccPFullDetCity.Text           = ah.City;
                            cmbManAccPFullDetCounty.SelectedItem = ah.County;
                            txtManAccPFullDetAccHolder.Text      = ah.ID.ToString();
                            //account details
                            txtManAccPFullDetAccNo.Text = nextAccNo;
                            txtManAccPFullDetSortC.Text = sortCode;
                        }


                        else if (ah.FirstName == null)
                        {
                            MessageBox.Show("Account holder not found");

                            BackToHomeGridView();
                        }
                    }
                }



                ////prepare full details panel for adding an account to a NEW holder
                if (rbtnAccManPNewAccNewMem.Checked)
                {
                    //Display next holder id and next account number

                    BLLAccountMgmt bllAM = new BLLAccountMgmt();

                    nextHolderID = bllAM.GetNextHolderIDBLL().ToString();
                    nextAccNo    = bllAM.GetNextAccNoBLL().ToString();


                    txtManAccPFullDetAccHolder.Text = nextHolderID;
                    txtManAccPFullDetAccNo.Text     = nextAccNo;


                    //display sort code from App.config
                    txtManAccPFullDetSortC.Text = sortCode;


                    //prepare next panel and display it

                    //read only acc holder details
                    txtManAccPFullDetAccHolder.ReadOnly = true;
                    //read only account details
                    txtManAccPFullDetSortC.ReadOnly = true;
                    txtManAccPFullDetAccNo.ReadOnly = true;



                    //hide/show relevant buttons
                    btnManAccPFullDetSerialize.Visible   = false;
                    btnManAccPFullDetDeserialize.Visible = false;
                    btnManAccPFullDetCancel.Visible      = true;
                    btnManAccPFullDetSaveEdit.Visible    = false;
                    btnManAccPFullDetClose.Visible       = false;
                    btnManAccPFullDetSubmitNew.Visible   = true;

                    //display full details panel
                    panelManAccFullDet.Visible       = true;
                    panelManAccEditSearch.Visible    = true;
                    panelManAccViewAccSearch.Visible = true;
                }
            }
        } //end of "add new account" event  *********************