public ProductAdjustmentHistoryCollection GetAllProductAdjustmentHistoryCollection(int purchaseAdjustedQuantity) { IDBManager dbm = new DBManager(); ProductAdjustmentHistoryCollection cols = new ProductAdjustmentHistoryCollection(); try { dbm.CreateParameters(1); dbm.AddParameters(0, "@ProductID", purchaseAdjustedQuantity); IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectProductAdjustmentHistoryByAdjustedQuantity"); while (reader.Read()) { ProductAdjustmentHistory PAH = new ProductAdjustmentHistory(); PAH.ProductID = Int32.Parse(reader["ProductID"].ToString()); PAH.AdjustedQuantity = Int32.Parse(reader["AdjustedQuantity"].ToString()); PAH.Reason = reader["Reason"].ToString(); PAH.ModifiedDate = DateTime.Parse(reader["ModifiedDate"].ToString()); cols.Add(PAH); } } catch (Exception ex) { log.Write(ex.Message, "ProductAdjustmentHistoryCollection"); throw (ex); } finally { dbm.Dispose(); } return(cols); }
public ProductAdjustmentHistoryCollection GetAllProductAdjustmentHistoryDynamicCollection(string whereExpression, string orderBy) { IDBManager dbm = new DBManager(); ProductAdjustmentHistoryCollection cols = new ProductAdjustmentHistoryCollection(); try { dbm.CreateParameters(2); dbm.AddParameters(0, "@WhereCondition", whereExpression); dbm.AddParameters(1, "@OrderByExpression", orderBy); IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectUsersDynamic"); while (reader.Read()) { ProductAdjustmentHistory PAH = new ProductAdjustmentHistory(); PAH.ProductID = Int32.Parse(reader["ProductID"].ToString()); PAH.AdjustedQuantity = Int32.Parse(reader["ProductID"].ToString()); PAH.Reason = reader["Reason"].ToString(); PAH.ModifiedDate = DateTime.Parse(reader["ModifiedDate"].ToString()); cols.Add(PAH); } } catch (Exception ex) { log.Write(ex.Message, "GetAllProductAdjustmentHistoryDynamicCollection"); throw (ex); } finally { dbm.Dispose(); } return(cols); }