Beispiel #1
0
        void AddUpdateData()
        {
            try
            {
                ep1.Clear();

                if (string.IsNullOrEmpty(txtName.Text.Trim()))
                {
                    ep1.SetError(txtName, "Name is Required..");
                    txtName.Focus();
                    return;
                }


                decimal TM01_TAX_RATE = 0;
                decimal.TryParse(txtTaxRate.Text.Trim(), out TM01_TAX_RATE);

                MyDa = new MyDabaseDataContext(Properties.Settings.Default.Style_King_Dev);
                int?Iout = 0;
                MyDa.USP_VP_ADDUPDATE_PRODUCT(Datalayer.iTM01_PRODUCTID, txtNo.Text.Trim(), txtName.Text.Trim(), chkIsSet.Checked, txtHSNCode.Text.Trim(), TM01_TAX_RATE, Datalayer.iT001_COMPANYID, ref Iout);
                if (Iout > 0)
                {
                    if (Datalayer.iTM01_PRODUCTID == 0)
                    {
                        Datalayer.InsertMessageBox(sPageName);
                    }
                    else
                    {
                        Datalayer.UpdateMessageBox(sPageName);
                    }
                }
                else
                {
                    if (Datalayer.iTM01_PRODUCTID == 0)
                    {
                        Datalayer.DosenotInsertMessageBox(sPageName);
                    }
                    else
                    {
                        Datalayer.DosenotUpdateMessageBox(sPageName);
                    }
                }

                ResetData();
            }
            catch (Exception ex)
            {
                Datalayer.WorningMessageBox(ex.Message.ToString(), "Error");
            }
        }