private void BtnDone_Click(object sender, EventArgs e) { double suggestedPrice = 0; double sellPrice = 0; string sql = "Select ProductCategoryDescription from tblProductCategory Order by ProductCategoryDescription asc"; TxtSKU.Text = DatabaseAssist.GetLastSKU().ToString(); TxtCost.Text = "£" + GetTotals(flowLayoutCost).ToString(); sellPrice = GetTotals(flowLayoutSellPrice); suggestedPrice = Math.Ceiling(GetTotals(flowLayoutSellPrice) - ((GetTotals(flowLayoutSellPrice) / 100) * 10)); lblSellPrice.Text = "Selling Seperately would be £" + sellPrice; lblSuggested.Text = "Suggested price £" + suggestedPrice.ToString(); gbxProductDetails.Enabled = true; gbxMaterials.Enabled = false; lblSuggested.Visible = true; lblSellPrice.Visible = true; btnAddAnother.Visible = false; btnDelete.Visible = false; BtnDone.Visible = false; BtnEdit.Visible = true; FillCombo(CmbCategory, sql, "ProductCategoryDescription", 2); }
private void BtnDone_Click(object sender, EventArgs e) { if (ValidateMaterials() != 0) { MessageBox.Show("Please Correct Fields In Red", "Invalid Entry"); } else { totalprice = 0; BtnDone.Visible = false; gbxProductDetails.Enabled = true; gbxMaterials.Enabled = false; BtnEdit.Visible = true; pnlAddDelete.Visible = false; CalculateCost(); TxtSKU.Text = DatabaseAssist.GetLastSKU().ToString(); GetSuggestedPrice(); FillProductCategory(); TxtDescription.Focus(); } }
private int ValidateEntries() { int errors = 0; string checkSKU = "select SKU from tblProductData WHERE SKU =@param"; if (DatabaseAssist.CheckIfItemExists(checkSKU, TxtSKU.Text) == true) { picErrorSKU.Visible = true; new ToolTip().SetToolTip(picErrorSKU, "SKU Already Exists, Please Try Another - The next aviable is : " + DatabaseAssist.GetLastSKU().ToString()); errors++; } else { picErrorSKU.Visible = false; } if (Helper.CheckTextBoxForString(TxtDescription.Text) == "empty") { picErrorDescription.Visible = true; new ToolTip().SetToolTip(picErrorDescription, "Field Cannot Be Empty"); errors++; } else { picErrorDescription.Visible = false; } if (Helper.CheckTextBoxForString(TxtCost.Text) != "number") { picErrorCost.Visible = true; new ToolTip().SetToolTip(picErrorCost, "Please enter a number"); errors++; } else { picErrorCost.Visible = false; } if (Helper.CheckTextBoxForString(TxtPrice.Text) != "number") { picErrorPrice.Visible = true; new ToolTip().SetToolTip(picErrorPrice, "Please enter a number"); errors++; } else { picErrorPrice.Visible = false; } if (Helper.CheckTextBoxForString(TxtPicPath.Text) == "empty") { lblAddImage.Visible = true; errors++; } else { lblAddImage.Visible = false; } return(errors); }