protected void rtxt_bonuspercentage12_TextChanged(object sender, EventArgs e)
 {
     try
     {
         _obj_smhr_bonusmaster                 = new SMHR_BONUSMASTER1();
         _obj_smhr_bonusmaster.OPERATION       = operation.Select;
         _obj_smhr_bonusmaster.BUSINESSUNIT    = Convert.ToInt32(rtxt_businessunit.SelectedItem.Value);
         _obj_smhr_bonusmaster.PERIOD          = Convert.ToInt32(rtxt_period.SelectedItem.Value);
         _obj_smhr_bonusmaster.PERIOD_ELEMENTS = Convert.ToInt32(rcmb_periodelements.SelectedItem.Value);
         DataTable DT = BLL.Get_SMHR_BONUSMASTER(_obj_smhr_bonusmaster);
         ViewState["MINMAX"] = DT;
         DataTable Dt_balance = new DataTable();
         Dt_balance = ViewState["MINMAX"] as DataTable;
         Telerik.Web.UI.RadNumericTextBox rtxt_bonuspercentage = sender as Telerik.Web.UI.RadNumericTextBox;
         if (rtxt_bonuspercentage.Text != string.Empty)
         {
             if ((Convert.ToDouble(rtxt_bonuspercentage.Text) < Convert.ToDouble(Dt_balance.Rows[0]["MINIMUM_BONUS_PERCENTAGE"])) || (Convert.ToDouble(rtxt_bonuspercentage.Text) > Convert.ToDouble(Dt_balance.Rows[0]["MAXIMUM_BONUS_PERCENTAGE"])))
             {
                 BLL.ShowMessage(this, "Bonus Should Be In The Range Of " + Dt_balance.Rows[0]["MINIMUM_BONUS_PERCENTAGE"] + " to " + Dt_balance.Rows[0]["MAXIMUM_BONUS_PERCENTAGE"] + "");
                 rtxt_bonuspercentage.Text = "";
                 rtxt_bonuspercentage.Focus();
                 return;
             }
             else
             {
                 GridItem          gvRow          = rtxt_bonuspercentage.Parent.Parent as GridItem;
                 CheckBox          chk            = (CheckBox)gvRow.FindControl("chckbtn_Select");
                 RadNumericTextBox rnt            = (RadNumericTextBox)gvRow.FindControl("rtxt_bonus");
                 RadNumericTextBox rnt_totalvalue = (RadNumericTextBox)gvRow.FindControl("rtxt_bonusvalue");
                 RadNumericTextBox rnt_exgratia   = (RadNumericTextBox)gvRow.FindControl("rtxt_exgratia");
                 RadNumericTextBox rnt1           = (RadNumericTextBox)gvRow.FindControl("rtxt_bonuspercentage");
                 DataTable         dt_BONUS_TRANS = (DataTable)ViewState["BONUS_TRANS"];
                 rnt_totalvalue.Value = Math.Round(((Convert.ToDouble(dt_BONUS_TRANS.Rows[gvRow.ItemIndex]["BONUS"]) * Convert.ToDouble(rnt1.Value) / 100) * Convert.ToDouble(dt_BONUS_TRANS.Rows[gvRow.ItemIndex]["ATTENDANCE"])) / 30, 2);
                 if (rnt_totalvalue.Value >= 3500)
                 {
                     rnt.Value          = 3500;
                     rnt_exgratia.Value = rnt_totalvalue.Value - 3500;
                 }
                 else
                 {
                     rnt.Value          = rnt_totalvalue.Value;
                     rnt_exgratia.Value = 0;
                 }
             }
         }
         else
         {
             BLL.ShowMessage(this, "Enter Some Bonus Value");
             rtxt_bonuspercentage.Focus();
             return;
         }
     }
     catch (Exception ex)
     {
         SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_bonustransactionApproval", ex.StackTrace, DateTime.Now);
         Response.Redirect("~/Frm_ErrorPage.aspx");
     }
 }
 private void LoadGrid()
 {
     try
     {
         _OBJ_BONUS_TRANS                       = new smhr_Bonus_trans();//to check if records are exists or not
         _OBJ_BONUS_TRANS.OPERATION             = operation.Check;
         _OBJ_BONUS_TRANS.BONUS_PERIOD_ID       = Convert.ToInt32(rtxt_period.SelectedItem.Value);
         _OBJ_BONUS_TRANS.BONUS_PERIOD_ELEMENTS = Convert.ToInt32(rcmb_periodelements.SelectedItem.Value);
         _OBJ_BONUS_TRANS.BONUS_BU_ID           = Convert.ToInt32(rtxt_businessunit.SelectedItem.Value);
         DataTable dt_chk = BLL.Get_SMHR_BONUS_TRANS1(_OBJ_BONUS_TRANS);
         if (Convert.ToInt32(dt_chk.Rows[0][0]) > 0)
         {
             SMHR_BONUSMASTER1 _obj_bm = new SMHR_BONUSMASTER1();
             _obj_bm.OPERATION             = operation.Select;
             _obj_bm.BUSINESSUNIT          = Convert.ToInt32(rtxt_businessunit.SelectedItem.Value);
             _OBJ_BONUS_TRANS.BUSINESSUNIT = Convert.ToString(rtxt_businessunit.SelectedItem.Text);
             _OBJ_BONUS_TRANS.OPERATION    = operation.Delete;//to get the unchecked members...only
             DataTable dt_data = BLL.Get_SMHR_BONUS_TRANS1(_OBJ_BONUS_TRANS);
             ViewState["MINMAX"] = dt_data;
             if (dt_data.Rows.Count > 0)
             {
             }
             else
             {
             }
         }
         else
         {
             _obj_smhr_bonusmaster                 = new SMHR_BONUSMASTER1();
             _obj_smhr_bonusmaster.OPERATION       = operation.Select;
             _obj_smhr_bonusmaster.BUSINESSUNIT    = Convert.ToInt32(rtxt_businessunit.SelectedItem.Value);
             _obj_smhr_bonusmaster.PERIOD          = Convert.ToInt32(rtxt_period.SelectedItem.Value);
             _obj_smhr_bonusmaster.PERIOD_ELEMENTS = Convert.ToInt32(rcmb_periodelements.SelectedItem.Value);
             DataTable DT = BLL.Get_SMHR_BONUSMASTER(_obj_smhr_bonusmaster);
             ViewState["MINMAX"] = DT;
             if (DT.Rows.Count > 0)
             {
             }
             else
             {
             }
         }
     }
     catch (Exception ex)
     {
         //throw ex;
         SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_bonustransactionApproval", ex.StackTrace, DateTime.Now);
         Response.Redirect("~/Frm_ErrorPage.aspx");
     }
 }
