public SpecialOfferProductCollection GetAllSpecialOfferProductsDynamicCollection(string whereExpression, string orderBy) { IDBManager dbm = new DBManager(); SpecialOfferProductCollection cols = new SpecialOfferProductCollection(); try { dbm.CreateParameters(2); dbm.AddParameters(0, "@WhereCondition", whereExpression); dbm.AddParameters(1, "@OrderByExpression", orderBy); IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectSpecialOfferProductsDynamic"); while (reader.Read()) { SpecialOfferProduct SOP = new SpecialOfferProduct(); SOP.SpecialOfferID = Int32.Parse(reader["SpecialOfferID"].ToString()); SOP.ProductID = Int32.Parse(reader["ProductID"].ToString()); SOP.ModifiedDate = DateTime.Parse(reader["ModifiedDate"].ToString()); cols.Add(SOP); } } catch (Exception ex) { log.Write(ex.Message, "GetAllSpecialOfferProductsDynamicCollection"); throw (ex); } finally { dbm.Dispose(); } return(cols); }
public SpecialOfferProductCollection GetAllSpecialOfferProductsCollection() { IDBManager dbm = new DBManager(); SpecialOfferProductCollection cols = new SpecialOfferProductCollection(); try { IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectSpecialOfferProductAll"); while (reader.Read()) { SpecialOfferProduct SOP = new SpecialOfferProduct(); SOP.SpecialOfferID = Int32.Parse(reader["SpecialOfferID"].ToString()); SOP.ProductID = Int32.Parse(reader["ProductID"].ToString()); SOP.ModifiedDate = DateTime.Parse(reader["ModifiedDate"].ToString()); cols.Add(SOP); } } catch (Exception ex) { log.Write(ex.Message, "GetAllSpecialOfferProductsCollection"); throw (ex); } finally { dbm.Dispose(); } return(cols); }