public ProductCostHistoryCollection GetAllProductCostHistorysDynamicCollection(string whereExpression, string orderBy) { IDBManager dbm = new DBManager(); ProductCostHistoryCollection cols = new ProductCostHistoryCollection(); try { dbm.CreateParameters(2); dbm.AddParameters(0, "@WhereCondition", whereExpression); dbm.AddParameters(1, "@OrderByExpression", orderBy); IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectProductInventoriesDynamic"); while (reader.Read()) { ProductCostHistory productCostHistory = new ProductCostHistory(); productCostHistory.ProductID = Int32.Parse(reader["ProductID"].ToString()); productCostHistory.StartDate = DateTime.Parse(reader["StartDate"].ToString()); productCostHistory.EndDate = DateTime.Parse(reader["EndDate"].ToString()); productCostHistory.StandardCost = Decimal.Parse(reader["StandardCost"].ToString()); productCostHistory.ModifiedDate = DateTime.Parse(reader["ModifiedDate"].ToString()); cols.Add(productCostHistory); } } catch (Exception ex) { log.Write(ex.Message, "GetAllProductCostHistorysDynamicCollection"); throw (ex); } finally { dbm.Dispose(); } return(cols); }
public ProductCostHistoryCollection GetAllProductCostHistorysCollection() { IDBManager dbm = new DBManager(); ProductCostHistoryCollection cols = new ProductCostHistoryCollection(); try { IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectProductCostHistoriesAll"); while (reader.Read()) { ProductCostHistory productCostHistory = new ProductCostHistory(); productCostHistory.ID = Int32.Parse(reader["ID"].ToString()); productCostHistory.ProductID = Int32.Parse(reader["ProductID"].ToString()); productCostHistory.StartDate = DateTime.Parse(reader["StartDate"].ToString()); productCostHistory.EndDate = DateTime.Parse(reader["EndDate"].ToString()); productCostHistory.StandardCost = Decimal.Parse(reader["StandardCost"].ToString()); productCostHistory.ModifiedDate = DateTime.Parse(reader["ModifiedDate"].ToString()); cols.Add(productCostHistory); } } catch (Exception ex) { log.Write(ex.Message, "GetAllProductCostHistorysCollection"); throw (ex); } finally { dbm.Dispose(); } return(cols); }