Пример #1
0
        public List <BankBookModel> GetPrevieByTransactionId(string TransactionId)
        {
            objDataAccess = DataAccess.NewDataAccess();
            objDbCommand  = objDataAccess.GetCommand(true, IsolationLevel.ReadCommitted);
            DbDataReader objDbDataReader = null;

            List <BankBookModel> objBankBookModelList = new List <BankBookModel>();

            BankBookModel objBankBookModel = new BankBookModel();

            try
            {
                objDbCommand.AddInParameter("TransactionId", TransactionId);
                objDbDataReader = objDataAccess.ExecuteReader(objDbCommand, "[dbo].[uspPreviewByTransactionIdForBankBook]", CommandType.StoredProcedure);

                if (objDbDataReader.HasRows)
                {
                    while (objDbDataReader.Read())
                    {
                        objBankBookModel = new BankBookModel();
                        objBankBookModel.TransactionId       = objDbDataReader["TransactionId"].ToString();
                        objBankBookModel.TransactionDateShow = string.Format("{0:dd/MMM/yyyy}", objDbDataReader["TransactionDate"]);
                        objBankBookModel.BankName            = objDbDataReader["BankName"].ToString();
                        objBankBookModel.AccountNumber       = objDbDataReader["AccountNumber"].ToString();
                        objBankBookModel.DebitAmount         = Convert.ToDecimal(objDbDataReader["DebitAmount"]);
                        objBankBookModel.CreditAmount        = Convert.ToDecimal(objDbDataReader["CreditAmount"]);
                        objBankBookModelList.Add(objBankBookModel);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error : " + ex.Message);
            }
            finally
            {
                if (objDbDataReader != null)
                {
                    objDbDataReader.Close();
                }
                objDataAccess.Dispose(objDbCommand);
            }

            return(objBankBookModelList);
        }
Пример #2
0
        public List <BankBookModel> GetBankName()
        {
            objDataAccess = DataAccess.NewDataAccess();
            objDbCommand  = objDataAccess.GetCommand(true, IsolationLevel.ReadCommitted);
            DbDataReader objDbDataReader = null;

            List <BankBookModel> objBankBookModelList = new List <BankBookModel>();

            BankBookModel objBankBookModel = new BankBookModel();

            try
            {
                objDbDataReader = objDataAccess.ExecuteReader(objDbCommand, "[dbo].[uspGetBankNameForBankBook]", CommandType.StoredProcedure);

                if (objDbDataReader.HasRows)
                {
                    while (objDbDataReader.Read())
                    {
                        objBankBookModel = new BankBookModel();
                        this.BuildModelForBuildModelForBankBook(objDbDataReader, objBankBookModel);
                        objBankBookModelList.Add(objBankBookModel);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error : " + ex.Message);
            }
            finally
            {
                if (objDbDataReader != null)
                {
                    objDbDataReader.Close();
                }
                objDataAccess.Dispose(objDbCommand);
            }

            return(objBankBookModelList);
        }
Пример #3
0
        private void BuildModelForBuildModelForBankBook(DbDataReader objDataReader, BankBookModel objBankBookModel)
        {
            DataTable objDataTable = objDataReader.GetSchemaTable();

            foreach (DataRow dr in objDataTable.Rows)
            {
                String column = dr.ItemArray[0].ToString();
                switch (column)
                {
                case "BankBookId":
                    if (!Convert.IsDBNull(objDataReader["BankBookId"]))
                    {
                        objBankBookModel.BankBookId = Convert.ToInt32(objDataReader["BankBookId"]);
                    }
                    break;

                case "TransationDate":
                    if (!Convert.IsDBNull(objDataReader["TransationDate"]))
                    {
                        objBankBookModel.TransactionDate = Convert.ToDateTime(objDataReader["TransationDate"].ToString());
                    }
                    break;

                case "BankName":
                    if (!Convert.IsDBNull(objDataReader["BankName"]))
                    {
                        objBankBookModel.BankName = objDataReader["BankName"].ToString();
                    }
                    break;

                case "BankDetailId":
                    if (!Convert.IsDBNull(objDataReader["BankDetailId"]))
                    {
                        objBankBookModel.BankDetailId = Convert.ToInt16(objDataReader["BankDetailId"].ToString());
                    }
                    break;

                case "AccountNumber":
                    if (!Convert.IsDBNull(objDataReader["AccountNumber"]))
                    {
                        objBankBookModel.AccountNumber = objDataReader["AccountNumber"].ToString();
                    }
                    break;

                case "BankEntryType":
                    if (!Convert.IsDBNull(objDataReader["BankEntryType"]))
                    {
                        objBankBookModel.BankEntryType = objDataReader["BankEntryType"].ToString();
                    }
                    break;

                case "DebitAmount":
                    if (!Convert.IsDBNull(objDataReader["DebitAmount"]))
                    {
                        objBankBookModel.DebitAmount = Convert.ToDecimal(objDataReader["DebitAmount"]);
                    }
                    break;

                case "CreditAmount":
                    if (!Convert.IsDBNull(objDataReader["CreditAmount"]))
                    {
                        objBankBookModel.CreditAmount = Convert.ToDecimal(objDataReader["CreditAmount"].ToString());
                    }
                    break;

                case "Remarks":
                    if (!Convert.IsDBNull(objDataReader["Remarks"]))
                    {
                        objBankBookModel.Remarks = objDataReader["Remarks"].ToString();
                    }
                    break;

                default:
                    break;
                }
            }
        }