Esempio n. 1
0
        public ProductInventoryCollection GetAllProductInventorysDynamicCollection(string whereExpression, string orderBy)
        {
            IDBManager dbm = new DBManager();
            ProductInventoryCollection cols = new ProductInventoryCollection();

            try
            {
                dbm.CreateParameters(2);
                dbm.AddParameters(0, "@WhereCondition", whereExpression);
                dbm.AddParameters(1, "@OrderByExpression", orderBy);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectProductInventoriesDynamic");
                while (reader.Read())
                {
                    ProductInventory productInventory = new ProductInventory();
                    productInventory.ProductID    = Int32.Parse(reader["ProductID"].ToString());
                    productInventory.LocationID   = Int32.Parse(reader["LocationID"].ToString());
                    productInventory.Shelf        = reader["Shelf"].ToString();
                    productInventory.Bin          = Byte.Parse(reader["Bin"].ToString());
                    productInventory.Quantity     = Int16.Parse(reader["Quantity"].ToString());
                    productInventory.ModifiedDate = DateTime.Parse(reader["ModifiedDate"].ToString());
                    cols.Add(productInventory);
                }
            }

            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAllProductInventorysDynamicCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }
Esempio n. 2
0
        public ProductInventoryCollection GetAllProductInventorysCollection()
        {
            IDBManager dbm = new DBManager();
            ProductInventoryCollection cols = new ProductInventoryCollection();

            try
            {
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectProductInventoriesAll");
                while (reader.Read())
                {
                    ProductInventory productInventory = new ProductInventory();
                    productInventory.ProductID    = Int32.Parse(reader["ProductID"].ToString());
                    productInventory.LocationID   = Int32.Parse(reader["LocationID"].ToString());
                    productInventory.Shelf        = reader["Shelf"].ToString();
                    productInventory.Quantity     = Int16.Parse(reader["Quantity"].ToString());
                    productInventory.ModifiedDate = DateTime.Parse(reader["ModifiedDate"].ToString());
                    cols.Add(productInventory);
                }
            }

            catch (Exception ex)
            {
                log.Write(ex.Message, "ProductInventoryCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }