public static BillPayItemList LoadBillPaySchedule() { BillPayItemList list = new BillPayItemList(); SqlParamsColl paramList = new SqlParamsColl(); SqlTools.ExecuteReader("dbo.Admin_LoadBillPaySchedule", paramList, reader => { while (reader.Read()) { BillPayItem item = new BillPayItem(); PopulateFromReader(reader, item); list.Add(item); } }); return list; }
public static BillPayItem LoadBillPayItem(int Id) { BillPayItem item = new BillPayItem(); SqlParamsColl paramList = new SqlParamsColl(); paramList.Add("@BillPayId", SqlDbType.Int, Id); SqlTools.ExecuteReader("[dbo].[BillPay_LoadBillPay]", paramList, reader => { while (reader.Read()) { PopulateFromReader(reader, item); } }); return item; }
public static BillPayItemList LoadCustomerBillPayList(int CustomerId) { BillPayItemList list = new BillPayItemList(); SqlParamsColl paramList = new SqlParamsColl(); paramList.Add("@CustomerId", SqlDbType.Int, CustomerId); SqlTools.ExecuteReader("dbo.BillPay_LoadByCustomer", paramList, reader => { while (reader.Read()) { BillPayItem item = new BillPayItem(); PopulateFromReader(reader, item); list.Add(item); } }); return list; }
public static void PopulateFromReader(SqlDataReader reader, BillPayItem item) { item.Id = (int)reader["Id"]; item.Amount = (decimal)reader["Amount"]; item.Payee = (int)reader["PayeeId"]; item.PayerAccount = (int)reader["AccountNumber"]; try { item.CycleFrequency = Convert.ToChar(reader["CycleFrequency"]); } catch (Exception) { } try { item.NextScheduledDate = Convert.ToDateTime(reader["ScheduleDate"]); } catch (Exception){ } try { item.LastDateUpdated = Convert.ToDateTime(reader["LastDateUpdated"]); } catch (Exception) { } }
protected void Page_Load(object sender, EventArgs e) { if (Session["LoggedInCustomer"] == null) { Response.Redirect("/Login"); } if (!IsPostBack) { CustomerDataSource = (Customer)Session["LoggedInCustomer"]; CustomerAccounts = AccountManager.GetAccountsByCustomer(CustomerDataSource); string BPAYId = (string)Page.RouteData.Values["Brn"]; if (BPAYId != "New" && BPAYId != null && BPAYId != "") { int parsedBPAYId = 0; try { parsedBPAYId = Int32.Parse(BPAYId); } catch (FormatException) { } if (parsedBPAYId != 0) { BPAYItem = BillPayManager.GetBillPayItem(parsedBPAYId); } } if (BPAYItem != null) { bool correctOwner = false; // Confirming that BPAY item actually belongs to the logged in user. foreach (Account acc in CustomerAccounts) { if (BPAYItem.PayerAccount == acc.AccountNumber) { correctOwner = true; break; } } if (!correctOwner) { BPAYItem = new BillPayItem(); BPAYItem.Id = 0; PageMode = (int)Enums.PageMode.Edit; } else { PageMode = (int)Enums.PageMode.View; } } else { BPAYItem = new BillPayItem(); BPAYItem.Id = 0; PageMode = (int)Enums.PageMode.Edit; } PayeeList = BillPayManager.GetBillPayPayeeList(); BindData(); } }