Пример #1
0
 private void DeletePartButton_Click(object sender, EventArgs e)
 {
     if (PartsBox.SelectedIndex > -1)
     {
         var confirmResult = MessageBox.Show("Are you sure to delete this Part ??",
                                             "Confirm Delete!!",
                                             MessageBoxButtons.YesNo);
         if (confirmResult == DialogResult.Yes)
         {
             Item      selectedItem = (Item)PartsBox.SelectedItem;
             ItemsCTRL itemctrl     = new ItemsCTRL();
             selectedItem.StockQuantity = -1;
             itemctrl.changeItem(selectedItem);
             MessageBox.Show("PART HAS BEEN REMOVED");
         }
         else
         {
             return;
         }
     }
     else
     {
         MessageBox.Show("Please Select a Part to Delete");
     }
     return;
 }
Пример #2
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            ItemsCTRL items = new ItemsCTRL();

            itemsListDS.Clear();

            foreach (Item i in items.geItemsByCategory(comboBox1.Text))
            {
                if (i.StockQuantity > -1)
                {
                    itemsListDS.Add(i);
                }
            }
        }
Пример #3
0
        private void Initialize()
        {
            VendorSelectBox.Items.Clear();
            CategorySelectBox.Items.Clear();
            PartsBox.Items.Clear();
            EditCategoryBox.Items.Clear();
            VendorCTRL vendorctrl = new VendorCTRL();

            foreach (Vendor v in vendorctrl.getAllVendors())
            {
                VendorSelectBox.Items.Add(v);
            }
            ItemsCTRL itemctrl = new ItemsCTRL();

            foreach (String category in itemctrl.getItemCategories())
            {
                CategorySelectBox.Items.Add(category);
                EditCategoryBox.Items.Add(category);
            }
        }
Пример #4
0
        private void SavePartButton_Click(object sender, EventArgs e)
        {
            ItemsCTRL itemctrl = new ItemsCTRL();
            Vendor    vendor   = (Vendor)VendorSelectBox.SelectedItem;

            if (String.IsNullOrEmpty(txtItemNameBox.Text))
            {
                MessageBox.Show("Please Enter Part Name");
                return;
            }
            else if (String.IsNullOrEmpty(txtCostPriceBox.Text))
            {
                MessageBox.Show("Please Enter Cost");
                return;
            }
            else if (String.IsNullOrEmpty(txtRetailPriceBox.Text))
            {
                MessageBox.Show("Please Enter Retail Price");
                return;
            }
            else if (String.IsNullOrEmpty(txtStockQuantityBox.Text))
            {
                MessageBox.Show("Please Enter Stock Quantity");
                return;
            }
            Item item = new Item();

            item.Category      = (String)CategorySelectBox.SelectedItem;
            item.CostPrice     = Convert.ToDecimal(txtCostPriceBox.Text);
            item.RetailPrice   = Convert.ToDecimal(txtRetailPriceBox.Text);
            item.StockQuantity = Convert.ToInt32(txtStockQuantityBox.Text);
            item.ItemName      = txtItemNameBox.Text;
            itemctrl.addItem(item, vendor);
            MessageBox.Show("ITEM ADDED TO INVENTORY");
            CategorySelectBox.ResetText();
            VendorSelectBox.ResetText();
            txtCostPriceBox.Clear();
            txtRetailPriceBox.Clear();
            txtStockQuantityBox.Clear();
            txtItemNameBox.Clear();
        }
Пример #5
0
        private void Initialize()
        {
            itemsListDS.Clear();
            cartItemsDS.Clear();
            myOrdersDS.Clear();
            myOrdersItemsDS.Clear();
            comboBox1.Items.Clear();
            ItemsCTRL items = new ItemsCTRL();

            foreach (String s in items.getItemCategories())
            {
                comboBox1.Items.Add(s);
            }

            listBox1.DataSource        = itemsListDS;
            ShoppingCart.DataSource    = cartItemsDS;
            cartItemsDS.ListChanged   += new ListChangedEventHandler(list_ListChanged);
            MyOrdersListbox.DataSource = myOrdersDS;
            MyItemsListbox.DataSource  = myOrdersItemsDS;
            panelAccount.Height        = 52;
            panelResources.Height      = 52;
        }
Пример #6
0
        private void btnSaveEditedPart_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtEditItemNameBox.Text))
            {
                MessageBox.Show("Please Enter Part Name");
                return;
            }
            else if (String.IsNullOrEmpty(txtEditCostPriceBox.Text))
            {
                MessageBox.Show("Please Enter Cost");
                return;
            }
            else if (String.IsNullOrEmpty(txtEditRetailPriceBox.Text))
            {
                MessageBox.Show("Please Enter Retail Price");
                return;
            }
            else if (String.IsNullOrEmpty(txtEditStockQuantityBox.Text))
            {
                MessageBox.Show("Please Enter Stock Quantity");
                return;
            }
            Item item = (Item)PartsBox.SelectedItem;

            item.ItemName      = txtEditItemNameBox.Text;
            item.CostPrice     = Convert.ToDecimal(txtEditCostPriceBox.Text);
            item.RetailPrice   = Convert.ToDecimal(txtEditRetailPriceBox.Text);
            item.StockQuantity = Convert.ToInt32(txtEditStockQuantityBox.Text);
            ItemsCTRL itemsctrl = new ItemsCTRL();

            itemsctrl.changeItem(item);
            MessageBox.Show("PART SAVED");
            txtEditItemNameBox.Clear();
            txtEditCostPriceBox.Clear();
            txtEditRetailPriceBox.Clear();
            txtEditStockQuantityBox.Clear();
            PartsBox.Items.Clear();
        }
Пример #7
0
        private void btnGetAllParts_Click(object sender, EventArgs e)
        {
            PartsBox.Items.Clear();
            string    category;
            ItemsCTRL itemctrl = new ItemsCTRL();

            if (EditCategoryBox.SelectedIndex > -1)
            {
                category = EditCategoryBox.SelectedItem.ToString();
            }
            else
            {
                MessageBox.Show("SELECT CATEGORY");
                return;
            }

            foreach (Item item in itemctrl.geItemsByCategory(category))
            {
                if (item.StockQuantity > -1)
                {
                    PartsBox.Items.Add(item);
                }
            }
        }