private void btnAddService_Click(object sender, EventArgs e)
        {
            String sCode = ((txtServiceCode.Text).Replace(" ", string.Empty)).Clone().ToString();
            String sName = ((txtServiceName.Text).Replace(" ", string.Empty)).Clone().ToString();
            String sPrice = ((txtServicePrice.Text).Replace(" ", string.Empty)).Clone().ToString();

            if (sCode == "")
            {
                servcodeVerifyMessage.Show();
                hideLabelsTimer();
            }
            else if (sName == "")
            {
                servnameVerifyMessage.Show();
                hideLabelsTimer();
            }
            else if (sPrice == "")
            {
                servPrcVerify.Show();
                hideLabelsTimer();
            }
            else
            {
                String psName = (txtServiceName.Text).Clone().ToString();
                String psCode = (txtServiceCode.Text).Clone().ToString();
                String psDesc = (txtServiceDsc.Text).Clone().ToString();
                decimal psPrice = decimal.Parse((txtServicePrice.Text).Clone().ToString());
                serviceProducts newService = new serviceProducts(-1, psCode, psName, psDesc, psPrice);
                stockDataManipulations stockDataManipulations = new stockDataManipulations();
                Boolean newServiceInsertionFlag = stockDataManipulations.addNewServiceProduct(newService);
                if (newServiceInsertionFlag)
                {
                    servInsertionSuccessMsg.Show();
                    hideLabelsTimer();
                }
                else
                {
                    serviceInsertFailureMsg.Show();
                    hideLabelsTimer();
                }
            }
        }
예제 #2
0
        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();
            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 (pCategory.ItemCategoryName == "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();
                decimal convProdPrice = decimal.Parse(proPrice);
                itemCategory psCategory = ((KeyValuePair<itemCategory, string>)combProCat.SelectedItem).Key;
                products newProduct = new products(-1, proCode, proName, proMake, proModel, proDescription,
                    convProdPrice, psCategory);
                stockDataManipulations stockDataManipulations = new stockDataManipulations();
                Boolean productInsertionFlag = stockDataManipulations.addNewProduct(newProduct);
                if (productInsertionFlag)
                {
                    productInsertionSuccessMsg.Show();
                    hideLabelsTimer();
                }
                else
                {
                    productInsertFailureMsg.Show();
                    hideLabelsTimer();
                }
            }
        }
예제 #3
0
 private void txtType_SelectedIndexChanged(object sender, EventArgs e)
 {
     txtItem.Enabled = true;
     int itemType = ((KeyValuePair<int, string>)txtType.SelectedItem).Key;
     stockDataManipulations stockDataManipulations = new stockDataManipulations();
     if (itemType == 1)
     {
         List<products> products = stockDataManipulations.getAllProducts();
         itemDataBindings(products);
     }
     else if (itemType == 2)
     {
         List<serviceProducts> services = stockDataManipulations.getAllServices();
         itemDataBindings(services);
     }
 }
예제 #4
0
 private void categoryDataBindings()
 {
     stockDataManipulations stockDataManipulation = new stockDataManipulations();
     List<itemCategory> categories = stockDataManipulation.getAllCategories();
     Dictionary<itemCategory, string> productCategory = new Dictionary<itemCategory, string>();
     itemCategory defCategory = new itemCategory(-1, "Default", null);
     productCategory.Add(defCategory, defCategory.ItemCategoryName);
     foreach (itemCategory category in categories)
     {
         productCategory.Add(category, category.ItemCategoryName);
     }
     combProCat.DataSource = new BindingSource(productCategory, null);
     combProCat.DisplayMember = "Value";
     combProCat.ValueMember = "Key";
 }
예제 #5
0
        private void btnAddService_Click(object sender, EventArgs e)
        {
            String custServName = ((txtServiceName.Text).Replace(" ", string.Empty)).Clone().ToString();
            if (custServName == "")
            {
                snameVerify.Show();
                hideLabelsTimer();
            }
            else if (!(addCustomServiceGrid.RowCount > 0))
            {
                verifyServiceItems.Show();
                hideLabelsTimer();
            }
            else
            {
                List<customServiceEntities> serviceItems = new List<customServiceEntities>();
                foreach (DataGridViewRow row in addCustomServiceGrid.Rows)
                {
                    string type = row.Cells[0].Value.ToString();
                    string name = row.Cells[1].Value.ToString();
                    string description = row.Cells[2].Value.ToString();
                    string price = row.Cells[3].Value.ToString();
                    string productId = row.Cells[4].Value.ToString();
                    string serviceId = row.Cells[5].Value.ToString();

                    customServiceEntities customServiceEntities = new customServiceEntities(type, name, description,
                        decimal.Parse(price), int.Parse(productId), int.Parse(serviceId));
                    serviceItems.Add(customServiceEntities);
                }

                String custServiceName = txtServiceName.Text;
                String addedValue = valueAddedText.Text;
                calculateTotal();
                decimal valueAdded = 0;
                if (valueAddedText.Text != "" && valueAddedText.Text != null)
                {
                    valueAdded = decimal.Parse(addedValue);
                }
                customService customService = new customService(0, custServiceName, serviceItems,
                    valueAdded, total);
                stockDataManipulations stockDataManipulations = new stockDataManipulations();
                Boolean verifyResult = stockDataManipulations.saveCustomPackage(customService);
                if (verifyResult)
                {
                    custServInsertionSuccessMsg.Show();
                    hideLabelsTimer();
                }
                else
                {
                    custServInsertFailureMsg.Show();
                    hideLabelsTimer();
                }
            }
        }