Exemplo n.º 1
0
 protected void rcmb_Period_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
 {
     try
     {
         if (rcmb_Period.SelectedIndex != 0)
         {
             _obj_smhr_EMP_TDS            = new SMHR_EMP_TDS();
             _obj_smhr_EMP_TDS.MODE       = 2;
             _obj_smhr_EMP_TDS.TDS_BUID   = Convert.ToInt32(rcb_BussinessUnit.SelectedValue);
             _obj_smhr_EMP_TDS.TDS_PERIOD = Convert.ToInt32(rcmb_Period.SelectedValue);
             DataTable dtDetails = BLL.get_EMP_TDS_DETAILS(_obj_smhr_EMP_TDS);
             RG_PayElements.DataSource = dtDetails;
             RG_PayElements.DataBind();
             RG_PayElements.Visible = true;
             CheckBox chk     = new CheckBox();
             TextBox  txt_Box = new TextBox();
             for (int i = 0; i < dtDetails.Rows.Count; i++)
             {
                 chk     = RG_PayElements.Items[i].FindControl("chk_Select") as CheckBox;
                 txt_Box = RG_PayElements.Items[i].FindControl("txt_Value") as TextBox;
                 if (txt_Box.Text != "")
                 {
                     if (Convert.ToString(dtDetails.Rows[i]["EMP_TDS_CHECKED"]) == "0")
                     {
                         chk.Checked = false;
                     }
                     else
                     {
                         chk.Checked = true;
                     }
                 }
                 else
                 {
                     chk.Checked = false;
                 }
             }
         }
         else
         {
             RG_PayElements.DataSource = null;
             RG_PayElements.DataBind();
             RG_PayElements.Visible = false;
         }
     }
     catch (Exception ex)
     {
         SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_emppastinfo", ex.StackTrace, DateTime.Now);
         Response.Redirect("~/Frm_ErrorPage.aspx");
         return;
     }
 }
 public void loadGrid()
 {
     try
     {
         _obj_smhr_EMP_TDS           = new SMHR_EMP_TDS();
         _obj_smhr_EMP_TDS.OPERATION = operation.Select;
         _obj_smhr_EMP_TDS.TDS_ORGID = Convert.ToInt32(Session["ORG_ID"]);
         DataTable dt_Grid = BLL.get_EMP_TDS(_obj_smhr_EMP_TDS);
         rg_Tds.DataSource = dt_Grid;
     }
     catch (Exception ex)
     {
         SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_Employee_Tds", ex.StackTrace, DateTime.Now);
         Response.Redirect("~/Frm_ErrorPage.aspx");
     }
 }
    protected void lnk_Edit_Command(object sender, CommandEventArgs e)
    {
        try
        {
            if (Convert.ToInt32(Session["WRITEFACILITY"]) == 2)
            {
                btn_Update.Visible = false;
            }

            else
            {
                btn_Update.Visible = true;
            }
            rmp_Main.SelectedIndex = 1;
            btn_Save.Visible       = false;
            btn_Update.Visible     = true;
            LoadBusinessUnit_Tds();

            rcmb_Tds_EmpId.Enabled       = false;
            rcmb_Tds_Buid.Enabled        = false;
            rcmb_Period.Enabled          = false;
            _obj_smhr_EMP_TDS            = new SMHR_EMP_TDS();
            _obj_smhr_EMP_TDS.OPERATION  = operation.Validate;
            _obj_smhr_EMP_TDS.EMP_TDS_ID = Convert.ToInt32(e.CommandArgument);
            Session["EMP_TDS_ID"]        = Convert.ToString(e.CommandArgument);
            DataTable dt = BLL.get_EMP_TDS(_obj_smhr_EMP_TDS);
            rcmb_Tds_Buid.SelectedIndex = rcmb_Tds_Buid.FindItemIndexByValue(Convert.ToString(dt.Rows[0]["BUSINESSUNIT_ID"]));

            LoadEmployee_Tds();

            rcmb_Tds_EmpId.SelectedIndex = rcmb_Tds_EmpId.Items.FindItemIndexByValue(Convert.ToString(dt.Rows[0]["EMP_ID"]));
            rntxt_Prev_Gross_Amount.Text = Convert.ToString(dt.Rows[0]["EMP_TDS_PREV_GROSS_AMOUNT"]);
            rntxt_prev_tds_amount.Text   = Convert.ToString(dt.Rows[0]["EMP_TDS_PREV_TDS_AMOUNT"]);
            rcmb_Period.SelectedIndex    = rcmb_Period.Items.FindItemIndexByValue(Convert.ToString(dt.Rows[0]["EMP_TDS_PERIOD_ID"]));
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_Employee_Tds", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }
Exemplo n.º 4
0
    //protected void rcmb_Payitem_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
    //{
    //    try
    //    {
    //        if (rcmb_Period.SelectedIndex != 0)
    //        {
    //            _obj_Emp_Payitems = new SMHR_PAYITEMS_EMP();
    //            _obj_Emp_Payitems.MODE = 2;
    //            _obj_Emp_Payitems.BUID = Convert.ToInt32(rcb_BussinessUnit.SelectedValue);
    //            _obj_Emp_Payitems.SMHR_EMP_PAYITEMS_ID = Convert.ToInt32(rcmb_Period.SelectedValue);
    //            DataTable dtDetails = BLL.get_EmpDetails(_obj_Emp_Payitems);
    //            RG_PayElements.DataSource = dtDetails;
    //            RG_PayElements.DataBind();

    //            CheckBox chk = new CheckBox();
    //            TextBox txt_Box = new TextBox();
    //            for (int i = 0; i < dtDetails.Rows.Count - 1; i++)
    //            {
    //                chk = RG_PayElements.Items[i].FindControl("chk_Select") as CheckBox;
    //                txt_Box = RG_PayElements.Items[i].FindControl("txt_Value") as TextBox;
    //                if (txt_Box.Text != "")
    //                {
    //                    if (Convert.ToString(dtDetails.Rows[i]["SMHR_EMP_PAYITEMS_CHECKED"]) == "0")
    //                        chk.Checked = false;
    //                    else
    //                        chk.Checked = true;
    //                }
    //                else
    //                {
    //                    chk.Checked = false;
    //                }
    //            }
    //        }
    //    }
    //    catch (Exception ex)
    //    {
    //        SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_EmpPay", ex.StackTrace, DateTime.Now);
    //    }
    //}
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        try
        {
            CheckBox chk_box1 = new CheckBox();
            TextBox  txt_Val1 = new TextBox();
            TextBox  txt_Val2 = new TextBox();
            int      j        = 0;
            for (int i = 0; i < RG_PayElements.Items.Count; i++)
            {
                chk_box1 = RG_PayElements.Items[i].FindControl("chk_Select") as CheckBox;
                txt_Val1 = RG_PayElements.Items[i].FindControl("txt_Value") as TextBox;
                txt_Val2 = RG_PayElements.Items[i].FindControl("txt_tds_Value") as TextBox;
                if (chk_box1.Checked && txt_Val1.Text != "" && txt_Val2.Text != "")
                {
                    j = j + 1;
                }
                if (((txt_Val1.Text != "") || (txt_Val2.Text != "")) && (chk_box1.Checked == false))
                {
                    checkedvalue = true;
                }
            }
            if (checkedvalue)
            {
                BLL.ShowMessage(this, "Please Select The Employee");
                return;
            }
            if (j != 0)
            {
                _obj_smhr_EMP_TDS            = new SMHR_EMP_TDS();
                _obj_smhr_EMP_TDS.MODE       = 4;
                _obj_smhr_EMP_TDS.TDS_PERIOD = Convert.ToInt32(rcmb_Period.SelectedValue);
                _obj_smhr_EMP_TDS.TDS_BUID   = Convert.ToInt32(rcb_BussinessUnit.SelectedItem.Value);
                bool status1 = BLL.set_EMP_TDS1(_obj_smhr_EMP_TDS);

                //_obj_Payitems = new SMHR_PAYITEMS();
                //_obj_Payitems.OPERATION = operation.Select;
                //_obj_Payitems.PAYITEM_ID = Convert.ToInt32(rcmb_Period.SelectedValue);
                //DataTable dt = BLL.get_PayItems(_obj_Payitems);

                Label    lbl_ID      = new Label();
                TextBox  txt_Val     = new TextBox();
                TextBox  txt_tds_val = new TextBox();
                CheckBox chk_box     = new CheckBox();
                for (int i = 0; i < RG_PayElements.Items.Count; i++)
                {
                    chk_box = RG_PayElements.Items[i].FindControl("chk_Select") as CheckBox;
                    if (chk_box.Checked)
                    {
                        lbl_ID                        = RG_PayElements.Items[i].FindControl("lbl_EmpID") as Label;
                        txt_Val                       = RG_PayElements.Items[i].FindControl("txt_Value") as TextBox;
                        txt_tds_val                   = RG_PayElements.Items[i].FindControl("txt_tds_Value") as TextBox;
                        _obj_smhr_EMP_TDS             = new SMHR_EMP_TDS();
                        _obj_smhr_EMP_TDS.MODE        = 3;
                        _obj_smhr_EMP_TDS.TDS_CHECKED = true;
                        _obj_smhr_EMP_TDS.TDS_EMPID   = Convert.ToInt32(lbl_ID.Text);
                        _obj_smhr_EMP_TDS.TDS_BUID    = Convert.ToInt32(rcb_BussinessUnit.SelectedItem.Value);
                        _obj_smhr_EMP_TDS.TDS_PERIOD  = Convert.ToInt32(rcmb_Period.SelectedValue);
                        //_obj_smhr_EMP_TDS.SMHR_EMP_PAYITEMS_CALMODE = Convert.ToString(dt.Rows[0]["PAYITEM_CALMODE"]);
                        if (txt_Val.Text != "")
                        {
                            _obj_smhr_EMP_TDS.PREV_GROSS_AMOUNT = Convert.ToDouble(txt_Val.Text);
                        }
                        else
                        {
                            _obj_smhr_EMP_TDS.PREV_GROSS_AMOUNT = 0.0;
                        }
                        if (txt_tds_val.Text != "")
                        {
                            _obj_smhr_EMP_TDS.PREV_TDS_AMOUNT = Convert.ToDouble(txt_tds_val.Text);
                        }
                        else
                        {
                            _obj_smhr_EMP_TDS.PREV_TDS_AMOUNT = 0.0;
                        }
                        _obj_smhr_EMP_TDS.TDS_ORGID = Convert.ToInt32(Session["ORG_ID"]);
                        //_obj_smhr_EMP_TDS.SMHR_EMP_PAYITEMS_CREATEDBY = Convert.ToInt32(Session["USER_ID"]);
                        //_obj_smhr_EMP_TDS.SMHR_EMP_PAYITEMS_CREATEDDATE = DateTime.Now;
                        bool status = BLL.set_EMP_TDS1(_obj_smhr_EMP_TDS);
                    }
                }
                BLL.ShowMessage(this, "TDS & Gross Values Saved for the Selected Employees");
                clearFields();
            }
            else
            {
                BLL.ShowMessage(this, "Please Select atleast one employee or Enter Values for Selected Employee");
                return;
            }
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_emppastinfo", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
            return;
        }
    }
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        try
        {
            _obj_smhr_EMP_TDS = new SMHR_EMP_TDS();

            switch (((Button)sender).ID.ToUpper())
            {
            case "BTN_SAVE":
                // _obj_smhr_EMP_TDS = new SMHR_EMP_TDS();
                _obj_smhr_EMP_TDS.OPERATION = operation.Insert;
                _obj_smhr_EMP_TDS.TDS_BUID  = Convert.ToInt32(rcmb_Tds_Buid.SelectedValue);
                _obj_smhr_EMP_TDS.TDS_EMPID = Convert.ToInt32(rcmb_Tds_EmpId.SelectedValue);
                if (rntxt_Prev_Gross_Amount.Text == "")
                {
                    _obj_smhr_EMP_TDS.PREV_GROSS_AMOUNT = 0.00;
                }
                else
                {
                    _obj_smhr_EMP_TDS.PREV_GROSS_AMOUNT = Convert.ToDouble(rntxt_Prev_Gross_Amount.Text);
                }
                if (rntxt_prev_tds_amount.Text == "")
                {
                    _obj_smhr_EMP_TDS.PREV_TDS_AMOUNT = 0.00;
                }
                else
                {
                    _obj_smhr_EMP_TDS.PREV_TDS_AMOUNT = Convert.ToDouble(rntxt_prev_tds_amount.Text);
                }
                _obj_smhr_EMP_TDS.TDS_ORGID  = Convert.ToInt32(Session["ORG_ID"]);
                _obj_smhr_EMP_TDS.TDS_PERIOD = Convert.ToInt32(rcmb_Period.SelectedValue);
                _obj_smhr_EMP_TDS.OPERATION  = operation.Check;
                if (Convert.ToString(BLL.get_EMP_TDS(_obj_smhr_EMP_TDS).Rows[0]["Count"]) != "0")
                {
                    BLL.ShowMessage(this, "Business unit with this Combination Already Exists!");
                    return;
                }
                _obj_smhr_EMP_TDS.OPERATION = operation.Insert;
                if (BLL.set_EMP_TDS(_obj_smhr_EMP_TDS))
                {
                    BLL.ShowMessage(this, "Information Saved Successfully");
                }

                break;

            case "BTN_UPDATE":
                _obj_smhr_EMP_TDS.OPERATION = operation.Update;
                if (rntxt_Prev_Gross_Amount.Text == "")
                {
                    _obj_smhr_EMP_TDS.PREV_GROSS_AMOUNT = 0.00;
                }
                else
                {
                    _obj_smhr_EMP_TDS.PREV_GROSS_AMOUNT = Convert.ToDouble(rntxt_Prev_Gross_Amount.Text);
                }
                if (rntxt_prev_tds_amount.Text == "")
                {
                    _obj_smhr_EMP_TDS.PREV_TDS_AMOUNT = 0.00;
                }
                else
                {
                    _obj_smhr_EMP_TDS.PREV_TDS_AMOUNT = Convert.ToDouble(rntxt_prev_tds_amount.Text);
                }
                _obj_smhr_EMP_TDS.TDS_EMPID  = Convert.ToInt32(rcmb_Tds_EmpId.SelectedValue);
                _obj_smhr_EMP_TDS.TDS_BUID   = Convert.ToInt32(rcmb_Tds_Buid.SelectedValue);
                _obj_smhr_EMP_TDS.TDS_ORGID  = Convert.ToInt32(Session["ORG_ID"]);
                _obj_smhr_EMP_TDS.TDS_PERIOD = Convert.ToInt32(rcmb_Period.SelectedValue);
                _obj_smhr_EMP_TDS.EMP_TDS_ID = Convert.ToInt32(Session["EMP_TDS_ID"]);
                if (BLL.set_EMP_TDS(_obj_smhr_EMP_TDS))
                {
                    BLL.ShowMessage(this, "Information Updated Successfully");
                }
                break;

            default:
                break;
            }
            rmp_Main.SelectedIndex = 0;
            loadGrid();
            rg_Tds.DataBind();
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_Employee_Tds", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }