private void deleteBtn_Click(object sender, EventArgs e)
        {
            if (stocksDataGrid.RowCount != 0)
            {
                int selectedIndex = stocksDataGrid.CurrentCell.RowIndex;
                if (selectedIndex > -1)
                {
                    string stockId       = stocksDataGrid.Rows[selectedIndex].Cells[0].Value.ToString();
                    string productId     = stocksDataGrid.Rows[selectedIndex].Cells[1].Value.ToString();
                    string productName   = stocksDataGrid.Rows[selectedIndex].Cells[2].Value.ToString();
                    string details       = stocksDataGrid.Rows[selectedIndex].Cells[3].Value.ToString();
                    string stockDate     = stocksDataGrid.Rows[selectedIndex].Cells[4].Value.ToString();
                    string quantity      = stocksDataGrid.Rows[selectedIndex].Cells[5].Value.ToString();
                    string cost          = stocksDataGrid.Rows[selectedIndex].Cells[5].Value.ToString();
                    stock  selectedStock = new stock(int.Parse(stockId), int.Parse(productId),
                                                     productName, details, Convert.ToDateTime(stockDate), int.Parse(quantity), decimal.Parse(cost));

                    stockDataManipulations stockDataManipulations = new stockDataManipulations();
                    Boolean stockDeletion = stockDataManipulations.deleteStock(selectedStock);

                    if (stockDeletion)
                    {
                        MessageBox.Show("Deletion Successfull. Data deleted successfully", "Important Note",
                                        MessageBoxButtons.OK);
                    }
                    else
                    {
                        MessageBox.Show("Deletion Failed. Error occured while deleting data", "Important Note",
                                        MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                    }
                }
            }
        }
示例#2
0
        private void btnAddCatagory_Click(object sender, EventArgs e)
        {
            String catName = ((txtCatName.Text).Replace(" ", string.Empty)).Clone().ToString();

            if (catName == "")
            {
                catnameVerify.Show();
                hideLabelsTimer();
            }
            else
            {
                String itmCatName = (txtCatName.Text).Clone().ToString();
                String itmCatDesc = (txtCatDsc.Text).Clone().ToString();

                itemCategory           itemCat = new itemCategory(-1, itmCatName, itmCatDesc);
                stockDataManipulations stockDataManipulations = new stockDataManipulations();
                Boolean catInsertion = stockDataManipulations.addNewItemCat(itemCat);
                if (catInsertion)
                {
                    MessageBox.Show("Insertion Successfull. Data saved successfully", "Important Note",
                                    MessageBoxButtons.OK);
                    clearForm();
                }
                else
                {
                    MessageBox.Show("Insertion Failed.Check the insert data again", "Important Note",
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                }
            }
        }
        private void bindDataGridData()
        {
            stockDataManipulations stockDataManipulations = new stockDataManipulations();
            List <stock>           currentStock           = stockDataManipulations.getCurrentStockData();

            stocksDataGrid.DataSource = currentStock;
        }
        private void deleteBtn_Click(object sender, EventArgs e)
        {
            if (categoryDataGrid.RowCount != 0)
            {
                int selectedIndex = categoryDataGrid.CurrentCell.RowIndex;
                if (selectedIndex > -1)
                {
                    string catId   = categoryDataGrid.Rows[selectedIndex].Cells[0].Value.ToString();
                    string catName = categoryDataGrid.Rows[selectedIndex].Cells[1].Value.ToString();
                    string catDesc = categoryDataGrid.Rows[selectedIndex].Cells[2].Value.ToString();

                    itemCategory selectedCategory = new itemCategory(int.Parse(catId), catName, catDesc);

                    stockDataManipulations stockDataManipulations = new stockDataManipulations();
                    Boolean categoryDeletion = stockDataManipulations.deleteCategory(selectedCategory);

                    if (categoryDeletion)
                    {
                        MessageBox.Show("Deletion Successfull. Data deleted successfully", "Important Note",
                                        MessageBoxButtons.OK);
                    }
                    else
                    {
                        MessageBox.Show("Deletion Failed. Error occured while deleting data", "Important Note",
                                        MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                    }
                }
            }
        }
        private void bindDataTableData()
        {
            stockDataManipulations stockDataManipulations = new stockDataManipulations();
            List <itemCategory>    cateogeryList          = stockDataManipulations.getAllCategories();

            categoryDataGrid.DataSource = cateogeryList;
        }
        private void deleteBtn_Click(object sender, EventArgs e)
        {
            int selectedIndex = productsDataGrid.CurrentCell.RowIndex;

            if (selectedIndex > -1)
            {
                string       productId          = productsDataGrid.Rows[selectedIndex].Cells[0].Value.ToString();
                string       productCode        = productsDataGrid.Rows[selectedIndex].Cells[1].Value.ToString();
                string       productName        = productsDataGrid.Rows[selectedIndex].Cells[2].Value.ToString();
                string       productMake        = productsDataGrid.Rows[selectedIndex].Cells[3].Value.ToString();
                string       productModel       = productsDataGrid.Rows[selectedIndex].Cells[4].Value.ToString();
                string       productDescription = productsDataGrid.Rows[selectedIndex].Cells[5].Value.ToString();
                string       productPrice       = productsDataGrid.Rows[selectedIndex].Cells[7].Value.ToString();
                string       quantity           = productsDataGrid.Rows[selectedIndex].Cells[8].Value.ToString();
                itemCategory itemCat            = (itemCategory)productsDataGrid.Rows[selectedIndex].Cells[9].Value;


                products selectedProduct = new products(int.Parse(productId), productCode, productName, productMake, productModel,
                                                        productDescription, decimal.Parse(productPrice), itemCat, int.Parse(quantity));

                stockDataManipulations stockDataManipulations = new stockDataManipulations();
                Boolean stockDeletion = stockDataManipulations.deleteProduct(selectedProduct);

                if (stockDeletion)
                {
                    MessageBox.Show("Deletion Successfull. Data deleted successfully", "Important Note",
                                    MessageBoxButtons.OK);
                }
                else
                {
                    MessageBox.Show("Deletion Failed. Error occured while deleting data", "Important Note",
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                }
            }
        }
        private void btnAddProduct_Click(object sender, EventArgs e)
        {
            try
            {
                String pSrchKey = ((txtProductCode.Text).Replace(" ", string.Empty)).Clone().ToString();
                String details  = ((txtDetails.Text).Replace(" ", string.Empty)).Clone().ToString();
                String quantity = ((txtQty.Text).Replace(" ", string.Empty)).Clone().ToString();
                String cost     = ((txtCost.Text).Replace(" ", string.Empty)).Clone().ToString();


                if (pSrchKey == "")
                {
                    pcodeVerify.Show();
                    hideLabelsTimer();
                }
                else if (cost == "")
                {
                    costVerify.Show();
                    hideLabelsTimer();
                }
                else
                {
                    String          pDetails   = (txtDetails.Text).Clone().ToString();
                    String          sQty       = (txtQty.Text).Clone().ToString();
                    String          sCost      = (txtCost.Text).Clone().ToString();
                    String          srchKyWord = (txtProductCode.Text).Clone().ToString();
                    DateTime        addDte     = dateTimePicker1.Value;
                    List <products> prdLst     = new stockDataManipulations().getProdByCode(srchKyWord);
                    if (!(prdLst.Count.Equals(0) || prdLst.ElementAt(0).ProductID.Equals(0)))
                    {
                        stock sdb1   = new stock(0, prdLst.ElementAt(0).ProductID, prdLst.ElementAt(0).ProductName, pDetails, addDte, Convert.ToInt32(sQty), Convert.ToDecimal(sCost));
                        int   result = new stockDataManipulations().addNewStocks(sdb1);
                        if (result.Equals(0))
                        {
                            MessageBox.Show("Insertion Failed.Check the insert data again", "Important Note",
                                            MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                        }
                        else
                        {
                            MessageBox.Show("Insertion Successfull. Data saved successfully", "Important Note",
                                            MessageBoxButtons.OK);
                            clearForm();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Entered product code or name is invalid", "Product not found",
                                        MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                    }
                }
            }
            catch (Exception err) {
                logger.Error("\n UIL Error in btnAddProduct_Click: " + err.ToString());
            }
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            DateTime startDate = datetPkrFrm.Value;
            DateTime endDate   = dateTPkrTo.Value;

            stockDataManipulations stockDataManipulations = new stockDataManipulations();
            List <bill>            salesReport            = stockDataManipulations.generateSalesReportWithin(startDate, endDate);

            salesReportGrid.DataSource = salesReport;
            totalPricelbl.Text         = calculateTotal(salesReport);
        }
        private void categoryDataBindings()
        {
            stockDataManipulations            stockDataManipulation = new stockDataManipulations();
            List <itemCategory>               categories            = stockDataManipulation.getAllCategories();
            Dictionary <itemCategory, string> productCategory       = new Dictionary <itemCategory, string>();

            productCategory.Add(product.ProductCateogery, product.ProductCateogery.Item_Category_Name);
            foreach (itemCategory category in categories)
            {
                productCategory.Add(category, category.Item_Category_Name);
            }
            combProCat.DataSource    = new BindingSource(productCategory, null);
            combProCat.DisplayMember = "Value";
            combProCat.ValueMember   = "Key";
        }
        public void updateDataTableData()
        {
            stockDataManipulations stockDataManipulations = new stockDataManipulations();
            List <products>        productList            = stockDataManipulations.getAllProducts();

            for (int i = 0; i < productList.Count; i++)
            {
                productsDataGrid.Rows[i].Cells[0].Value         = productList[i].ProductID;
                productsDataGrid.Rows[i].Cells[1].Value         = productList[i].ProductCode;
                productsDataGrid.Rows[i].Cells[2].Value         = productList[i].ProductName;
                productsDataGrid.Rows[i].Cells[3].Value         = productList[i].ProductMake;
                productsDataGrid.Rows[i].Cells[4].Value         = productList[i].ProductModel;
                productsDataGrid.Rows[i].Cells[5].Value         = productList[i].ProductDescription;
                productsDataGrid.Rows[i].Cells[6].Value         = productList[i].ProductCateogery.Item_Category_Name;
                productsDataGrid.Rows[i].Cells[7].Value         = productList[i].ProductPrice;
                productsDataGrid.Rows[i].Cells[8].Value         = productList[i].Quantity;
                productsDataGrid.Rows[i].Cells[9].Value         = productList[i].ProductCateogery;
                productsDataGrid.Columns["categoryObj"].Visible = false;
            }
        }
        private void deleteBillBtn_Click(object sender, EventArgs e)
        {
            try
            {
                int selectedIndex = salesReportGrid.CurrentCell.RowIndex;
                if (selectedIndex > -1)
                {
                    string billID       = salesReportGrid.Rows[selectedIndex].Cells[0].Value.ToString();
                    string customerName = salesReportGrid.Rows[selectedIndex].Cells[1].Value.ToString();
                    string customerTel  = salesReportGrid.Rows[selectedIndex].Cells[2].Value.ToString();
                    string vehicleNo    = salesReportGrid.Rows[selectedIndex].Cells[3].Value.ToString();
                    string date         = salesReportGrid.Rows[selectedIndex].Cells[4].Value.ToString();
                    string userName     = salesReportGrid.Rows[selectedIndex].Cells[5].Value.ToString();
                    string total        = salesReportGrid.Rows[selectedIndex].Cells[6].Value.ToString();

                    bill selectedBill = new bill(Int32.Parse(billID), customerName, customerTel, vehicleNo,
                                                 Convert.ToDateTime(date), userName, null, Convert.ToDecimal(total));

                    stockDataManipulations stockDataManipulations = new stockDataManipulations();
                    Boolean billDeletion = stockDataManipulations.deleteBill(selectedBill);

                    if (billDeletion)
                    {
                        MessageBox.Show("Deletion Successfull. Data deleted successfully", "Important Note",
                                        MessageBoxButtons.OK);
                    }
                    else
                    {
                        MessageBox.Show("Deletion Failed. Error occured while deleting data", "Important Note",
                                        MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                    }
                }
            }
            catch (Exception err)
            {
                Console.WriteLine("\n UI Error in deleteBillBtn_Click: " + err.ToString());
                logger.Error("\n UI Error in deleteBillBtn_Click: " + err.ToString());
            }
        }
        private void retrieveDropDownValues()
        {
            stockDataManipulations stockDataManipulations = new stockDataManipulations();
            List <String>          productValues          = stockDataManipulations.getAllProductCodeName(itmType);

            bindDropDownValues(productValues);
            //if (catType == 1)
            //{
            //    List<String> custCatCodes = stockDataManipulations.getAllCustomCatCodeName(itmType);
            //    bindDropDownValues(custCatCodes);
            //}
            //else if (catType == 2)
            //{
            //    List<String> productValues = stockDataManipulations.getAllProductCodeName(itmType);
            //    bindDropDownValues(productValues);
            //}
            //else if (catType == 3)
            //{
            //    List<String> serviceValues = stockDataManipulations.getAllServiceCodeName(itmType);
            //    bindDropDownValues(serviceValues);
            //}
        }
        private void billBtn_Click(object sender, EventArgs e)
        {
            try
            {
                String   customer_name = txtCustName.Text;
                DateTime bill_date     = DateTime.Now;
                decimal  bill_total    = 0m;
                foreach (billingItem bIX1 in billItemsGrid)
                {
                    bill_total = bill_total + bIX1.Total;
                }
                Boolean result = new stockDataManipulations().issueBill(billItemsGrid, txtCustName.Text, txtCustTel.Text, wrapperDataBuffer.WrapperObject.User1.Username, bill_date, bill_total, txtCarNo.Text);
                if (result.Equals(true))
                {
                    //From Here Bill Printing Starts
                    DialogResult result1 = MessageBox.Show("Do you want to print this bill?",
                                                           "Print Bill?",
                                                           MessageBoxButtons.YesNo);
                    if (result1 == DialogResult.Yes)
                    {
                        List <billingItem> printBillItmLst = new List <billingItem>();

                        for (int i = 0; i < billItemsGrid.Count; i++)
                        {
                            if (billingGrid.Rows[i].Cells[0].Value.Equals("YES"))
                            {
                                printBillItmLst.Add(billItemsGrid[i]);
                            }
                        }
                        billItemsGrid.Clear();
                        billItemsGrid = printBillItmLst;
                        PrintDialog printDialog = new PrintDialog();

                        PrintDocument printDocument = new PrintDocument();

                        printDialog.Document = printDocument;

                        printDocument.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(CreateReceipt); //add an event handler that will do the printing


                        DialogResult result2 = printDialog.ShowDialog();

                        if (result2 == DialogResult.OK)
                        {
                            printDocument.Print();
                        }
                    }
                    billItemsGrid.Clear();
                    searchedProds.Clear();
                    billingGrid.Rows.Clear();
                    searchItmValueTxt.Text = "";
                    txtCustName.Text       = "";
                    txtCustTel.Text        = "";
                    txtCarNo.Text          = "";
                    billingGrid.DataSource = null;
                    lblBillTotal.Text      = "0";
                    lstBxSearchItms.Items.Clear();
                }
                else if (result.Equals(false))
                {
                    MessageBox.Show("Bill Generation failed.\n Data werent added properly", "Bill Generation failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    billItemsGrid.Clear();
                    searchedProds.Clear();
                    billingGrid.Rows.Clear();
                    searchItmValueTxt.Text = "";
                    txtCustName.Text       = "";
                    txtCustTel.Text        = "";
                    txtCarNo.Text          = "";
                    billingGrid.DataSource = null;
                    lblBillTotal.Text      = "0";
                    lstBxSearchItms.Items.Clear();
                }
            }
            catch (Exception err)
            {
                Console.WriteLine("UIL Error in MainMenuAdmin.billBtn_Click: " + err.ToString());
                logger.Error("UI Error in MainMenuAdmin.billBtn_Click: " + err.ToString());
                billItemsGrid.Clear();
                searchedProds.Clear();
                billingGrid.Rows.Clear();
                searchItmValueTxt.Text = "";
                txtCustName.Text       = "";
                txtCustTel.Text        = "";
                txtCarNo.Text          = "";
                billingGrid.DataSource = null;
                lblBillTotal.Text      = "0";
                lstBxSearchItms.Items.Clear();
            }
        }
        private void add2BillBtn_Click(object sender, EventArgs e)
        {
            try
            {
                if (!(searchItmValueTxt.Text.Equals("") || searchItmValueTxt.Text.Equals(null) || (searchItmValueTxt.Text.Length > 0 && searchItmValueTxt.Text.Trim().Length == 0)))
                {
                    lstBxSearchItms.Items.Clear();
                    String itmType              = this.searchByCmb.GetItemText(this.searchByCmb.SelectedItem);
                    String srchValue            = searchItmValueTxt.Text;
                    int    quantity             = Convert.ToInt32(qtyTxt.Value.ToString());
                    stockDataManipulations sdm1 = new stockDataManipulations();
                    Console.WriteLine("Search val is: " + srchValue);
                    List <products> prds1 = sdm1.searchNAddProds(srchValue, itmType);
                    Console.WriteLine(prds1.Count);
                    if (prds1.Count > 1)
                    {
                        searchedProds = prds1;
                        lstBxSearchItms.Items.Clear();
                        foreach (products tmpSPrd in searchedProds)
                        {
                            lstBxSearchItms.Items.Add(tmpSPrd.ProductCode + ": " + tmpSPrd.ProductName + ": " + tmpSPrd.ProductPrice);
                        }
                    }
                    else if (prds1.Count.Equals(1) && (!prds1.ElementAt(0).ProductID.Equals(0)))
                    {
                        //Console.WriteLine("inside cheking availbility");
                        lstBxSearchItms.Items.Clear();
                        if (prds1[0].Quantity >= quantity && (!quantity.Equals(0)))
                        {
                            if (!isProdAvailable(prds1[0]))
                            {
                                //Console.WriteLine("inside cheking availbility");
                                decimal total = prds1[0].ProductPrice * quantity;
                                billItemsGrid.Add(new billingItem(0, null, prds1[0], quantity, total, "Product"));
                                generateGrid();
                            }
                            else
                            {
                                MessageBox.Show("Product already added to the bill.");
                            }
                        }
                        else
                        {
                            MessageBox.Show("Product quantity is lower than the added quantity. \n Please enter a less amount or add more products", "Out of Stock", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        MessageBox.Show("No product was found for the given search keyword", "Invalid Search Data");
                    }
                }
                else
                {
                    MessageBox.Show("You didnt enter any search data. \n Please enter a proper search value", "Empty Search Data", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception err)
            {
                logger.Error("UI Error in add2BillBtn_Click: " + err.ToString());
                Console.WriteLine("UI Error in add2BillBtn_Click: " + err.ToString());
            }

            //try
            //{
            //    lstBxSearchItms.Items.Clear();
            //    String catType = this.cmbBillCat.GetItemText(this.cmbBillCat.SelectedItem);
            //    //Console.WriteLine("cat type is"+catType);
            //    String itmType = this.searchByCmb.GetItemText(this.searchByCmb.SelectedItem);
            //    String srchValue = searchItmValueTxt.Text;
            //    int quantity = Convert.ToInt32(qtyTxt.Value.ToString());
            //    stockDataManipulations stockDataManipulations = new stockDataManipulations();

            //    searchedBillItems = stockDataManipulations.fillBillObject(catType, itmType, srchValue, quantity);
            //    if (searchedBillItems.Count > 1)
            //    {

            //        lstBxSearchItms.Items.Clear();
            //        foreach (issueBill tmpBill in searchedBillItems)
            //        {
            //            lstBxSearchItms.Items.Add(tmpBill.id + ": " + tmpBill.Item_Code + ": " + tmpBill.Item_Name);
            //        }

            //    }
            //    else if (searchedBillItems.Count.Equals(1) && (!searchedBillItems.ElementAt(0).id.Equals(0)))
            //    {
            //        lstBxSearchItms.Items.Clear();
            //        issueBill tmpBill = searchedBillItems.ElementAt(0);
            //        gridViewData.Add(tmpBill);
            //        billingGrid.DataSource = gridViewData;
            //    }
            //}
            //catch (Exception err) { logger.Error("UI Error in add2BillBtn_Click: " + err.ToString()); }
        }
        private void btnUpdateProduct_Click(object sender, EventArgs e)
        {
            String       pCode     = ((txtProductCode.Text).Replace(" ", string.Empty)).Clone().ToString();
            String       pName     = ((txtProductName.Text).Replace(" ", string.Empty)).Clone().ToString();
            String       pPrice    = ((txtProductPrc.Text).Replace(" ", string.Empty)).Clone().ToString();
            String       quantity  = ((txtPrdQty.Text).Replace(" ", string.Empty)).Clone().ToString();
            itemCategory pCategory = ((KeyValuePair <itemCategory, string>)combProCat.SelectedItem).Key;

            if (pCode == "")
            {
                pcodeVerify.Show();
                hideLabelsTimer();
            }
            else if (pName == "")
            {
                pnameVerify.Show();
                hideLabelsTimer();
            }
            else if (pPrice == "")
            {
                ppriceVerify.Show();
                hideLabelsTimer();
            }
            else if (quantity == "")
            {
                ppriceVerify.Show();
                hideLabelsTimer();
            }
            else if (pCategory.Item_Category_Name == "Default")
            {
                cmbCatVerify.Show();
                hideLabelsTimer();
            }
            else
            {
                string       productCode        = txtProductCode.Text;
                string       productName        = txtProductName.Text;
                string       productMake        = txtProductMake.Text;
                string       productModel       = txtProductModel.Text;
                string       productDescription = txtProductDesc.Text;
                string       productPrice       = txtProductPrc.Text;
                int          qty     = (int)txtPrdQty.Value;
                itemCategory itemCat = ((KeyValuePair <itemCategory, string>)combProCat.SelectedItem).Key;


                products product1 = new products(product.ProductID, productCode, productName, productMake, productModel,
                                                 productDescription, decimal.Parse(productPrice), itemCat, qty);

                stockDataManipulations stockDataManipulations = new stockDataManipulations();
                Boolean stockDeletion = stockDataManipulations.updateProduct(product1);

                if (stockDeletion)
                {
                    MessageBox.Show("Update Successfull. Data updated successfully", "Important Note",
                                    MessageBoxButtons.OK);
                    currentView.updateDataTableData();
                    this.Dispose();
                }
                else
                {
                    MessageBox.Show("Update Failed. Error occured while Updating data", "Important Note",
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                }
            }
        }
        private void btnAddProduct_Click(object sender, EventArgs e)
        {
            String       pCode     = ((txtProductCode.Text).Replace(" ", string.Empty)).Clone().ToString();
            String       pName     = ((txtProductName.Text).Replace(" ", string.Empty)).Clone().ToString();
            String       pPrice    = ((txtProductPrc.Text).Replace(" ", string.Empty)).Clone().ToString();
            String       quantity  = ((txtPrdQty.Text).Replace(" ", string.Empty)).Clone().ToString();
            itemCategory pCategory = ((KeyValuePair <itemCategory, string>)combProCat.SelectedItem).Key;

            if (pCode == "")
            {
                pcodeVerify.Show();
                hideLabelsTimer();
            }
            else if (pName == "")
            {
                pnameVerify.Show();
                hideLabelsTimer();
            }
            else if (pPrice == "")
            {
                ppriceVerify.Show();
                hideLabelsTimer();
            }
            else if (quantity == "")
            {
                ppriceVerify.Show();
                hideLabelsTimer();
            }
            else if (pCategory.Item_Category_Name == "Default")
            {
                cmbCatVerify.Show();
                hideLabelsTimer();
            }
            else
            {
                String       proCode          = (txtProductCode.Text).Clone().ToString();
                String       proName          = (txtProductName.Text).Clone().ToString();
                String       proMake          = (txtProductMake.Text).Clone().ToString();
                String       proModel         = (txtProductModel.Text).Clone().ToString();
                String       proDescription   = (txtProductDesc.Text).Clone().ToString();
                String       proPrice         = (txtProductPrc.Text).Clone().ToString();
                String       proQuantity      = (txtPrdQty.Text).Clone().ToString();
                decimal      convProdPrice    = decimal.Parse(proPrice);
                int          convProdQuantity = int.Parse(proQuantity);
                itemCategory psCategory       = ((KeyValuePair <itemCategory, string>)combProCat.SelectedItem).Key;
                Console.WriteLine("pcat ID: " + psCategory.Item_Category_ID);
                products newProduct = new products(-1, proCode, proName, proMake, proModel, proDescription,
                                                   convProdPrice, psCategory, convProdQuantity);

                stockDataManipulations stockDataManipulations = new stockDataManipulations();
                Boolean productInsertionFlag = stockDataManipulations.addNewProduct(newProduct);
                if (productInsertionFlag)
                {
                    MessageBox.Show("Insertion Successfull. Data saved successfully", "Important Note",
                                    MessageBoxButtons.OK);
                    clearForm();
                }
                else
                {
                    MessageBox.Show("Insertion Failed.Check the insert data again", "Important Note",
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                }
            }
        }