Esempio n. 1
0
        private void PopulateWarehouses()
        {
            // Get the region drop down
            DropDownList dropDownListRegion    = GetControl <DropDownList>("ddlRegion", PageFormView);
            DropDownList dropDownListWarehouse = GetControl <DropDownList>("ddlWarehouse", PageFormView);

            dropDownListWarehouse.Items.Clear();

            if (dropDownListRegion.SelectedIndex > 0)
            {
                // Populate the list of regions
                try
                {
                    dropDownListWarehouse.DataSource =
                        WarehouseController.GetWarehousesByRegion(Convert.ToInt32(dropDownListRegion.SelectedItem.Value));
                }
                catch (Exception ex)
                {
                    if (ExceptionPolicy.HandleException(ex, "User Interface"))
                    {
                        DisplayMessage("Failed to retrieve Warehouses");
                    }
                }
                dropDownListWarehouse.DataBind();
            }
            // Now add the all
            dropDownListWarehouse.Items.Insert(0, new ListItem("All", "-1"));

            // Enable the warehouse drop down
            dropDownListWarehouse.Enabled = (dropDownListWarehouse.Items.Count > 1);
        }