示例#1
0
 private void Rifrish()
 {
     try
     {
         var tae = new DatabaseConn();
         dataGridView1.DataSource = tae.storedProc("viewloanrequests");
         if (dataGridView1.Rows.Count != 0)
         {
             dataGridView1.Height = dataGridView1.GetRowDisplayRectangle(0, true).Bottom *dataGridView1.RowCount + dataGridView1.ColumnHeadersHeight;
         }
         dataGridView1.Columns["member_id"].Visible        = false;
         dataGridView1.Columns["loan_account_id"].Visible  = false;
         dataGridView1.Columns["loan_type"].HeaderText     = "Loan Type";
         dataGridView1.Columns["request_type"].HeaderText  = "Request Type";
         dataGridView1.Columns["term"].HeaderText          = "Term";
         dataGridView1.Columns["orig_amount"].HeaderText   = "Amount";
         dataGridView1.Columns["interest_rate"].HeaderText = "Interest Rate";
         conn.Close();
         var x = new DataGridViewButtonColumn();
         x.DefaultCellStyle.BackColor = button1.BackColor;
         var columnIndex = dataGridView1.ColumnCount;
         foreach (DataGridViewColumn col in dataGridView1.Columns)
         {
             dataGridView1.Columns[col.Name].SortMode = DataGridViewColumnSortMode.NotSortable;
         }
     }
     catch (Exception ee)
     {
         //MessageBox.Show(ee.ToString());
         conn.Close();
     }
     dataGridView1.ClearSelection();
     convert();
 }
示例#2
0
 public LoanTransactions(int member, string membern, MainForm parent)
 {
     InitializeComponent();
     memId      = member;
     mname.Text = membern;
     db         = new DatabaseConn();
     reftomain  = parent;
     popup();
 }
        public LoanTransactionsA(int member)
        {
            InitializeComponent();
            var db = new DatabaseConn();

            mlist.DataSource = db.Select("loans", "loan_account_id", "date_granted", "orig_amount", "outstanding_balance")
                               .Where("member_id", member.ToString())
                               .GetQueryData();
            mlist.ClearSelection();
        }
示例#4
0
        private double intrate = 5.00; //DO THIS SHIT GUYS      AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA


        public AddLoan(int x, MainForm parents)
        {
            InitializeComponent();
            memid = x;
            cbLoan.SelectedIndex    = 0;
            cbRequest.SelectedIndex = 0;
            _addloanconn            = new DatabaseConn();
            conn               = new MySqlConnection("Server=localhost;Database=amc;Uid=root;Pwd=root;");
            tbInterest.Text    = intrate.ToString();
            this.ActiveControl = label3;
            reftomain          = parents;
        }
示例#5
0
        private void Dashboard_Load(object sender, EventArgs e)
        {
            loadBals();
            loadCoA();

            var       db = new DatabaseConn();
            DataTable a  = db.Select("members", "COUNT(member_id)").Where("status", "1").GetQueryData();

            label15.Text = a.Rows[0][0].ToString();
            a            = db.Select("loans", "SUM(orig_amount) as tanan", "SUM(Case when date_terminated is null then 1 else 0 end) as notp", "SUM(Case when date_terminated is not null then 1 else 0 end) as vryp", "SUM(outstanding_balance) as outt").GetQueryData();
            label16.Text = a.Rows[0]["tanan"].ToString();
            label18.Text = a.Rows[0]["notp"].ToString();
            label19.Text = a.Rows[0]["vryp"].ToString();
            label20.Text = a.Rows[0]["outt"].ToString();
        }
