All pastes #387244 Raw Edit

reznor

public text v1 · immutable
·published 2007-03-09 05:53 UTC
rendered paste body
        private void loadFormComponants()
        {
            // Load the Families Dropdown
            DD_Families.DataSource = AllProductData.Tables["Families"];
            DD_Families.DisplayMember = "Description";
            DD_Families.ValueMember = "FamilyId";

            // Load the Departments Dropdown
            DD_Departments.DataSource = AllProductData.Tables["Departments"];
            DD_Departments.DisplayMember = "Description";
            DD_Departments.ValueMember = "DepartmentId";

            // Load the Categories Dropdown
            DD_Categories.DataSource = AllProductData.Tables["Categories"];
            DD_Categories.DisplayMember = "Description";
            DD_Categories.ValueMember = "CategoryId";

            // Load the SubCategories Dropdown
            DD_SubCategories.DataSource = AllProductData.Tables["SubCategories"];
            DD_SubCategories.DisplayMember = "Description";
            DD_SubCategories.ValueMember = "SubCategoryId";

            // Load the Product Data Grid View
            GV_ProductData.DataSource = AllProductData.Tables["Products"];

            // Setup the Column Headers
            GV_ProductData.Columns["ProductID"].HeaderText = "ID";
            GV_ProductData.Columns["BrandName"].HeaderText = "Brand Name";
            GV_ProductData.Columns["ProductName"].HeaderText = "Product Name";
            GV_ProductData.Columns["SRP"].HeaderText = "SRP";
            GV_ProductData.Columns["GrossWeight"].HeaderText = "Gross Wt.";
            GV_ProductData.Columns["NetWeight"].HeaderText = "Net Wt.";
            GV_ProductData.Columns["ShelfWidth"].HeaderText = "Width";
            GV_ProductData.Columns["ShelfHeight"].HeaderText = "Height";
            GV_ProductData.Columns["ShelfDepth"].HeaderText = "Depth";

            // Hide the Unnecessary Data
            GV_ProductData.Columns["SubcategoryID"].Visible = false;
            GV_ProductData.Columns["Price"].Visible = false;
            GV_ProductData.Columns["Cost"].Visible = false;
            GV_ProductData.Columns["RecyclablePackage"].Visible = false;
            GV_ProductData.Columns["LowFat"].Visible = false;
            GV_ProductData.Columns["UnitsPerCase"].Visible = false;
            GV_ProductData.Columns["CasesPerPallet"].Visible = false;
            GV_ProductData.Columns["LastUpdated"].Visible = false;
            GV_ProductData.Columns["Dirty"].Visible = false;

            IsLoaded = true;
        }
        private void DD_Families_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (IsLoaded == true) SynchronizeFamilies();
        }
        private void DD_Departments_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (IsLoaded == true) SynchronizeDepartments();
        }
        private void DD_Categories_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (IsLoaded == true) SynchronizeCategories();
        }
        private void DD_SubCategories_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (IsLoaded == true) SynchronizeSubCategories();
        }
        private void SynchronizeFamilies()
        {
            AllProductData.Tables["Departments"].DefaultView.RowFilter = "FamilyId = " + DD_Families.SelectedValue.ToString();
            SynchronizeDepartments();
        }
        private void SynchronizeDepartments()
        {
            AllProductData.Tables["Categories"].DefaultView.RowFilter = "DepartmentId = " + DD_Departments.SelectedValue.ToString();
            SynchronizeCategories();
        }
        private void SynchronizeCategories()
        {
            AllProductData.Tables["Subcategories"].DefaultView.RowFilter = "CategoryId = " + DD_Categories.SelectedValue.ToString();
            SynchronizeSubCategories();
        }
        private void SynchronizeSubCategories()
        {
            AllProductData.Tables["Products"].DefaultView.RowFilter = "SubcategoryId = " + DD_SubCategories.SelectedValue.ToString();
        }