Esempio n. 1
0
        private void FrmCreateAccount_Load(object sender, EventArgs e)
        {
            dtpdob.MaxDate = DateTime.Today;

            string[] countryarr = { "countryid", "CONCAT(country,CONCAT(' ',CONCAT('(',CONCAT(code,')')))) AS country", "country_code" };
            string[] countyarr  = { "countyid", "county", "county" };
            DataSet  countryds  = new DataSet();
            DataSet  countyds   = new DataSet();

            try
            {
                countryds = Reusable.dsfromDB(countryarr);
                cboCountryCode.ValueMember   = "countryid";
                cboCountryCode.DisplayMember = "country";
                cboCountryCode.DataSource    = countryds.Tables[0];
            }
            catch
            {
                MessageBox.Show("Error 003: Could not connect to database. Please contact an administratior");
            }
            try
            {
                countyds = Reusable.dsfromDB(countyarr);
                cboCounty.ValueMember   = "countyid";
                cboCounty.DisplayMember = "county";
                cboCounty.DataSource    = countyds.Tables[0];
            }
            catch
            {
                MessageBox.Show("Error 004: Could not connect to database. Please contact an administratior");
            }
        }
        private void FrmUpdateAccount_Load(object sender, EventArgs e)
        {
            string[] Accountarr     = { "accountid", "CONCAT(Name,CONCAT(' - ',accountid)) AS display_name", "account WHERE Status = 'A' AND CUSTOMERID = " + Customer.CustomerId + " ORDER BY ACCOUNTID" };
            string[] Accounttypearr = { "id", "Name", "account_type" };
            DataSet  Accountds      = new DataSet();
            DataSet  Accounttypeds  = new DataSet();

            try
            {
                Accountds = Reusable.dsfromDB(Accountarr);
                cboAccount.ValueMember   = "accountid";
                cboAccount.DisplayMember = "display_name";
                cboAccount.DataSource    = Accountds.Tables[0];
            }
            catch
            {
                MessageBox.Show("Error 006: Could not connect to database. Please contact an administratior");
            }

            try
            {
                Accounttypeds         = Reusable.dsfromDB(Accounttypearr);
                cboType.ValueMember   = "id";
                cboType.DisplayMember = "NAME";
                cboType.DataSource    = Accounttypeds.Tables[0];
            }
            catch
            {
                MessageBox.Show("Error 006: Could not connect to database. Please contact an administratior");
            }
        }
        private void FrmTransactionChart_Load(object sender, EventArgs e)
        {
            //string[] MinDateSQL = { "Min(to_Char(DATE_Created, 'YYYY'))", "account WHERE status = 'A' AND CUSTOMERID = " + Customer.CustomerId + " ORDER BY ACCOUNTID" };
            string[] AccountSQL = { "accountid", "CONCAT(Name,CONCAT(' - ',accountid)) AS display_name", "account WHERE status = 'A' AND CUSTOMERID = " + Customer.CustomerId + " ORDER BY ACCOUNTID" };

            //nudYear.Maximum = Convert.ToDecimal(DateTime.Now.ToString("yyyy"));
            //nudYear.Minimum = Convert.ToDecimal(Reusable.stringfromDB(MinDateSQL));

            DataSet Accountds = new DataSet();

            chtTransactions.Titles.Add("Monthly Balance");
            try
            {
                Accountds = Reusable.dsfromDB(AccountSQL);
                cboAccount.ValueMember   = "accountid";
                cboAccount.DisplayMember = "display_name";
                cboAccount.DataSource    = Accountds.Tables[0];
                nudYear.Value            = Convert.ToDecimal(DateTime.Now.ToString("yyyy"));
                PopulateChart(cboAccount.SelectedValue.ToString());
            }
            catch
            {
                cboAccount.Text = "Error!";
                MessageBox.Show("Error 010: Could not connect to database. Please contact an administratior");
            }
        }