示例#6
0
        public void details()
        {
            dataGridView2.DataSource = null;
            if (dataGridView2.Rows.Count != 0)
            {
                dataGridView2.Rows.Clear();
            }
            dataGridView2.Columns.Clear();
            dataGridView2.Refresh();
            try
            {
                var tae = new DatabaseConn();
                dataGridView2.DataSource = tae.storedProc("viewloansched");
                dataGridView2.Columns["member_id"].Visible       = false;
                dataGridView2.Columns["loan_account_id"].Visible = false;
                int height = 0;
                foreach (DataGridViewRow row in dataGridView2.Rows)
                {
                    height += row.Height;
                }
                height += dataGridView2.ColumnHeadersHeight;

                int width = dataGridView2.Width;
                dataGridView2.ClientSize = new Size(width, height);
                var x = new DataGridViewButtonColumn();
                x.DefaultCellStyle.BackColor = button1.BackColor;
                var columnIndex = dataGridView2.ColumnCount;
                dataGridView2.Columns["term"].HeaderText                = "Term";
                dataGridView2.Columns["due_date"].HeaderText            = "Due Date";
                dataGridView2.Columns["orig_amount"].HeaderText         = "Original Amount";
                dataGridView2.Columns["outstanding_balance"].HeaderText = "Beginning Balance as of Jan 02, 2017";
                foreach (DataGridViewColumn col in dataGridView2.Columns)
                {
                    dataGridView2.Columns[col.Name].SortMode = DataGridViewColumnSortMode.NotSortable;
                }
            }
            catch (Exception ee)
            {
                //MessageBox.Show(ee.ToString());
            }
            dataGridView2.ClearSelection();
        }
示例#7
0
 public void trans(int mo)
 {
     dataGridView2.DataSource = null;
     if (dataGridView2.Rows.Count != 0)
     {
         dataGridView2.Rows.Clear();
     }
     dataGridView2.Refresh();
     try
     {
         foreach (int n in loanids)
         {
             var tae = new DatabaseConn();
             var dt  = new DataTable();
             dt = tae.storedProc("monthview", "loanid", n, "mo", mo);
             if (dataGridView2.ColumnCount == 0)
             {
                 foreach (DataColumn column in dt.Columns)
                 {
                     dataGridView2.Columns.Add(column.ColumnName, column.ColumnName);
                 }
             }
             DataRow row = dt.Rows[0];
             dataGridView2.Rows.Add(row.ItemArray);
         }
         var x = new DataGridViewButtonColumn();
         x.DefaultCellStyle.BackColor = button1.BackColor;
         var columnIndex = dataGridView2.ColumnCount;
         foreach (DataGridViewColumn col in dataGridView2.Columns)
         {
             dataGridView2.Columns[col.Name].SortMode = DataGridViewColumnSortMode.NotSortable;
         }
     }
     catch (Exception ee)
     {
         //MessageBox.Show(ee.ToString());
     }
     dataGridView2.ClearSelection();
 }
示例#8
0
        private void Rifrish()
        {
            try
            {
                var tae = new DatabaseConn();
                if (filter.Equals(""))
                {
                    string[] taes = { "member_id",
                                      "concat_ws(',', family_name, first_name) as name","gender",  "address", "contact_no", "type",
                                      "status" };
                    dataGridView2.DataSource = tae.Select("members", taes).GetQueryData();
                }
                else
                {
                    MySqlCommand comm = new MySqlCommand("SELECT DISTINCT member_id, concat_ws(',',family_name ,first_name) as name, gender, address, contact_no," +
                                                         "CASE WHEN type = 0 THEN 'Regular' WHEN type = 1 THEN 'Associate' ELSE 'Lab' END as type, CASE WHEN civil_status = 0 THEN 'Single' WHEN civil_status = 1 THEN 'Married' WHEN civil_status = 2 THEN 'Divorced' ELSE 'Widowed' END as 'civil status' FROM members " + filter, conn);

                    Console.Write(comm.CommandText);
                    MySqlDataAdapter adp = new MySqlDataAdapter(comm);
                    var dt = new DataTable();
                    adp.Fill(dt);
                    dataGridView2.DataSource = dt;
                }
                //dataGridView1.DataSource = dt;
                dataGridView2.Columns["member_id"].Visible = false;
                int height = dataGridView2.Rows.Cast <DataGridViewRow>().Sum(row => row.Height);
                height += dataGridView2.ColumnHeadersHeight;
                int width = dataGridView2.Width;
                dataGridView2.ClientSize = new Size(width, height);
                conn.Close();
            }
            catch (Exception ee)
            {
                ////MessageBox.Show(ee.ToString());
                conn.Close();
            }
            dataGridView2.ClearSelection();
        }
