public ProductListPriceHistoryCollection GetAllProductListPriceHistorysDynamicCollection(string whereExpression, string orderBy) { IDBManager dbm = new DBManager(); ProductListPriceHistoryCollection cols = new ProductListPriceHistoryCollection(); try { dbm.CreateParameters(2); dbm.AddParameters(0, "@WhereCondition", whereExpression); dbm.AddParameters(1, "@OrderByExpression", orderBy); IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectProductListPriceHistoriesDynamic"); while (reader.Read()) { ProductListPriceHistory productListPriceHistory = new ProductListPriceHistory(); productListPriceHistory.ID = Int32.Parse(reader["ID"].ToString()); productListPriceHistory.ProductID = Int32.Parse(reader["ProductID"].ToString()); productListPriceHistory.StartDate = DateTime.Parse(reader["StartDate"].ToString()); productListPriceHistory.EndDate = DateTime.Parse(reader["EndDate"].ToString()); productListPriceHistory.ListPrice = Decimal.Parse(reader["ListPrice"].ToString()); productListPriceHistory.ModifiedDate = DateTime.Parse(reader["ModifiedDate"].ToString()); cols.Add(productListPriceHistory); } } catch (Exception ex) { log.Write(ex.Message, "GetAllProductListPriceHistorysDynamicCollection"); throw (ex); } finally { dbm.Dispose(); } return(cols); }
public ProductListPriceHistoryCollection GetAllProductListPriceHistoryCollection() { IDBManager dbm = new DBManager(); ProductListPriceHistoryCollection cols = new ProductListPriceHistoryCollection(); try { IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectProductListPriceHistoriesAll"); while (reader.Read()) { ProductListPriceHistory productListPriceHistory = new ProductListPriceHistory(); productListPriceHistory.ID = Int32.Parse(reader["ID"].ToString()); productListPriceHistory.ProductID = Int32.Parse(reader["ProductID"].ToString()); productListPriceHistory.StartDate = DateTime.Parse(reader["StartDate"].ToString()); productListPriceHistory.EndDate = DateTime.Parse(reader["EndDate"].ToString()); productListPriceHistory.ListPrice = Decimal.Parse(reader["ListPrice"].ToString()); productListPriceHistory.ModifiedDate = DateTime.Parse(reader["ModifiedDate"].ToString()); cols.Add(productListPriceHistory); } } catch (Exception ex) { log.Write(ex.Message, "GetAllProductListPriceHistoryCollection"); throw (ex); } finally { dbm.Dispose(); } return(cols); }