Exemplo n.º 1
0
        void verify_Button_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            var productCategoryDbutils = new ProductCategoryDbUtils();
            var productCategory        = new ProductCategory();

            productCategory.setCategoryCode(categoryid_Textbox.Text);

            if (productCategoryDbutils.getCategoryByCode(productCategory) == false)
            {
                var createCategory = new CreateCategory();
                createCategory.Show();
                MessageBox.Show("Category not exist! Create category");
            }
            else
            {
                productCategory          = productCategoryDbutils.getProductCategory(categoryid_Textbox.Text);
                description_Summary.Text = productCategory.getCategoryDescription();
                type_Summary.Text        = productCategory.getCategoryType();

                supplier_Summary.Text   = firstname_Textbox.Text + " " + lastname_Textbox.Text;
                contact_Summary.Text    = contact_Textbox.Text;
                code_Summary.Text       = code_Textbox.Text;
                name_Summary.Text       = name_Textbox.Text;
                brand_Summary.Text      = name_Textbox.Text;
                quantity_Summary.Text   = quantity_Textbox.Text;
                price_Summary.Text      = price_Textbox.Text;
                categoryid_Summary.Text = categoryid_Textbox.Text;
            }
        }
Exemplo n.º 2
0
        void update_Button_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            try {
                productCategoryDbUtils = new ProductCategoryDbUtils();
                productDbUtils         = new ProductDbUtils();
                product         = new Product();
                productCategory = new ProductCategory();


                productCategory.setCategoryCode(categoryid_Textbox.Text);

                if (productCategoryDbUtils.getCategoryByCode(productCategory) == false)
                {
                    MessageBox.Show("No Category Found! Create First.");
                    categoryid_Textbox.Text = "";
                }
                else
                {
                    product.setProductCode(code_Textbox.Text);
                    product.setProductName(name_Textbox.Text);
                    product.setProductBrand(brand_Textbox.Text);
                    product.setProductQuantity(Int32.Parse(quantity_Textbox.Text));
                    product.setProductPrice(Int32.Parse(price_Textbox.Text));
                    product.setProductCategoryCode(categoryid_Textbox.Text);
                    productDbUtils.updateProduct(product);

                    var productWindow = new ProductWindow();
                    productWindow.Show();
                    Hide();
                }
            } catch (Exception) {
                MessageBox.Show("Digits only in Quantity and Price!");
            }
        }
        void search_Button_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (categoryCode_Textbox.Text == "")
            {
                MessageBox.Show("Dont leave blank!");
            }
            else
            {
                productCategoryDbUtils = new ProductCategoryDbUtils();
                productCategory        = new ProductCategory();
                productCategory.setCategoryCode(categoryCode_Textbox.Text);

                if (productCategoryDbUtils.getCategoryByCode(productCategory) == false)
                {
                    MessageBox.Show("Category not found!");
                }
                else
                {
                    var categoryOpWindow = new CategoryOpWindow(categoryCode_Textbox.Text);
                    Close();
                    categoryOpWindow.Show();
                }
            }
        }