private void payDec_Click(object sender, EventArgs e) { Home_Admin_Withdraw_Show h2 = new Home_Admin_Withdraw_Show(); try { if (dec.Text != "PAID" && dec.Text != "NILL") { h2.Show(); h2.giveData(index1, index2, 12); this.Hide(); } else { MessageBox.Show("Already Paid or Not Subscribed"); } } catch (Exception) { MessageBox.Show("Error!!"); } }
private void Pay_btn_Click(object sender, EventArgs e) { Account_BO account_BO = new Account_BO(); ArrayList list = new ArrayList(); ArrayList userBill = new ArrayList(account_BO.getUserBill()); DateTime dt = DateTime.Now; try { if (enterAmount_tb.Text != null) { int paymentBill = Convert.ToInt32(enterAmount_tb.Text); if (paymentBill % 120 == 0) { int m = 0; while (userBill[m].ToString() != userID.Text) { m++; } int b; for (b = m; userBill[b].ToString() != "*"; b++) { } int totalBill = Convert.ToInt32(totalBill_lbl.Text); if (paymentBill <= totalBill) { for (int j = 0; j < b; j++) { list.Add(userBill[j].ToString()); } list.Add(dt.ToShortDateString()); list.Add(enterAmount_tb.Text); list.Add((totalBill - paymentBill).ToString()); for (int k = b; k < userBill.Count; k++) { list.Add(userBill[k].ToString()); } account_BO.setUserBill(list); try { ArrayList cost = new ArrayList(); ArrayList temp = new ArrayList(); cost = account_BO.getOwnerincome(); int f = 0; for (int i = 0; i < cost.Count; i++) { temp.Add(cost[i].ToString()); if (cost[i].ToString() == lastDate_lbl.Text) { temp.Add("Bill"); temp.Add(enterAmount_tb.Text); for (int m1 = i + 1; m1 < cost.Count; m1++) { temp.Add(cost[m1].ToString()); } account_BO.setOwerIncome(temp); f = 1; } } if (f == 0) { cost.Add(lastDate_lbl.Text); cost.Add("Bill"); cost.Add(enterAmount_tb.Text); cost.Add("*"); account_BO.setOwerIncome(cost); } } catch { } Home_Admin_Withdraw_Show hs = new Home_Admin_Withdraw_Show(); hs.giveIndex(index1); this.Hide(); hs.Show(); } else { MessageBox.Show("You can not entry any amount more than the due bill"); enterAmount_tb.Clear(); } } else { MessageBox.Show("Enter the amount in correct format"); enterAmount_tb.Clear(); } } else { MessageBox.Show("Please enter amount"); } } catch { MessageBox.Show("Please enter amount"); } }