Пример #1
0
        //--------Author: Carol He ----------Add New Product---------------------------------------------------------------------------------------
        private void btnAdd_Click(object sender, EventArgs e)
        {
            frmAddUpdateProduct addProductForm = new frmAddUpdateProduct();

            addProductForm.addProduct = true;
            //addProductForm.product = product;
            DialogResult result = addProductForm.ShowDialog();

            productIdComboBox.Items.Clear();
            loadProductIdComboBox();
            LoadProductList();
            ClearControls();


            //if (result == DialogResult.OK)
            //{
            //    product = addProductForm.product;
            //    txtCustomerID.Text = customer.CustomerID.ToString();
            //    this.DisplayCustomer();
            //}


            //frmAddModifyCustomer addCustomerForm = new frmAddModifyCustomer();
            //addCustomerForm.addCustomer = true;
            //DialogResult result = addCustomerForm.ShowDialog();
            //if (result == DialogResult.OK)
            //{
            //    customer = addCustomerForm.customer;
            //    txtCustomerID.Text = customer.CustomerID.ToString();
            //    this.DisplayCustomer();
            //}
        }
Пример #2
0
        private void btnModify_Click(object sender, EventArgs e)
        {
            frmAddUpdateProduct modifyProductForm = new frmAddUpdateProduct();

            modifyProductForm.addProduct = false;
            modifyProductForm.product    = product;
            DialogResult result = modifyProductForm.ShowDialog();

            if (result == DialogResult.OK)
            {
                product = modifyProductForm.product;
                this.DisplayProduct();
                //modifyProductForm.txtProductId =
            }
            else if (result == DialogResult.Retry)
            {
                this.GetProduct(product.ProductId);
                if (product != null)
                {
                    this.DisplayProduct();
                }
                else
                {
                    this.ClearControls();
                }
            }

            LoadProductList();
            ClearControls();
        }