private void SaveRecord() { long lngProductGroupID = long.Parse(cboProductGroup.SelectedItem.Value); long lngProductSubGroupID = long.Parse(cboProductSubGroup.SelectedItem.Value); long lngProductID = long.Parse(cboProductCode.SelectedItem.Value); decimal decVAT = 0; decimal decEVAT = 0; decimal decLocalTax = 0; string javaScript; try { decVAT = decimal.Parse(txtVAT.Text); } catch { javaScript = "window.alert('Please enter a valid VAT.')"; System.Web.UI.ScriptManager.RegisterClientScriptBlock(this.updSave, this.updSave.GetType(), "openwindow", javaScript, true); return; } try { decEVAT = decimal.Parse(txtEVAT.Text); } catch { javaScript = "window.alert('Please enter a valid EVAT.')"; System.Web.UI.ScriptManager.RegisterClientScriptBlock(this.updSave, this.updSave.GetType(), "openwindow", javaScript, true); return; } try { decLocalTax = decimal.Parse(txtLocalTax.Text); } catch { javaScript = "window.alert('Please enter a valid LocalTax.')"; System.Web.UI.ScriptManager.RegisterClientScriptBlock(this.updSave, this.updSave.GetType(), "openwindow", javaScript, true); return; } Products clsProduct = new Products(); clsProduct.ChangeTax(lngProductGroupID, lngProductSubGroupID, lngProductID, decVAT, decEVAT, decLocalTax, Convert.ToString(Session["Name"])); clsProduct.CommitAndDispose(); txtVAT.Text = decVAT.ToString("#,##0.#0"); txtEVAT.Text = decEVAT.ToString("#,##0.#0"); txtLocalTax.Text = decLocalTax.ToString("#,##0.#0"); javaScript = "window.alert('Taxes has been updated.')"; System.Web.UI.ScriptManager.RegisterClientScriptBlock(this.updSave, this.updSave.GetType(), "openwindow", javaScript, true); }