Ejemplo n.º 1
0
        public static Customer Update(Customer Cust)
        {
            SqlParamsColl paramList = new SqlParamsColl();

            paramList.Add("@CustomerId", SqlDbType.Int, Cust.Id);
            paramList.Add("@FirstName", SqlDbType.NVarChar, Cust.FirstName);
            paramList.Add("@LastName", SqlDbType.NVarChar, Cust.LastName);
            paramList.Add("@TFN", SqlDbType.NVarChar, Cust.TaxFileNumber);
            paramList.Add("@AddressStreet", SqlDbType.NVarChar, Cust.CustomerAddress.StreetDetail);
            paramList.Add("@AddressCity", SqlDbType.NVarChar, Cust.CustomerAddress.City);
            paramList.Add("@AddressState", SqlDbType.NVarChar, Cust.CustomerAddress.State);
            paramList.Add("@AddressZipCode", SqlDbType.NVarChar, Cust.CustomerAddress.ZipCode);
            paramList.Add("@PhoneNumber", SqlDbType.NVarChar, Cust.PhoneNumber);

            Customer updatedCustomer = new Customer();

            SqlTools.ExecuteReader("dbo.Customer_Update", paramList, reader =>
                {
                    while (reader.Read())
                    {
                        PopulateObjectFromReader(reader, updatedCustomer);
                    }
                });
            return updatedCustomer;
        }
Ejemplo n.º 2
0
        public static void CancelBPAYItem(int BPAYId)
        {
            SqlParamsColl paramList = new SqlParamsColl();

            paramList.Add("@BPAYId", SqlDbType.Int, BPAYId);

            SqlTools.ExecuteNonQuery("dbo.BillPay_Cancel", paramList);
        }
Ejemplo n.º 3
0
        public static void UpdateUserPassword(string UserId, string HashedPwd, int CustomerNumber)
        {
            SqlParamsColl paramList = new SqlParamsColl();
            paramList.Add("@UserId", SqlDbType.NVarChar, UserId);
            paramList.Add("@CustomerNumber", SqlDbType.Int, CustomerNumber);
            paramList.Add("@NewPassword", SqlDbType.NVarChar, HashedPwd);

            SqlTools.ExecuteNonQuery("dbo.User_ChangePassword", paramList);
        }
Ejemplo n.º 4
0
        public static int? ValidateUserCredentials(string UserId, string HashedPwd)
        {
            SqlParamsColl paramList = new SqlParamsColl();
            paramList.Add("@UserId", SqlDbType.NVarChar, UserId);
            paramList.Add("@HashedPwd", SqlDbType.NVarChar, HashedPwd);

            int? customerId = (int?)SqlTools.ExecuteScalar("dbo.User_Validate", paramList);

            return customerId;
        }
Ejemplo n.º 5
0
        public static void Update(Account acc)
        {
            SqlParamsColl paramList = new SqlParamsColl();

            paramList.Add("@AccountNumber", SqlDbType.Int, acc.AccountNumber);
            paramList.Add("AvailableBalance", SqlDbType.Money, acc.AvailableBalance);

            SqlTools.ExecuteReader("Account_Update", paramList, reader =>
                {
                    while (reader.Read())
                    {
                        PopulateObjectFromReader(reader, acc);
                    }
                });
        }
Ejemplo n.º 6
0
        public static BillPayPayeeList LoadPayeeList()
        {
            BillPayPayeeList list = new BillPayPayeeList();
            SqlParamsColl paramList = new SqlParamsColl();

            SqlTools.ExecuteReader("dbo.Payee_LoadAll", paramList, reader =>
                {
                    while (reader.Read())
                    {
                        list.Add(PopulateFromReader(reader));
                    }
                });

            return list;
        }
Ejemplo n.º 7
0
        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;
        }
Ejemplo n.º 8
0
        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;
        }
Ejemplo n.º 9
0
        public static TransactionList GetTransactionsByCustomer(int CustomerId)
        {
            TransactionList list = new TransactionList();
            SqlParamsColl paramList = new SqlParamsColl();

            paramList.Add("@CustomerId", SqlDbType.Int, CustomerId);

            SqlTools.ExecuteReader("dbo.Admin_LoadCustomerTransactions", paramList, reader =>
                {
                    while (reader.Read())
                    {
                        list.Add(PopulateObjectFromReader(reader));
                    }
                });
            return list;
        }
