private void getDetails(string ID)
    {
        try
        {
            _obj_smhr_TaxExempt             = new SMHR_TAX_EXEMPT();
            _obj_smhr_TaxExempt.Mode        = 5;
            _obj_smhr_TaxExempt.SMHR_TAX_ID = Convert.ToInt32(ID);
            DataTable dt = BLL.get_Tax_Master(_obj_smhr_TaxExempt);
            if (dt.Rows.Count != 0)
            {
                ddl_Country.SelectedIndex = ddl_Country.FindItemIndexByValue(Convert.ToString(dt.Rows[0]["SMHR_TAX_COUNTRY_ID"]));
                rtxt_TaxName.Text         = Convert.ToString(dt.Rows[0]["SMHR_TAX_NAME"]);
                rtxt_TaxDesc.Text         = Convert.ToString(dt.Rows[0]["SMHR_TAX_DESC"]);
                rntxt_MaxLimit.Value      = Convert.ToDouble(Convert.ToString(dt.Rows[0]["SMHR_TAX_MAXLIMIT"]));
                if (Convert.ToBoolean(dt.Rows[0]["SMHR_TAX_ACTIVE"]) == true)
                {
                    ddl_Active.SelectedValue = "1";
                }
                else
                {
                    ddl_Active.SelectedValue = "0";
                }

                //chk_Active.Checked = Convert.ToBoolean(dt.Rows[0]["SMHR_TAX_ACTIVE"]);
            }
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_TaxExempt", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }
    protected void btn_Add_Click(object sender, EventArgs e)
    {
        try
        {
            _obj_smhr_TaxExempt = new SMHR_TAX_EXEMPT();

            //if (chk_Active.Checked)
            //    _obj_smhr_TaxExempt.SMHR_TAX_ACTIVE = true;
            //else
            //    _obj_smhr_TaxExempt.SMHR_TAX_ACTIVE = false;

            _obj_smhr_TaxExempt.Mode = 7;
            _obj_smhr_TaxExempt.SMHR_TAX_COUNTRY_ID = Convert.ToInt32(ddl_Country.SelectedValue);
            _obj_smhr_TaxExempt.SMHR_TAX_NAME       = Convert.ToString(rtxt_TaxName.Text.Replace("'", "''"));
            DataTable dt = BLL.get_Tax_Master(_obj_smhr_TaxExempt);
            if (Convert.ToString(dt.Rows[0]["COUNT"]) == "0")
            {
                _obj_smhr_TaxExempt.Mode              = 2;
                _obj_smhr_TaxExempt.SMHR_TAX_DESC     = Convert.ToString(rtxt_TaxDesc.Text.Replace("'", "''"));
                _obj_smhr_TaxExempt.SMHR_TAX_MAXLIMIT = Convert.ToDouble(rntxt_MaxLimit.Value);
                if (ddl_Active.SelectedValue == "1")
                {
                    _obj_smhr_TaxExempt.SMHR_TAX_ACTIVE = true;
                }
                else
                {
                    _obj_smhr_TaxExempt.SMHR_TAX_ACTIVE = false;
                }
                _obj_smhr_TaxExempt.SMHR_TAX_CREATEDBY   = Convert.ToInt32(Session["USER_ID"]);
                _obj_smhr_TaxExempt.SMHR_TAX_CREATEDDATE = DateTime.Now;
                bool status = BLL.set_TaxExempt(_obj_smhr_TaxExempt);
                if (status == true)
                {
                    BLL.ShowMessage(this, "Element Added Successfully");
                    RMP_Tax_Exempt.SelectedIndex = 0;
                    LoadDetails();
                    RG_Tax_Exempt.DataBind();
                    return;
                }
                else
                {
                    BLL.ShowMessage(this, "An Error Occured while doing the process");
                    return;
                }
            }
            else
            {
                BLL.ShowMessage(this, "Tax Element Already Exists");
            }
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_TaxExempt", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }
 private void LoadDetails()
 {
     try
     {
         _obj_smhr_TaxExempt                 = new SMHR_TAX_EXEMPT();
         _obj_smhr_TaxExempt.Mode            = 4;
         _obj_smhr_TaxExempt.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);
         DataTable dt = BLL.get_Tax_Master(_obj_smhr_TaxExempt);
         RG_Tax_Exempt.DataSource = dt;
     }
     catch (Exception ex)
     {
         SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_TaxExempt", ex.StackTrace, DateTime.Now);
         Response.Redirect("~/Frm_ErrorPage.aspx");
     }
 }