Esempio 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;
            }
        }
        void search_Button_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            var productDbUtils1        = new ProductDbUtils();
            var productDbUtils2        = new ProductDbUtils();
            var productCategoryDbUtils = new ProductCategoryDbUtils();

            if (productcode_Textbox.Text == "")
            {
                MessageBox.Show("Dont leave empty!");
            }
            else
            {
                if (productDbUtils1.getProductByCode(productcode_Textbox.Text) == true)
                {
                    product         = new Product();
                    productCategory = new ProductCategory();
                    product         = productDbUtils2.getProduct(productcode_Textbox.Text);
                    productCategory = productCategoryDbUtils.getProductCategory(product.getProductCategoryCode());

                    costumer_Reciept.Text    = firstname_TextBox.Text + " " + lastname_TextBox.Text;
                    contact_Reciept.Text     = contact_Textbox.Text;
                    name_Reciept.Text        = product.getProductName();
                    brand_Reciept.Text       = product.getProductBrand();
                    description_Reciept.Text = productCategory.getCategoryDescription();
                    type_Reciept.Text        = productCategory.getCategoryType();
                    price_Reciept.Text       = product.getProductPrice().ToString();
                }
                else
                {
                    MessageBox.Show("No Product found!");
                }
            }
        }
Esempio n. 3
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!");
            }
        }
Esempio n. 4
0
        void delete_Button_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            productCatDbutils = new ProductCategoryDbUtils();
            productCatDbutils.deleteCategory(code_Textbox.Text);

            var categoryWindow = new CategoryWindow();

            categoryWindow.Show();
            Hide();
        }
Esempio n. 5
0
        public DashboardControl()
        {
            InitializeComponent();
            productDbutils       = new ProductDbUtils();
            productCategoryUtils = new ProductCategoryDbUtils();
            long product  = productDbutils.productCounter();
            long category = productCategoryUtils.categoryCounter();

            productCount.Content  = product.ToString();
            categoryCount.Content = category.ToString();
        }
Esempio n. 6
0
 public void updateCounter(int connection)
 {
     if (connection == 1)
     {
         productDbutils       = new ProductDbUtils();
         productCategoryUtils = new ProductCategoryDbUtils();
         long product  = productDbutils.productCounter();
         long category = productCategoryUtils.categoryCounter();
         productCount.Content  = product.ToString();
         categoryCount.Content = category.ToString();
     }
 }
        void create_Button_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            productCatDbutils = new ProductCategoryDbUtils();
            var productCategory = new ProductCategory();

            productCategory.setCategoryCode(categorycode_Textbox.Text);
            productCategory.setCategoryDescription(description_Textbox.Text);
            productCategory.setCategoryType(type_Textbox.Text);
            productCatDbutils.createProductCategory(productCategory);
            Hide();
            MessageBox.Show("Created");
        }
Esempio n. 8
0
        public CategoryOpWindow(String catCode)
        {
            productCat        = new ProductCategory();
            productCatDbutils = new ProductCategoryDbUtils();

            InitializeComponent();
            this.catCode      = catCode;
            code_Textbox.Text = this.catCode;

            productCat = productCatDbutils.getProductCategory(this.catCode);
            Description_Textbox.Text = productCat.getCategoryDescription();
            type_Textbox.Text        = productCat.getCategoryType();
        }
Esempio n. 9
0
        void update_Button_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            try {
                productCat        = new ProductCategory();
                productCatDbutils = new ProductCategoryDbUtils();


                productCat.setCategoryCode(code_Textbox.Text);
                productCat.setCategoryDescription(Description_Textbox.Text);
                productCat.setCategoryType(type_Textbox.Text);
                productCatDbutils.updateCategory(productCat);

                var categoryWindow = new CategoryWindow();
                categoryWindow.Show();
                Hide();
            } catch (Exception) {
                MessageBox.Show("Error");
            }
        }
        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();
                }
            }
        }
 public CategoryWindow()
 {
     InitializeComponent();
     productCategoryDbUtils        = new ProductCategoryDbUtils();
     category_DataGrid.ItemsSource = productCategoryDbUtils.getAllCategory().DefaultView;
 }