Esempio n. 4
0
        private void cboCreditorAccount_SelectedIndexChanged(object sender, EventArgs e)
        {
            string[] Accountinfo = { "Balance", "ACCOUNT WHERE AccountID = " + cboCreditorAccount.SelectedValue };
            DataSet  Accounts    = new DataSet();

            try
            {
                Accounts = Reusable.dsfromDB(Accountinfo);
                lblBalanceAmount.Text = "€" + Accounts.Tables[0].Rows[0][0].ToString();
            }
            catch
            {
            }
        }
        public void FillGroupBox()
        {
            string[] Transactionsarr = { "T.TransactionID", "Y.NAME", "T.note", "T.Amount", "T.Timestamp", "Transaction T INNER JOIN Transaction_Type Y ON T.TYPE = Y.Type_Code WHERE AccountID = " + cboAccount.SelectedValue + " ORDER BY TransactionID DESC" };
            DataSet  accounts        = new DataSet();

            try
            {
                accounts = Reusable.dsfromDB(Transactionsarr);
                dataGridView1.DataSource = accounts.Tables[0];
            }
            catch
            {
                MessageBox.Show("Error 002: Could not connect to database. Please contact an administratior");
            }
        }
Esempio n. 6
0
        private void cboAccount_SelectedIndexChanged(object sender, EventArgs e)
        {
            string[] Accountinfo = { "Balance", "ACCOUNT WHERE AccountID = " + cboAccount.SelectedValue };
            DataSet  Accounts    = new DataSet();

            try
            {
                Accounts = Reusable.dsfromDB(Accountinfo);
                lblBalanceAmount.Text = "€" + Accounts.Tables[0].Rows[0][0].ToString();
            }
            catch
            {
                lblBalanceAmount.Text = "Error!";
                MessageBox.Show("Error 015: Could not connect to database. Please contact an administratior");
            }
        }
Esempio n. 7
0
        public void DisplayTransactionhistory()
        {
            string[] Transactioninfo = new string[5];
            Transactioninfo[0] = "T.TransactionID";
            Transactioninfo[1] = "Y.name";
            Transactioninfo[2] = "T.Amount";
            Transactioninfo[3] = "T.Note";
            Transactioninfo[4] = "Transaction T INNER JOIN Transaction_TYPE Y ON T.TYPE = Y.Type_code WHERE AccountID = " + cboAccount.SelectedValue + " ORDER BY TransactionID DESC";

            DataSet Transactions = new DataSet();

            Transactions = Reusable.dsfromDB(Transactioninfo);
            for (int i = 0; i < Transactions.Tables[0].Rows.Count && i < 10; i++)
            {
                //Create label
                Label TransactionID      = new Label();
                Label Transaction_Type   = new Label();
                Label Transaction_Amount = new Label();
                Label Transaction_Note   = new Label();

                //Add Text
                TransactionID.Text      = Transactions.Tables[0].Rows[i]["TransactionID"].ToString();
                Transaction_Type.Text   = Transactions.Tables[0].Rows[i]["name"].ToString();
                Transaction_Amount.Text = "€" + Transactions.Tables[0].Rows[i]["Amount"].ToString();
                Transaction_Note.Text   = Transactions.Tables[0].Rows[i]["Note"].ToString();

                //properties
                TransactionID.Left           = 0;
                TransactionID.Top            = ((i + 1) * 25) + 75;
                Transaction_Type.Left        = 100;
                Transaction_Type.Top         = ((i + 1) * 25) + 75;
                Transaction_Amount.Left      = 500;
                Transaction_Amount.Top       = ((i + 1) * 25) + 75;
                Transaction_Amount.Width     = 75;
                Transaction_Amount.AutoSize  = false;
                Transaction_Amount.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
                Transaction_Note.Top         = ((i + 1) * 25) + 75;
                Transaction_Note.Left        = 200;
                Transaction_Note.Width       = 350;

                //Add form
                this.Controls.Add(TransactionID);
                this.Controls.Add(Transaction_Type);
                this.Controls.Add(Transaction_Amount);
                this.Controls.Add(Transaction_Note);
            }
        }
