public IList <Transactions> GetTransactionsByAccountCode(int?id) { List <Transactions> transactionList = new List <Transactions>(); using (SqlConnection con = new SqlConnection(CS)) { SqlCommand cmd = new SqlCommand("pr_GetTransactionsByAccountCode", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@account_code", id); con.Open(); SqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { var transactionModel = new Transactions() { code = DataTypesConvertor.ConvertToInt(rdr["code"]), account_code = DataTypesConvertor.ConvertToInt(rdr["account_code"]), transaction_date = DataTypesConvertor.ConvertToDateTime(rdr["transaction_date"]), capture_date = DataTypesConvertor.ConvertToDateTime(rdr["capture_date"]), amount = DataTypesConvertor.ConvertToDecimal(rdr["amount"]), description = rdr["description"].ToString() }; transactionList.Add(transactionModel); } return(transactionList); } }
public IList <Accounts> GetAccountsByPersonCode(int?id) { List <Accounts> accountList = new List <Accounts>(); using (SqlConnection con = new SqlConnection(CS)) { SqlCommand cmd = new SqlCommand("pr_GetAccountsByPersonCode", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@person_code", id); con.Open(); SqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { var accountModel = new Accounts() { code = DataTypesConvertor.ConvertToInt(rdr["code"]), person_code = DataTypesConvertor.ConvertToInt(rdr["person_code"]), account_number = rdr["account_number"].ToString(), outstanding_balance = DataTypesConvertor.ConvertToDecimal(rdr["outstanding_balance"]) }; accountList.Add(accountModel); } return(accountList); } }
public Accounts GetAccountByCode(int?id) { Accounts accountModel = new Accounts(); using (SqlConnection con = new SqlConnection(CS)) { SqlCommand cmd = new SqlCommand("pr_GetAccountByCode", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@code", id); con.Open(); SqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { accountModel.code = DataTypesConvertor.ConvertToInt(rdr["code"]); accountModel.person_code = DataTypesConvertor.ConvertToInt(rdr["person_code"]); accountModel.account_number = rdr["account_number"].ToString(); accountModel.outstanding_balance = DataTypesConvertor.ConvertToDecimal(rdr["outstanding_balance"]); } return(accountModel); } }
public Transactions GetTransactionByCode(int?id) { Transactions accountModel = new Transactions(); using (SqlConnection con = new SqlConnection(CS)) { SqlCommand cmd = new SqlCommand("pr_GetTransactionByCode", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@code", id); con.Open(); SqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { accountModel.code = DataTypesConvertor.ConvertToInt(rdr["code"]); accountModel.account_code = DataTypesConvertor.ConvertToInt(rdr["person_code"]); accountModel.transaction_date = DataTypesConvertor.ConvertToDateTime(rdr["transaction_date"]); accountModel.capture_date = DataTypesConvertor.ConvertToDateTime(rdr["capture_date"]); accountModel.amount = DataTypesConvertor.ConvertToDecimal(rdr["amount"]); accountModel.description = rdr["description"].ToString(); } return(accountModel); } }