Ejemplo n.º 10
0
        public static Customer GetCustomerById(int Id)
        {
            Customer custDetail = new Customer();

            SqlParamsColl paramList = new SqlParamsColl();
            paramList.Add("@CustomerId", SqlDbType.Int, Id);

            SqlTools.ExecuteReader("Customer_Load", paramList, reader =>
                {
                    while (reader.Read())
                    {
                        PopulateObjectFromReader(reader, custDetail);
                    }
                });
            return custDetail;
        }
Ejemplo n.º 11
0
        public static CustomerList GetAllCustomers()
        {
            SqlParamsColl paramList = new SqlParamsColl();
            CustomerList list = new CustomerList();

            SqlTools.ExecuteReader("dbo.Admin_LoadCustomers", paramList, reader =>
                {
                    while (reader.Read())
                    {
                        Customer cust = new Customer();
                        PopulateObjectFromReader(reader, cust);
                        list.Add(cust);
                    }
                });

            return list;
        }
Ejemplo n.º 12
0
        public static AccountList GetAccountsByCustomer(int Id)
        {
            AccountList list = new AccountList();

            SqlParamsColl paramList = new SqlParamsColl();
            paramList.Add("@CustomerId", SqlDbType.Int, Id);

            SqlTools.ExecuteReader("dbo.Accounts_RetrieveByCustomer", paramList, reader =>
                {
                    while (reader.Read())
                    {
                        Account acc = new Account();
                        PopulateObjectFromReader(reader, acc);
                        list.Add(acc);
                    }
                });

            return list;
        }
Ejemplo n.º 13
0
        public static void Insert_DepositTransaction(int AccountNumber, decimal Amount, string Comment)
        {
            decimal feeAmount = 0;

            try
            {
                feeAmount = Decimal.Parse(ConfigurationManager.AppSettings["Fee_ATMTransaction"]);
            }
            catch (FormatException) { }

            SqlParamsColl paramList = new SqlParamsColl();
            paramList.Add("@AccountNumber", SqlDbType.Int, AccountNumber);
            paramList.Add("@Amount", SqlDbType.Money, Amount);
            paramList.Add("@FeeAmount", SqlDbType.Money, feeAmount);
            if (Comment != null)
                paramList.Add("@Comment", SqlDbType.NVarChar, Comment);

            SqlTools.ExecuteNonQuery("dbo.Transaction_InsertDeposit", paramList);
        }
Ejemplo n.º 14
0
        public static int? InsertUpdateBillPay(int? BPAYId, int FromAccount, decimal Amount, int PayeeId, DateTime NextBillDate, char Frequency)
        {
            int? returnedBPAYId = 0;

            SqlParamsColl paramList = new SqlParamsColl();

            if (BPAYId != null)
                paramList.Add("@BPAYId", SqlDbType.Int, BPAYId);

            paramList.Add("@FromAccountId", SqlDbType.Int, FromAccount);
            paramList.Add("@Amount", SqlDbType.Money, Amount);
            paramList.Add("@PayeeId", SqlDbType.Int, PayeeId);
            paramList.Add("@BillDate", SqlDbType.DateTime, NextBillDate);
            paramList.Add("@Frequency", SqlDbType.NVarChar, Frequency);

            returnedBPAYId = (int)SqlTools.ExecuteScalar("dbo.BillPay_InsertUpdate", paramList);

            if (returnedBPAYId != null)
                return returnedBPAYId;
            else
                return 0;
        }
Ejemplo n.º 15
0
        public static TransactionList GetAccountTransactions(int AccountNumber)
        {
            TransactionList list = new TransactionList();
            SqlParamsColl paramList = new SqlParamsColl();
            decimal feeAmount = 0;

            try
            {
                feeAmount = Decimal.Parse(ConfigurationManager.AppSettings["Fee_TransactionHistory"]);
            }
            catch (FormatException) { }

            paramList.Add("@AccountNumber", SqlDbType.Int, AccountNumber);
            paramList.Add("@FeeAmount", SqlDbType.Money, feeAmount);
            SqlTools.ExecuteReader("Account_RetrieveTransactions", paramList, reader =>
                {
                    while (reader.Read())
                    {
                        list.Add(PopulateObjectFromReader(reader));
                    }
                });
            return list;
        }
Ejemplo n.º 16
0
        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;
        }