Example #1
0
        private void SaveData(string ServTaxId)
        {
            BLL.DBInteraction dbinteract = new BLL.DBInteraction();
            DateTime          maxDate    = Convert.ToDateTime(GeneralFunctions.DecryptQueryString(Request.QueryString["dt"]));


            if (ServTaxId == "-1")
            {
                txtStDate.Text = DatePicker1.dt.ToShortDateString();
                if (DatePicker1.dt.CompareTo(maxDate) < 0)
                {
                    GeneralFunctions.RegisterAlertScript(this, "Start Date must be greater than: " + maxDate.ToShortDateString());
                    return;
                }
            }
            else
            {
                if (dbinteract.InvoiceDateCheck(Convert.ToDateTime(txtStDate.Text)) > 0)
                {
                    GeneralFunctions.RegisterAlertScript(this, "This Date has been already used for Invoice. It can not be edited");
                    return;
                }
            }



            bool isedit = ServTaxId != "-1" ? true : false;

            int result = dbinteract.AddEditSTax(_userId, Convert.ToInt32(ServTaxId), Convert.ToDateTime(txtStDate.Text), ExtentionClass.TryParseBlankAsZero(txtAddiCess.Text), ExtentionClass.TryParseBlankAsZero(txtCess.Text), ExtentionClass.TryParseBlankAsZero(txtTax.Text), ddlStatus.SelectedIndex == 0 ? true : false, isedit);


            if (result > 0)
            {
                Response.Redirect("~/MasterModule/ManageServTax.aspx");
            }
            else
            {
                GeneralFunctions.RegisterAlertScript(this, "Error Occured");
            }
        }