Exemple #1
0
        public customerAccount createAccount(int id)
        {
            customerAccount a = new customerAccount
            {
                customerId       = id,
                currentAccountId = (id * 100) + acid,
                savingsAccountId = (id * 100) + (acid + 1)
            };

            customeraccounts.Add(a);
            var cust = customeraccounts.Find(c => c.customerId == id);
            currentAccountDetails ca = new currentAccountDetails
            {
                currentAccountId      = cust.currentAccountId,
                currentAccountBalance = 0.00
            };

            currentAccounts.Add(ca);
            savingsAccount sa = new savingsAccount
            {
                savingsAccountId      = cust.savingsAccountId,
                savingsAccountbalance = 0.00
            };

            savingsAccounts.Add(sa);
            return(cust);
        }
Exemple #2
0
        public List <accountDetails> getCustomerAccounts(int id)
        {
            customerAccount       a  = customeraccounts.Where(c => c.customerId == id).FirstOrDefault();
            currentAccountDetails ca = currentAccounts.Find(cac => cac.currentAccountId == a.currentAccountId);
            var sa = savingsAccounts.Find(sac => sac.savingsAccountId == a.savingsAccountId);
            List <accountDetails> ac = new List <accountDetails>
            {
                new accountDetails {
                    accountId = ca.currentAccountId, accountType = "Current Account", accountBalance = ca.currentAccountBalance
                },
                new accountDetails {
                    accountId = sa.savingsAccountId, accountType = "Savings Account", accountBalance = sa.savingsAccountbalance
                }
            };

            return(ac);
        }
        public CustomerCreationStatus createCustomer(customerDetails customer)
        {
            customers.Add(customer);
            string              JsonData = JsonConvert.SerializeObject(customer.customerId);
            StringContent       content  = new StringContent(JsonData, Encoding.UTF8, "application/json");
            HttpResponseMessage response = client.PostAsync(client.BaseAddress + "/createAccount/", content).Result;

            if (response.IsSuccessStatusCode)
            {
                string          responseData = response.Content.ReadAsStringAsync().Result;
                customerAccount createStatus = JsonConvert.DeserializeObject <customerAccount>(responseData);
                var             result       = new CustomerCreationStatus();
                result.customerId       = customer.customerId;
                result.Message          = "Success. Current and Savings account also created";
                result.currentAccountId = createStatus.currentAccountId;
                result.savingsAccountId = createStatus.savingsAccountId;
                return(result);
            }
            return(null);
        }
Exemple #4
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            try
            {
                List <customerAccount> arrTD = new List <customerAccount>();
                for (int i = 0; i < dataGridView1.Rows.Count; i++)
                {
                    customerAccount item = new customerAccount();

                    item.ClientCode   = dataGridView1.Rows[i].Cells[0].Value.ToString();
                    item.CustomerCode = dataGridView1.Rows[i].Cells[1].Value.ToString();
                    item.Client       = dataGridView1.Rows[i].Cells[2].Value.ToString();
                    item.CustomerName = dataGridView1.Rows[i].Cells[3].Value.ToString();
                    if (dataGridView1.Rows[i].Cells[4].Value != null)
                    {
                        item.Returned = Convert.ToDouble(dataGridView1.Rows[i].Cells[4].Value.ToString());
                    }
                    else
                    {
                        item.Returned = 0;
                    }
                    if (dataGridView1.Rows[i].Cells[5].Value != null)
                    {
                        item.Paid = Convert.ToDouble(dataGridView1.Rows[i].Cells[5].Value.ToString());
                    }
                    else
                    {
                        item.Paid = 0;
                    }
                    if (dataGridView1.Rows[i].Cells[6].Value != null)
                    {
                        item.ReturnedBill = Convert.ToDouble(dataGridView1.Rows[i].Cells[6].Value.ToString());
                    }
                    else
                    {
                        item.ReturnedBill = 0;
                    }
                    if (dataGridView1.Rows[i].Cells[7].Value != null)
                    {
                        item.Bill = Convert.ToDouble(dataGridView1.Rows[i].Cells[7].Value.ToString());
                    }
                    else
                    {
                        item.Bill = 0;
                    }
                    arrTD.Add(item);
                }
                double TotalBefor = 0, TotalBillCost = 0, TotalPaid = 0, Rest = 0;
                if (labTotalBefor.Text != "")
                {
                    TotalBefor = Convert.ToDouble(labTotalBefor.Text);
                }
                if (labBills.Text != "")
                {
                    TotalBillCost = Convert.ToDouble(labBills.Text);
                }
                if (labpaid.Text != "")
                {
                    TotalPaid = Convert.ToDouble(labpaid.Text);
                }
                if (labRest.Text != "")
                {
                    Rest = Convert.ToDouble(labRest.Text);
                }
                PrintReport pr = new PrintReport(arrTD, 3, TotalBefor, TotalBillCost, TotalPaid, Rest, dateTimeFrom.Text, dateTimeTo.Text);
                pr.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #5
0
 public void resizeArray()
 {
     Array.Resize(ref acc, acc.Length + 1);
     CurrentIndex      = acc.Length - 1;
     acc[CurrentIndex] = new customerAccount();
 }