Esempio n. 8
0
        public void FillcboBox()
        {
            string[] Account   = { "accountid", "CONCAT(Name,CONCAT(' - ',accountid)) AS display_name", "account WHERE Status = 'A' AND CUSTOMERID = " + Customer.CustomerId + " ORDER BY ACCOUNTID" };
            DataSet  Accountds = new DataSet();

            try
            {
                Accountds = Reusable.dsfromDB(Account);
                cboAccount.ValueMember   = "accountid";
                cboAccount.DisplayMember = "display_name";
                cboAccount.DataSource    = Accountds.Tables[0];
            }
            catch
            {
                MessageBox.Show("Error 006: Could not connect to database. Please contact an administratior");
            }
        }
Esempio n. 9
0
        private void FrmWithdraw_Load(object sender, EventArgs e)
        {
            string[] Account   = { "accountid", "CONCAT(Name,CONCAT(' - ',accountid)) AS display_name", "account WHERE status = 'A' AND CUSTOMERID = " + Customer.CustomerId + " ORDER BY ACCOUNTID" };
            DataSet  Accountds = new DataSet();

            try
            {
                Accountds = Reusable.dsfromDB(Account);
                cboAccount.ValueMember   = "accountid";
                cboAccount.DisplayMember = "display_name";
                cboAccount.DataSource    = Accountds.Tables[0];
            }
            catch
            {
                cboAccount.Text = "Error!";
                MessageBox.Show("Error 014: Could not connect to database. Please contact an administratior");
            }
        }
        private void cboAccount_SelectedIndexChanged(object sender, EventArgs e)
        {
            string[] Accountinfoarr = { "accountid", "Name", "Type", "account WHERE AccountID = " + cboAccount.SelectedValue };
            DataSet  Accountinfo    = new DataSet();

            try
            {
                FillGroupBox();
                Accountinfo           = Reusable.dsfromDB(Accountinfoarr);
                txtAccountNumber.Text = Accountinfo.Tables[0].Rows[0][0].ToString();
                txtName.Text          = Accountinfo.Tables[0].Rows[0][1].ToString();
                cboType.SelectedValue = Convert.ToInt32(Accountinfo.Tables[0].Rows[0][2].ToString());
            }
            catch
            {
                MessageBox.Show("Error 006: Could not connect to database. Please contact an administratior");
            }
        }
