public ProductVendorCollection GetAllProductVendorDynamicCollection(string whereExpression, string orderBy) { IDBManager dbm = new DBManager(); ProductVendorCollection cols = new ProductVendorCollection(); try { dbm.CreateParameters(2); dbm.AddParameters(0, "@WhereCondition", whereExpression); dbm.AddParameters(1, "@OrderByExpression", orderBy); IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectProductVendorsDynamic"); while (reader.Read()) { ProductVendor productVendor = new ProductVendor(); productVendor.ProductID = Int32.Parse(reader["ProductID"].ToString()); productVendor.VendorID = Int32.Parse(reader["VendorID"].ToString()); productVendor.AverageLeadTime = Int32.Parse(reader["AverageLeadTime"].ToString()); productVendor.StandardPrice = Decimal.Parse(reader["StandardCost"].ToString()); productVendor.LastReceiptCost = Decimal.Parse(reader["LastReceiptCost"].ToString()); productVendor.LastReceiptDate = DateTime.Parse(reader["LastReceiptDate"].ToString()); productVendor.MinOrderQty = Int32.Parse(reader["MinOrderQty"].ToString()); productVendor.MaxOrderQty = Int32.Parse(reader["MaxOrderQty"].ToString()); productVendor.OnOrderQty = Int32.Parse(reader["OnOrderQty"].ToString()); productVendor.UnitMeasureCode = reader["LastReceiptCost"].ToString(); productVendor.ModifiedDate = DateTime.Parse(reader["ModifiedDate"].ToString()); cols.Add(productVendor); } } catch (Exception ex) { log.Write(ex.Message, "GetAllProductVendorDynamicCollection"); throw (ex); } finally { dbm.Dispose(); } return(cols); }
public ProductVendorCollection GetAllProductVendorCollection() { IDBManager dbm = new DBManager(); ProductVendorCollection cols = new ProductVendorCollection(); try { IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectProductInventoriesAll"); while (reader.Read()) { ProductVendor productVendor = new ProductVendor(); productVendor.ID = Int32.Parse(reader["ID"].ToString()); productVendor.ProductID = Int32.Parse(reader["ProductID"].ToString()); productVendor.VendorID = Int32.Parse(reader["VendorID"].ToString()); productVendor.AverageLeadTime = Int32.Parse(reader["AverageLeadTime"].ToString()); productVendor.StandardPrice = Decimal.Parse(reader["StandardCost"].ToString()); productVendor.LastReceiptCost = Decimal.Parse(reader["LastReceiptCost"].ToString()); productVendor.LastReceiptDate = DateTime.Parse(reader["LastReceiptDate"].ToString()); productVendor.MinOrderQty = Int32.Parse(reader["MinOrderQty"].ToString()); productVendor.MaxOrderQty = Int32.Parse(reader["MaxOrderQty"].ToString()); productVendor.OnOrderQty = Int32.Parse(reader["OnOrderQty"].ToString()); productVendor.UnitMeasureCode = reader["LastReceiptCost"].ToString(); productVendor.ModifiedDate = DateTime.Parse(reader["ModifiedDate"].ToString()); cols.Add(productVendor); } } catch (Exception ex) { log.Write(ex.Message, "GetAllProductVendorCollection"); throw (ex); } finally { dbm.Dispose(); } return(cols); }