public frmAddCustItems(frmNewOrder form)
        {
            InitializeComponent();

            badc = new BusinessAppDataContext();  //initialize db context
            this.form = form;  //assign form reference
            //this.orderID = orderID;

            brandsIndexesList = new List<int>(); 
            productsIndexesList = new List<int>();
            itemsDGVIndexesList = new List<int>(); 

            productID_QuantityDict = new Dictionary<int, int>();
            productID_OrderItemsDict = new Dictionary<int, tblOrder_Item>();
            //productID_OrderItemsDictTemp = new Dictionary<int, tblOrder_Item>(); 

            cmbBxBrand.Items.Clear();  //clear brand combo box
            cmbBxBrand.Items.Add("--Choose Brand--"); //add first entry in combo box
            cmbBxBrand.SelectedIndex = 0;  //set selected index to 0

            brandsIndexesList.Add(0); //add 0 to brand indexes list

            cmbBxProducts.Enabled = false; //disable products combo box

            dgvItems.Rows.Clear();  //clear data grid view 

            //query for list of brands
            var brands = from table in badc.tblProductBrands select table;

            foreach (var element in brands) 
            {
                cmbBxBrand.Items.Add(element.Brand_Name); //add brands to combo box
                brandsIndexesList.Add(element.Brand_ID);  //add indexes to list
            }

            //query for list of all products
            var products = from table in badc.tblProductItems select table;

            foreach (var element in products)
            {
                //add product ids and quantities to list
                productID_QuantityDict.Add(element.Product_ID, element.Quantity);
            }
        }
示例#2
0
        private void btnNewOrder_Click_1(object sender, EventArgs e)
        {
            if (!txtBxNameCompany.Text.Equals(""))
            {
                lblErrorSelectCust.Visible = false;

                frmNewOrder frmNO = new frmNewOrder(this, custIDList[cmbBxExistCust.SelectedIndex]);
                frmNO.ShowDialog();
            }
        }