Esempio n. 11
0
        private void FrmCreatAccount_Load(object sender, EventArgs e)
        {
            string[] AccountTypes   = { "id", "name", "Account_type" };
            DataSet  AccountTypesds = new DataSet();

            try
            {
                AccountTypesds               = Reusable.dsfromDB(AccountTypes);
                cboAccountType.ValueMember   = "id";
                cboAccountType.DisplayMember = "name";
                cboAccountType.DataSource    = AccountTypesds.Tables[0];
                lblDisplayName.Text          = cboAccountType.Text;
            }
            catch
            {
                cboAccountType.Text = "Error!";
                MessageBox.Show("Error 008: Could not connect to database. Please contact an administratior");
            }
        }
        private void FrmTerminateCustomer_Load(object sender, EventArgs e)
        {
            txtFName.Text     = Customer.Fname;
            txtLName.Text     = Customer.Lname;
            txtPhoneNo.Text   = Customer.CountryCode + Customer.PhoneNo;
            txtDOB.Text       = Customer.DOB;
            txtAddressL1.Text = Customer.AddressL1;
            txtAddressL2.Text = Customer.AddressL2;
            txtAddressL3.Text = Customer.AddressL3;
            txtTown.Text      = Customer.Town;
            txtCounty.Text    = Customer.County;
            txtEircode.Text   = Customer.Eir;
            txtPhoneNo.Text   = Customer.CountryCode + Customer.PhoneNo;
            txtDOB.Text       = Customer.DOB;



            string[] accountsarr = { "A.ACCOUNTID", "A.Name", "A.STATUS", "T.NAME Type", "A.BALANCE", "A.DATE_created \"Date Created\"", "ACCOUNT A INNER JOIN ACCOUNT_TYPE T ON A.TYPE = T.ID WHERE CUSTOMERID = " + Customer.CustomerId + " ORDER BY ACCOUNTID ASC" };
            DataSet  accounts    = new DataSet();

            try
            {
                accounts = Reusable.dsfromDB(accountsarr);
                dataGridView1.DataSource       = accounts.Tables[0];
                dataGridView1.Columns[0].Width = 75;
                dataGridView1.Columns[1].Width = 175;
                dataGridView1.Columns[2].Width = 75;
                dataGridView1.Columns[3].Width = 50;
                dataGridView1.Columns[4].Width = 75;
                dataGridView1.Columns[5].Width = 100;
            }
            catch
            {
                MessageBox.Show("Error 002: Could not connect to database. Please contact an administratior");
            }
        }
        public void CheckAndDisplayAccounts(bool b)
        {
            int count = 0;

            try
            {
                count = AccountSQL.FindActiveAccounts();
            }
            catch
            {
                MessageBox.Show("Error 006: Could not connect to database. Please contact an administratior");
            }

            if (count >= 1)
            {
                string[] Accountinfo = new string[7];
                tlpNoAccount.Visible = false;
                if (b)
                {
                    Accountinfo[0] = "A.ACCOUNTID";
                    Accountinfo[1] = "A.STATUS";
                    Accountinfo[2] = "A.NAME";
                    Accountinfo[3] = "T.NAME Type";
                    Accountinfo[4] = "A.BALANCE";
                    Accountinfo[5] = "A.DATE_created";
                    Accountinfo[6] = "ACCOUNT A INNER JOIN ACCOUNT_TYPE T ON A.TYPE = T.ID WHERE CUSTOMERID = " + Customer.CustomerId + " ORDER BY ACCOUNTID ASC";
                }
                else if (!b)
                {
                    Accountinfo[0] = "A.ACCOUNTID";
                    Accountinfo[1] = "A.STATUS";
                    Accountinfo[2] = "A.NAME";
                    Accountinfo[3] = "T.NAME Type";
                    Accountinfo[4] = "A.BALANCE";
                    Accountinfo[5] = "A.DATE_created";
                    Accountinfo[6] = "ACCOUNT A INNER JOIN ACCOUNT_TYPE T ON A.TYPE = T.ID WHERE STATUS = 'A' AND CUSTOMERID = " + Customer.CustomerId + " ORDER BY ACCOUNTID ASC";
                }

                DataSet Accounts = new DataSet();
                try
                {
                    Accounts = Reusable.dsfromDB(Accountinfo);
                    for (int i = 0; i < Accounts.Tables[0].Rows.Count; i++)
                    {
                        //Create label
                        Label Account_Name_ID = new Label();
                        Label Account_Status  = new Label();
                        Label Account_Type    = new Label();
                        Label Account_Balance = new Label();

                        //Add Text
                        Account_Name_ID.Text = Accounts.Tables[0].Rows[i]["Name"].ToString() + " - " + Accounts.Tables[0].Rows[i]["ACCOUNTID"].ToString();

                        if (Accounts.Tables[0].Rows[i]["STATUS"].ToString() == "A")
                        {
                            Account_Status.Text = "Active";
                        }
                        else if (Accounts.Tables[0].Rows[i]["STATUS"].ToString() == "C")
                        {
                            Account_Status.Text = "Closed";
                        }
                        else
                        {
                            Account_Status.Text = "Unknown";
                        }

                        Account_Type.Text    = Accounts.Tables[0].Rows[i]["Type"].ToString();
                        Account_Balance.Text = "€" + Accounts.Tables[0].Rows[i]["BALANCE"].ToString();

                        //Properties
                        Account_Name_ID.Left      = 250;
                        Account_Name_ID.Top       = ((i + 1) * 50) + 125;
                        Account_Name_ID.Width     = 300;
                        Account_Name_ID.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
                        Account_Name_ID.Font      = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

                        Account_Status.Left = 50;
                        Account_Status.Top  = ((i + 1) * 50) + 145;

                        Account_Type.Left      = 350;
                        Account_Type.Top       = ((i + 1) * 50) + 145;
                        Account_Type.AutoSize  = false;
                        Account_Type.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
                        Account_Type.Width     = 100;


                        Account_Balance.AutoSize  = false;
                        Account_Balance.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
                        Account_Balance.Top       = ((i + 1) * 50) + 145;
                        Account_Balance.Width     = 100;
                        Account_Balance.Left      = 650;
                        Account_Balance.Font      = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

                        //Add to form
                        this.Controls.Add(Account_Name_ID);
                        this.Controls.Add(Account_Status);
                        this.Controls.Add(Account_Type);
                        this.Controls.Add(Account_Balance);
                    }
                }
                catch
                {
                    MessageBox.Show("Error 007: Could not connect to database. Please contact an administratior");
                }
            }
        }
        private void FrmUpdateCustomer_Load(object sender, EventArgs e)
        {
            string[] infoarr    = { "Status", "Country_Code", "county", "Customer Where Customerid = " + Customer.CustomerId };
            string[] countryarr = { "countryid", "CONCAT(country,CONCAT(' ',CONCAT('(',CONCAT(code,')')))) AS country", "country_code" };
            string[] countyarr  = { "countyid", "county", "county" };
            DataSet  info       = new DataSet();
            DataSet  countryds  = new DataSet();
            DataSet  countyds   = new DataSet();

            try
            {
                countryds = Reusable.dsfromDB(countryarr);
                cboCountryCode.ValueMember   = "countryid";
                cboCountryCode.DisplayMember = "country";
                cboCountryCode.DataSource    = countryds.Tables[0];
            }
            catch
            {
                MessageBox.Show("Error 002: Could not connect to database. Please contact an administratior");
            }
            try
            {
                countyds = Reusable.dsfromDB(countyarr);
                cboCounty.ValueMember   = "countyid";
                cboCounty.DisplayMember = "county";
                cboCounty.DataSource    = countyds.Tables[0];
            }
            catch
            {
                MessageBox.Show("Error 003: Could not connect to database. Please contact an administratior");
            }
            try
            {
                info = Reusable.dsfromDB(infoarr);
            }
            catch
            {
                MessageBox.Show("Error 003: Could not connect to database. Please contact an administratior");
            }

            txtCustomerID.Text = Customer.CustomerId;
            if (info.Tables[0].Rows[0][0].ToString().Equals("A"))
            {
                txtStatus.Text = "Active";
            }
            else
            {
                txtStatus.Text = "Terminated";
            }
            txtCreationDate.Text         = Customer.DateCreated;
            txtFName.Text                = Customer.Fname;
            txtLName.Text                = Customer.Lname;
            txtDOB.Text                  = Customer.DOB;
            txtPPSNo.Text                = Customer.PPSNo;
            cboCountryCode.SelectedValue = info.Tables[0].Rows[0][1].ToString();
            txtPhoneNo.Text              = Customer.PhoneNo;
            txtAddressL1.Text            = Customer.AddressL1;
            txtAddressL2.Text            = Customer.AddressL2;
            txtAddressL3.Text            = Customer.AddressL3;
            txtTown.Text                 = Customer.Town;
            cboCounty.SelectedValue      = info.Tables[0].Rows[0][2].ToString();
            txtEircode.Text              = Customer.Eir;
        }