Example #1
0
        public void Transaction(int memberid, float amount, int tae)
        {
            var asd = _savingsConn.Select("savings", "savings_account_id").Where("member_id", memberid.ToString()).GetQueryData().Rows[0][0].ToString();

            _savingsConn.Insert("savings_transaction", "savings_account_id", asd, "transaction_type", tae.ToString(),
                                "date", DateTime.Now.ToString(), "total_amount", amount.ToString());//, "encoded_by", higher.user);
        }
Example #2
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                string[] valueStrings =
                {
                    "loan_account_id", cbxAccount.SelectedItem.ToString(), "transaction_type", "1",             "principal",
                    txtPrincipal.Text,
                    "interest",        txtInterest.Text,                   "penalty",          txtPenalty.Text, "total_amount",label12.Text,
                    "date",            DateTime.Today.ToString("yyyy-MM-dd")
                };

                if (_value < 0 && !edit)
                {
                    throw new Exception();
                }
                if (float.Parse(txtPrincipal.Text) <= 0)
                {
                    if (edit)
                    {
                        conn.Update("loan_transactions", valueStrings).Where("loan_transaction_id", transid)
                        .GetQueryData();
                    }
                    else
                    {
                        conn.Insert("loan_transaction", valueStrings)
                        .GetQueryData();
                    }
                    string[] vals = { "outstanding_balance", _value.ToString() };
                    var      z    = new string[6];
                    if (Math.Abs(_value) < 1e-6)
                    {
                        string[] incase = { "loan_status", "3", "date_terminated", DateTime.Today.ToString("yyyy-MM-dd") };
                        vals.CopyTo(z, 0);
                        incase.CopyTo(z, vals.Length);
                    }
                    else
                    {
                        string[] nocase = { "loan_status", "1", "date_terminated", DateTime.Today.ToString("yyyy-MM-dd") };
                        vals.CopyTo(z, 0);
                        nocase.CopyTo(z, vals.Length);
                    }
                    conn.Update("loans", vals)
                    .Where("loan_account_id", cbxAccount.SelectedItem.ToString())
                    .GetQueryData();
                    SetName(label15.Text, index: cbxAccount.SelectedIndex);
                    MessageBox.Show("Transaction recorded");
                }
                else
                {
                    MessageBox.Show("Principal value Must not be 0");
                }
            }
            catch (Exception exception)
            {/*
              * MessageBox.Show(exception.ToString());
              * throw;*/
                MessageBox.Show("Final Balance is negative. Ensure Calculations are Correct");
            }
        }
Example #3
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();
         }
     }
 }