protected void lnkbtnSave_OnClick(object sender, EventArgs e)
        {
            Int32  empIdno = Convert.ToInt32((Session["UserIdno"] == null) ? "0" : Session["UserIdno"].ToString());
            string smsg    = string.Empty;

            if ((Convert.ToDouble(Convert.ToDouble(taxRate.Text.Trim())) <= 0) || (Convert.ToDouble(Convert.ToDouble(taxRate.Text.Trim())) >= 100))
            {
                if (Convert.ToDouble(taxRate.Text.Trim()) <= 0)
                {
                    ShowMessageErr("Please Enter Tax Rate!");
                }
                else
                {
                    ShowMessageErr("Tax rate cannot be greater than or equal to 100");
                }

                taxRate.Focus();
                return;
            }

            LowRateMastDAL objTaxMastBLL = new LowRateMastDAL();
            Int64          RateId        = 0;
            int            compID        = 0;
            string         PanNo         = Convert.ToString(drpPanNo.SelectedItem.Text.Trim());
            double         rate          = Convert.ToDouble(Convert.ToString(taxRate.Text));
            Int32          PrtyIdno      = Convert.ToInt32(drpPrtyName.SelectedValue);
            DateTime       dt            = Convert.ToDateTime(ApplicationFunction.mmddyyyyDash(txtDate.Text.Trim()));

            if (string.IsNullOrEmpty(hidTaxid.Value) == true)
            {
                RateId = objTaxMastBLL.Insert(PrtyIdno, PanNo, rate, compID, Convert.ToDateTime(ApplicationFunction.mmddyyyyDash(txtDate.Text.Trim())), empIdno);
            }
            else
            {
                RateId = objTaxMastBLL.Update(Convert.ToInt32(hidTaxid.Value), PrtyIdno, PanNo, rate, compID, Convert.ToDateTime(ApplicationFunction.mmddyyyyDash(txtDate.Text.Trim())), empIdno);
            }
            if (RateId == 0)
            {
                ShowMessageErr("Record  Not Saved ");
            }
            else if (RateId < 0)
            {
                ShowMessageErr("Record already exists.");
            }
            else if (RateId > 0)
            {
                if (hidTaxid.Value == "")
                {
                    ShowMessage("Record Saved Successfully");
                }
                else
                {
                    ShowMessage("Record Updated Successfully.");
                }
                this.ClearControls();
                this.BindGrid();
            }
        }
Exemple #2
0
        protected void lnkbtnSave_OnClick(object sender, EventArgs e)
        {
            Int32  empIdno = Convert.ToInt32((Session["UserIdno"] == null) ? "0" : Session["UserIdno"].ToString());
            string smsg    = string.Empty;

            if ((Convert.ToDouble(Convert.ToDouble(taxRate.Text.Trim())) <= 0) || (Convert.ToDouble(Convert.ToDouble(taxRate.Text.Trim())) >= 100))
            {
                if (Convert.ToDouble(taxRate.Text.Trim()) <= 0)
                {
                    ShowMessageErr("Please Enter Tax Rate!");
                }
                else
                {
                    ShowMessageErr("Tax rate cannot be greater than or equal to 100");
                }

                taxRate.Focus();
                return;
            }
            if (Convert.ToString(drpdownTaxType.SelectedValue) == "2")
            {
                if (txtLorryFrom.Text == "")
                {
                    txtLorryFrom.Text = "0";
                }
                if (txtlorryto.Text == "")
                {
                    txtlorryto.Text = "0";
                }
                if (Convert.ToInt32(txtLorryFrom.Text.Trim()) <= 0)
                {
                    ShowMessageErr("Please Enter Lorry From!");
                    txtLorryFrom.Focus();
                    return;
                }
                if (Convert.ToInt32(txtlorryto.Text.Trim()) <= 0)
                {
                    ShowMessageErr("Please Enter Lorry To!");
                    txtlorryto.Focus();
                    return;
                }
                if (Convert.ToInt32(txtlorryto.Text.Trim()) <= Convert.ToInt32(txtLorryFrom.Text.Trim()))
                {
                    ShowMessageErr("Lorry From Should be smaller than Lorry To!");
                    txtLorryFrom.Focus();
                    return;
                }
            }

            TaxMastDAL objTaxMastBLL = new TaxMastDAL();
            Int64      TaxId         = 0;
            int        compID        = 0;//Convert.ToInt32(UsessionValue.CompId);
            // DateTime dateModified = DateTime.Now;
            int    taxtypeIdno = Convert.ToInt32(drpdownTaxType.SelectedValue);
            int    stateIdno   = Convert.ToInt32(drpState.SelectedValue);
            double rate        = Convert.ToDouble(Convert.ToString(taxRate.Text));
            int    PANtype     = Convert.ToInt32(Convert.ToString(ddlPANType.SelectedValue) == "" ? 0 : Convert.ToInt32(ddlPANType.SelectedValue));
            int    lorryfrom   = Convert.ToInt32(Convert.ToString(txtLorryFrom.Text));
            int    lorryto     = Convert.ToInt32(Convert.ToString(txtlorryto.Text));
            bool   CalonDf     = Convert.ToBoolean((chkCalOnDF.Checked) == true ? 1 : 0);

            //bool LowRate = Convert.ToBoolean((chkLowRate.Checked) == true ? 1 : 0);
            if (drpdownTaxType.SelectedItem.Text.Trim() == "UGST" || drpdownTaxType.SelectedItem.Text.Trim() == "IGST" || drpdownTaxType.SelectedItem.Text.Trim() == "CGST" || drpdownTaxType.SelectedItem.Text.Trim() == "SGST")
            {
                PANtype = 0; lorryfrom = 0; lorryto = 0; CalonDf = false; stateIdno = 0;
            }
            if (string.IsNullOrEmpty(hidTaxid.Value) == true)
            {
                TaxId = objTaxMastBLL.Insert(taxtypeIdno, stateIdno, rate, compID, Convert.ToDateTime(ApplicationFunction.mmddyyyyDash(txtDate.Text.Trim())), PANtype, lorryfrom, lorryto, CalonDf, empIdno);
            }
            else
            {
                TaxId = objTaxMastBLL.Update(Convert.ToInt32(hidTaxid.Value), taxtypeIdno, stateIdno, rate, compID, Convert.ToDateTime(ApplicationFunction.mmddyyyyDash(txtDate.Text.Trim())), PANtype, lorryfrom, lorryto, CalonDf, empIdno);
            }
            if (TaxId == 0)
            {
                ShowMessageErr("Record  Not Saved ");
            }
            else if (TaxId < 0)
            {
                ShowMessageErr("Record already exists.");
            }
            else if (TaxId > 0)
            {
                if (hidTaxid.Value == "")
                {
                    ShowMessage("Record Saved Successfully");
                }
                else
                {
                    ShowMessage("Record Updated Successfully.");
                    drpState.Enabled = true;
                }
                this.ClearControls();
                this.BindGrid();
            }
        }