public InventoryRecord[] GetInventory()
    {
        var d = new InventoryDal();

        d.OpenConnection(ConnString);
        var dt = d.GetAllInventoryAsDataTable();

        d.CloseConnection();

        var records = new List <InventoryRecord>();
        var reader  = dt.CreateDataReader();

        while (reader.Read())
        {
            var r = new InventoryRecord()
            {
                Id      = (int)reader["CarId"],
                Color   = ((string)reader["Color"]),
                Make    = ((string)reader["Make"]),
                PetName = ((string)reader["PetName"])
            };
            records.Add(r);
        }

        return(records.ToArray());
    }
Пример #2
0
    private void RefreshGrid()
    {
        var dal = new InventoryDal();

        dal.OpenConnection(ConnectionString);
        DataTable carsDataTable = dal.GetAllInventoryAsDataTable();

        dal.CloseConnection();
        carsGridView.DataSource = carsDataTable;
        carsGridView.DataBind();
    }
Пример #3
0
        private static void ListInventory(InventoryDal invDal)
        {
            DataTable dt = invDal.GetAllInventoryAsDataTable();

            DisplayTable(dt);
        }
Пример #4
0
        private static void ListInventory(InventoryDal inventory)
        {
            var dt = inventory.GetAllInventoryAsDataTable();

            DisplayTable(dt);
        }