示例#9
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (validation())
     {
         comakercnt();
         try
         {
             conn.Open();
             string[] loanStrings = { "member_id", memid.ToString(),                   "loan_type",     cbLoan.SelectedIndex.ToString(), "request_type"
                                      ,            cbRequest.SelectedIndex.ToString(), "orig_amount",   tbAmount.Text,                   "term",         tbTerm.Text.ToString()
                                      ,            "interest_rate",                    tbInterest.Text, "purpose",                       tbPurpose.Text, "loan_status","0", "outstanding_balance", tbAmount.Text };
             _addloanconn = new DatabaseConn();
             _addloanconn.Insert("loans", loanStrings)
             .GetQueryData();
             string id = _addloanconn.lastID();
             //MessageBox.Show(id);
             string[] comakers = { "loan_id", id,         "name", tbName1.Text, "address", tbAddress1.Text, "company_name", tbCompany1.Text
                                   ,          "position", tbPosition1.Text };
             _addloanconn.Insert("comakers", comakers);
             if (comakercount == 2)
             {
                 string[] comakers2 = { "loan_id", id,         "name", tbName2.Text, "address", tbAddress2.Text, "company_name", tbCompany2.Text
                                        ,          "position", tbPosition2.Text };
                 _addloanconn.Insert("comakers", comakers2);
             }
             MessageBox.Show("Success");
             reftomain.innerChild(new AddLoan(-1, reftomain));
             conn.Close();
         }
         catch (Exception ee)
         {
             ////MessageBox.Show(ee.ToString());
             conn.Close();
         }
     }
 }
示例#10
0
 private void populatedatagridParent(string Command, int n)
 {
     datagridTableParent.DataSource = null;      //remove datasource link for datagridProduct
     //MessageBox.Show("Parent - " + selectCommand,"",MessageBoxButtons.OK);
     try
     {
         if (n == 0)
         {
             var           tae = new DatabaseConn(); //opens the connection
             BindingSource bs  = new BindingSource();
             bs.DataSource = tae.storedProc(Command);
             datagridTableParent.DataSource = bs;
             conn.Close();
             datagridTableParent.AutoResizeRows();
         }
         else if (n == 1)
         {
             conn.Open();                                              //opens the connection
             MySqlCommand     query = new MySqlCommand(Command, conn); //query to select all entries in tbl_productcatalog
             MySqlDataAdapter adp   = new MySqlDataAdapter(query);     //adapter for query
             DataTable        dt    = new DataTable();                 //datatable for adapter
             BindingSource    bs    = new BindingSource();
             dt.Locale = System.Globalization.CultureInfo.InvariantCulture;
             adp.Fill(dt);
             bs.DataSource = dt;
             datagridTableParent.DataSource = bs;
             datagridTableChild.DataSource  = bs;
             conn.Close();
             datagridTableChild.AutoResizeRows();
             datagridTableParent.AutoResizeRows();
         }
         else if (n == 2)
         {
             var           tae = new DatabaseConn(); //opens the connection
             BindingSource bs  = new BindingSource();
             DateTime      dt  = capitalDTP.Value;
             bs.DataSource = tae.storedProc(Command, "yr", dt.Year, "accountstatus", 1, "likephrase", "%");
             datagridTableParent.DataSource = bs;
             datagridTableChild.DataSource  = bs;
             conn.Close();
             datagridTableParent.AutoResizeRows();
         }
         else if (n == 3)
         {
             var           tae = new DatabaseConn(); //opens the connection
             BindingSource bs  = new BindingSource();
             DateTime      dt  = savingsMDTP.Value;
             if (dt.Month == 3 || dt.Month == 6 || dt.Month == 9 || dt.Month == 12)
             {
                 bs.DataSource = tae.storedProc("displayQuarterMonthTable", "mn", dt.Month, "yr", dt.Year, "accountstatus", 1, "likephrase", "%");
             }
             else
             {
                 bs.DataSource = tae.storedProc("displayMonthTable", "mn", dt.Month, "yr", dt.Year, "accountstatus", 1, "likephrase", "%");
             }
             datagridTableParent.DataSource = bs;
             datagridTableChild.DataSource  = bs;
             conn.Close();
         }
     }
     catch (Exception x)
     {
         MessageBox.Show("Error in populating datagridTable : " + x.ToString());
         conn.Close();
     }
 }
示例#11
0
 public LoanTransactions(MainForm parent)
 {
     InitializeComponent();
     db        = new DatabaseConn();
     reftomain = parent;
 }
示例#12
0
 public addLoanM()
 {
     InitializeComponent();
     _addloanconn = new DatabaseConn();
 }
示例#13
0
        private void Rifrish()
        {
            try
            {
                var tae = new DatabaseConn();
                dataGridView1.DataSource = tae.storedProc("viewloanschedname");
                dataGridView1.Columns["member_id"].Visible       = false;
                dataGridView1.Columns["loan_account_id"].Visible = false;
                dataGridView1.Columns["date_granted"].HeaderText = "Date Granted";
                int height = 0;
                foreach (DataGridViewRow row in dataGridView1.Rows)
                {
                    height += row.Height;
                }
                height += dataGridView1.ColumnHeadersHeight;

                int width = 0;
                foreach (DataGridViewColumn col in dataGridView1.Columns)
                {
                    if (col.Visible == true)
                    {
                        width += col.Width;
                    }
                }
                width += dataGridView1.RowHeadersWidth;
                dataGridView1.ClientSize = new Size(width + 3, height + 2);
                foreach (DataGridViewColumn col in dataGridView1.Columns)
                {
                    dataGridView1.Columns[col.Name].SortMode = DataGridViewColumnSortMode.NotSortable;
                }

                dataGridView3.DataSource = tae.storedProc("viewloanstotal");
                dataGridView3.Columns["member_id"].Visible = false;
                height = 0;
                foreach (DataGridViewRow row in dataGridView3.Rows)
                {
                    height += row.Height;
                }
                height += dataGridView3.ColumnHeadersHeight;

                width = 0;
                foreach (DataGridViewColumn col in dataGridView3.Columns)
                {
                    if (col.Visible == true)
                    {
                        width += col.Width;
                    }
                }
                width += dataGridView3.RowHeadersWidth;
                dataGridView3.ClientSize = new Size(width + 3, height + 2);
                foreach (DataGridViewColumn col in dataGridView3.Columns)
                {
                    dataGridView3.Columns[col.Name].SortMode = DataGridViewColumnSortMode.NotSortable;
                }

                dataGridView4.DataSource = tae.storedProc("viewagingsched");
                height = 0;
                foreach (DataGridViewRow row in dataGridView4.Rows)
                {
                    height += row.Height;
                }
                height += dataGridView4.ColumnHeadersHeight;
                dataGridView4.ClientSize = new Size(633, height + 2);
                foreach (DataGridViewColumn col in dataGridView4.Columns)
                {
                    dataGridView4.Columns[col.Name].SortMode = DataGridViewColumnSortMode.NotSortable;
                }
            }
            catch (Exception ee)
            {
                //MessageBox.Show(ee.ToString());
            }
            dataGridView1.ClearSelection();
            loanids.Clear();
            for (int i = 0; i < dataGridView1.RowCount; i++)
            {
                loanids.Add(int.Parse(dataGridView1.Rows[i].Cells["loan_account_id"].Value.ToString()));
            }
        }
示例#14
0
 public Saving()
 {
     _savingsConn = new DatabaseConn();
 }