示例#3
0
 protected void rcmb_periodelements_SelectedIndexChanged1(object o, RadComboBoxSelectedIndexChangedEventArgs e)
 {
     try
     {
         if (rcmb_periodelements.SelectedIndex > 0)
         {
             SMHR_BONUSMASTER1 _obj_bm = new SMHR_BONUSMASTER1();
             _OBJ_BONUS_TRANS                       = new smhr_Bonus_trans();
             _OBJ_BONUS_TRANS.BONUS_BU_ID           = Convert.ToInt32(rcmb_businessunit.SelectedItem.Value);
             _OBJ_BONUS_TRANS.BONUS_PERIOD_ID       = Convert.ToInt32(rcmb_period.SelectedItem.Value);
             _OBJ_BONUS_TRANS.BONUS_PERIOD_ELEMENTS = Convert.ToInt32(rcmb_periodelements.SelectedItem.Value);
             _OBJ_BONUS_TRANS.OPERATION             = operation.Get;
             DataTable dt_details_past = BLL.Get_SMHR_BONUS_TRANS1(_OBJ_BONUS_TRANS);
             ViewState["BONUS_TRANS"] = dt_details_past;
             dt_details_past.Columns.Add("SI_NO");
             if (dt_details_past.Rows.Count != 0)
             {
                 for (int j = 0; j < dt_details_past.Rows.Count; j++)
                 {
                     dt_details_past.Rows[j]["SI_NO"] = j + 1;
                 }
             }
             rg_bonuspast.DataSource = dt_details_past;
             rg_bonuspast.DataBind();
             rg_bonuspast.Visible = true;
         }
         else
         {
             rg_bonuspast.Visible = false;
         }
     }
     catch (Exception ex)
     {
         SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "bonuspast", ex.StackTrace, DateTime.Now);
         Response.Redirect("~/Frm_ErrorPage.aspx");
     }
 }
    protected void btnapprove_Click(object sender, EventArgs e)
    {
        try
        {
            int count = 0;
            _OBJ_BONUS_TRANS = new smhr_Bonus_trans();
            _OBJ_BONUS_TRANS.BONUS_PERIOD_ID       = Convert.ToInt32(rtxt_period.SelectedItem.Value);
            _OBJ_BONUS_TRANS.BONUS_PERIOD_ELEMENTS = Convert.ToInt32(rcmb_periodelements.SelectedItem.Value);
            _OBJ_BONUS_TRANS.BONUS_BU_ID           = Convert.ToInt32(rtxt_businessunit.SelectedItem.Value);
            _OBJ_BONUS_TRANS.ORGANISATION_ID       = Convert.ToInt32(Session["ORG_ID"]);
            _OBJ_BONUS_TRANS.MODIFIED_BY           = Convert.ToInt32(Session["USER_ID"]);
            _OBJ_BONUS_TRANS.MODIFIED_DATE         = DateTime.Now;
            for (int k = 0; k < rg_bonusapprove.Items.Count; k++)
            {
                CheckBox          chk                  = rg_bonusapprove.Items[k].FindControl("chckbtn_Select") as CheckBox;
                Label             lbl_bonus_id         = rg_bonusapprove.Items[k].FindControl("lbl_bonus_id") as Label;
                RadNumericTextBox rnt                  = new Telerik.Web.UI.RadNumericTextBox();
                RadNumericTextBox rnt_bonus_value      = new Telerik.Web.UI.RadNumericTextBox();
                RadNumericTextBox rnt_bonus_totalvalue = new Telerik.Web.UI.RadNumericTextBox();
                RadNumericTextBox rnt_bonus_exgratia   = new Telerik.Web.UI.RadNumericTextBox();
                rnt                             = rg_bonusapprove.Items[k].FindControl("rtxt_bonuspercentage") as RadNumericTextBox;
                rnt_bonus_value                 = rg_bonusapprove.Items[k].FindControl("rtxt_bonusvalue") as RadNumericTextBox;
                rnt_bonus_totalvalue            = rg_bonusapprove.Items[k].FindControl("rtxt_bonus") as RadNumericTextBox;
                rnt_bonus_exgratia              = rg_bonusapprove.Items[k].FindControl("rtxt_exgratia") as RadNumericTextBox;
                _OBJ_BONUS_TRANS.Bonus_trans_ID = Convert.ToInt32(lbl_bonus_id.Text);
                if (rnt.Text != string.Empty)
                {
                    _OBJ_BONUS_TRANS.Bonus_Percentage = Convert.ToDecimal(rnt.Text);
                }
                else
                {
                    DataTable Dt_balance = new DataTable();
                    Dt_balance = ViewState["MINMAX"] as DataTable;
                    _OBJ_BONUS_TRANS.Bonus_Percentage = Convert.ToDecimal(Dt_balance.Rows[0]["MINIMUM_BONUS_PERCENTAGE"]);
                }
                if (rnt_bonus_value.Text != string.Empty)
                {
                    _OBJ_BONUS_TRANS.BONUS_BONUSVALUE = Convert.ToDecimal(rnt_bonus_value.Text);
                    _OBJ_BONUS_TRANS.BONUS_TOTALVALUE = Convert.ToDecimal(rnt_bonus_totalvalue.Text);
                    _OBJ_BONUS_TRANS.BONUS_EXGRATIA   = Convert.ToDecimal(rnt_bonus_exgratia.Text);
                }
                else
                {
                    //_OBJ_BONUS_TRANS.BONUS_BONUSVALUE = 0;
                    return;
                }

                _OBJ_BONUS_TRANS.Bonus_Trans_checked = Convert.ToBoolean(chk.Checked);
                if (chk.Checked)
                {
                    _OBJ_BONUS_TRANS.OPERATION         = operation.Approve;
                    _OBJ_BONUS_TRANS.BONUS_COMMIT      = 1;
                    _OBJ_BONUS_TRANS.BONUS_FINALCOMMIT = 1;
                    count++;
                }
                else
                {
                    _OBJ_BONUS_TRANS.OPERATION         = operation.Approve;
                    _OBJ_BONUS_TRANS.BONUS_COMMIT      = 1;
                    _OBJ_BONUS_TRANS.BONUS_FINALCOMMIT = 0;
                }
                BLL.bonus_trans_insrt(_OBJ_BONUS_TRANS);
            }

            SMHR_BONUSMASTER1 _obj_bm = new SMHR_BONUSMASTER1();
            _OBJ_BONUS_TRANS.BONUS_PERIOD_ID       = Convert.ToInt32(rtxt_period.SelectedItem.Value);
            _OBJ_BONUS_TRANS.BONUS_PERIOD_ELEMENTS = Convert.ToInt32(rcmb_periodelements.SelectedItem.Value);
            _OBJ_BONUS_TRANS.BONUS_BU_ID           = Convert.ToInt32(rtxt_businessunit.SelectedItem.Value);
            _OBJ_BONUS_TRANS.OPERATION             = operation.Empty1;
            DataTable dt_details_sub = BLL.Get_SMHR_BONUS_TRANS1(_OBJ_BONUS_TRANS);
            ViewState["BONUS_TRANS"] = dt_details_sub;
            if (dt_details_sub.Rows.Count > 0)
            {
                btn_approve.Visible = true;
                btn_reject.Visible  = true;
            }
            else
            {
                btn_approve.Visible = false;
                btn_reject.Visible  = false;
            }
            rg_bonusapprove.DataSource = dt_details_sub;
            rg_bonusapprove.DataBind();
            _obj_smhr_bonusmaster.OPERATION       = operation.Select;
            _obj_smhr_bonusmaster.BUSINESSUNIT    = Convert.ToInt32(rtxt_businessunit.SelectedItem.Value);
            _obj_smhr_bonusmaster.PERIOD          = Convert.ToInt32(rtxt_period.SelectedItem.Value);
            _obj_smhr_bonusmaster.PERIOD_ELEMENTS = Convert.ToInt32(rcmb_periodelements.SelectedItem.Value);
            if (count != 0)
            {
                BLL.ShowMessage(this, "Approved Successfully");
            }
            else
            {
                BLL.ShowMessage(this, "Select Employee To Approve");
            }
            return;
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_bonustransactionApproval", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }