Esempio n. 1
0
File: RMS.cs Progetto: jeem200/RMS
        private void deleteItemBtn_Click(object sender, EventArgs e)
        {
            string curName, reCurName, query;

            try
            {
                ItemDataAccess ob = new ItemDataAccess();
                curName   = deleteItemCinTbox.Text.ToString().ToUpper();
                reCurName = deleteItemRcinTbox.Text.ToString().ToUpper();
                if (curName.CompareTo("") != 0 && reCurName.CompareTo("") != 0)
                {
                    if (curName.CompareTo(reCurName) == 0)
                    {
                        query = "Delete From Item Where Name='" + curName + "'";
                        int rowCount = ob.editItem(query);
                        if (rowCount > 0)
                        {
                            MetroFramework.MetroMessageBox.Show(this, "Item Deleted Successfully");
                            itemCategoryComboboxFill();
                            itemListCategoryComboboxDefaultSelect();
                            autoCompleteItemCategoryTbox();
                            autoCompleteItemNameTbox();
                        }
                        else
                        {
                            MetroFramework.MetroMessageBox.Show(this, "Current Item Name Not Found ");
                        }
                    }
                    else
                    {
                        MetroFramework.MetroMessageBox.Show(this, "Wrong Input: Both Names Are Not Same.\nType Both Names Again.");
                    }
                }
                else
                {
                    MetroFramework.MetroMessageBox.Show(this, "Error: Input Can't be Blank");
                }
                deleteItemCinTbox.Text  = "";
                deleteItemRcinTbox.Text = "";
            }

            catch (FormatException)
            {
                MetroFramework.MetroMessageBox.Show(this, "Error: Wrong Input");
            }

            catch (Exception exc)
            {
                MetroFramework.MetroMessageBox.Show(this, exc.ToString());
            }
        }
Esempio n. 2
0
File: RMS.cs Progetto: jeem200/RMS
        private void editItemPriceBtn_Click(object sender, EventArgs e)
        {
            string curName, query;
            double newPrice;

            try
            {
                ItemDataAccess ob = new ItemDataAccess();
                curName = editItemPriceCin.Text.ToString().ToUpper();

                if (curName.CompareTo("") != 0 && editItemPriceNip.Text.ToString().CompareTo("") != 0)
                {
                    newPrice = Convert.ToDouble(editItemPriceNip.Text.ToString());
                    query    = "UPDATE ITEM Set Price=" + newPrice + " WHERE Name='" + curName + "'";
                    int rowCount = ob.editItem(query);
                    if (rowCount > 0)
                    {
                        MetroFramework.MetroMessageBox.Show(this, "Item Price Edited Successfully");
                        itemCategoryComboboxFill();
                        itemListCategoryComboboxDefaultSelect();
                    }
                    else
                    {
                        MetroFramework.MetroMessageBox.Show(this, "Current Item Name Not Found ");
                    }
                }
                else
                {
                    MetroFramework.MetroMessageBox.Show(this, "Error: Input Can't be Blank");
                }
                editItemPriceCin.Text = "";
                editItemPriceNip.Text = "";
            }

            catch (FormatException)
            {
                MetroFramework.MetroMessageBox.Show(this, "Error: Wrong Input");
            }

            catch (Exception exc)
            {
                MetroFramework.MetroMessageBox.Show(this, exc.ToString());
            }
        }
Esempio n. 3
0
File: RMS.cs Progetto: jeem200/RMS
        private void editCategoryNameBtn_Click(object sender, EventArgs e)
        {
            string curName, newCategory, query;

            try
            {
                ItemDataAccess ob = new ItemDataAccess();
                curName     = editCategoryNameCin.Text.ToString().ToUpper();
                newCategory = editCategoryNameNcn.Text.ToString().ToUpper();
                if (curName.CompareTo("") != 0 && newCategory.CompareTo("") != 0)
                {
                    query = "UPDATE ITEM Set Category='" + newCategory + "' WHERE Name='" + curName + "'";
                    int rowCount = ob.editItem(query);
                    if (rowCount > 0)
                    {
                        MetroFramework.MetroMessageBox.Show(this, "Item Category Edited Successfully");
                        itemCategoryComboboxFill();
                        itemListCategoryComboboxDefaultSelect();
                        autoCompleteItemCategoryTbox();
                    }
                    else
                    {
                        MetroFramework.MetroMessageBox.Show(this, "Current Item Name Not Found ");
                    }
                }
                else
                {
                    MetroFramework.MetroMessageBox.Show(this, "Error: Input Can't be Blank");
                }
                editCategoryNameCin.Text = "";
                editCategoryNameNcn.Text = "";
            }

            catch (FormatException)
            {
                MetroFramework.MetroMessageBox.Show(this, "Error: Wrong Input");
            }

            catch (Exception exc)
            {
                MetroFramework.MetroMessageBox.Show(this, exc.ToString());
            }
        }