Beispiel #1
0
    protected void btn_Reject_Click(object sender, EventArgs e)
    {
        try
        {
            CheckBox chkBox = new CheckBox();
            Label    lblid  = new Label();
            TextBox  txt    = new TextBox();
            string   str    = "";
            for (int index = 0; index <= RG_CompoffApproval.Items.Count - 1; index++)
            {
                chkBox = RG_CompoffApproval.Items[index].FindControl("chk_choose") as CheckBox;
                lblid  = RG_CompoffApproval.Items[index].FindControl("lblCompoffID") as Label;
                txt    = RG_CompoffApproval.Items[index].FindControl("txt_AppRemarks") as TextBox;
                if (chkBox.Checked)
                {
                    if (str == "")
                    {
                        str = "" + lblid.Text + "";
                    }
                    else
                    {
                        str = str + "," + lblid.Text + "";
                    }
                }
            }

            if (string.IsNullOrEmpty(str))
            {
                BLL.ShowMessage(this, "Please select employees");
                return;
            }
            bool status = false;
            _obj_smhr_empcompoff = new SMHR_EMPCOMOFF();
            _obj_smhr_empcompoff.EMPCOMPOFF_EMPID      = Convert.ToInt32(Session["EMP_ID"]);
            _obj_smhr_empcompoff.EMPCOMPOFF_STATUS     = 2;
            _obj_smhr_empcompoff.EMPCOMPOFF_REASON     = str;
            _obj_smhr_empcompoff.EMPCOMPOFF_APPROVEDBY = Convert.ToInt32(rtxt_ReportingMgr.Text);

            //string[] strSpilt = lblDOB.Text.Split('/');
            //lblDOB.Text = strSpilt[1] + "/" + strSpilt[0] + "/" + strSpilt[2];
            //txt_FDOB.SelectedDate = Convert.ToDateTime(lblDOB.Text);
            _obj_smhr_empcompoff.EMPCOMPOFF_APPROVEDDATE    = Convert.ToDateTime(rdp_ApprovalDate.SelectedDate.Value); //Convert.ToDateTime(rdp_ApprovalDate.SelectedDate.Value.ToString("MM/dd/YYYy"));
            _obj_smhr_empcompoff.EMPCOMPOFF_APPROVALREMARKS = txt.Text;
            if (txt.Text == "")
            {
                _obj_smhr_empcompoff.EMPCOMPOFF_APPROVALREMARKS = null;
            }
            _obj_smhr_empcompoff.LASTMDFBY   = Convert.ToInt32(Session["USER_ID"]);
            _obj_smhr_empcompoff.LASTMDFDATE = DateTime.Now;
            _obj_smhr_empcompoff.OPERATION   = operation.Update1;
            status = BLL.set_empcompoffs(_obj_smhr_empcompoff);
            if (status == true)
            {
                BLL.ShowMessage(this, "Selected Compoffs Rejected");
                LoadData();
                RG_CompoffApproval.DataBind();
                //rg_expenseapproval.visible = false;
                return;
            }
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_CompOffApproval", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }
Beispiel #2
0
    protected void btn_Approve_Click(object sender, EventArgs e)
    {
        try
        {
            SMHR_LEAVEBALANCE _obj_smhr_leavebal = new SMHR_LEAVEBALANCE();
            CheckBox          chkBox             = new CheckBox();
            Label             lblid    = new Label();
            Label             lblempid = new Label();
            Label             lblleave = new Label();
            TextBox           txt      = new TextBox();
            string            str      = "";
            string            str1     = "";
            for (int index = 0; index <= RG_CompoffApproval.Items.Count - 1; index++)
            {
                chkBox   = RG_CompoffApproval.Items[index].FindControl("chk_choose") as CheckBox;
                lblid    = RG_CompoffApproval.Items[index].FindControl("lblCompoffID") as Label;
                lblempid = RG_CompoffApproval.Items[index].FindControl("lblEMPID") as Label;
                txt      = RG_CompoffApproval.Items[index].FindControl("txt_AppRemarks") as TextBox;
                if (chkBox.Checked)
                {
                    if (str == "")
                    {
                        str = "" + lblid.Text + "";
                    }
                    else
                    {
                        str = str + "," + lblid.Text + "";
                    }

                    if (str1 == "")
                    {
                        str1 = "" + lblempid.Text + "";
                    }
                    else
                    {
                        str1 = str1 + "," + lblempid.Text + "";
                    }
                }
            }

            if (string.IsNullOrEmpty(str))
            {
                BLL.ShowMessage(this, "please select employees");
                return;
            }
            bool status = false;
            _obj_smhr_empcompoff = new SMHR_EMPCOMOFF();
            //_obj_smhr_empcompoff.EMPNAME = str1;
            _obj_smhr_empcompoff.EMPCOMPOFF_STATUS     = 1;
            _obj_smhr_empcompoff.EMPCOMPOFF_REASON     = str;
            _obj_smhr_empcompoff.EMPCOMPOFF_APPROVEDBY = Convert.ToInt32(rtxt_ReportingMgr.Text);

            //string[] strSpilt = (rdp_ApprovalDate.SelectedDate).ToString().Split('/');
            //_obj_smhr_empcompoff.EMPCOMPOFF_APPROVEDDATE = Convert.ToDateTime(strSpilt[1] + "/" + strSpilt[0] + "/" + strSpilt[2]);
            _obj_smhr_empcompoff.EMPCOMPOFF_APPROVEDDATE = Convert.ToDateTime(rdp_ApprovalDate.SelectedDate.Value);
            _obj_smhr_empcompoff.ORGANISATION_ID         = Convert.ToInt32(Session["ORG_ID"]);
            if (txt.Text != string.Empty)
            {
                _obj_smhr_empcompoff.EMPCOMPOFF_APPROVALREMARKS = "a";
            }
            else
            {
                _obj_smhr_empcompoff.EMPCOMPOFF_APPROVALREMARKS = null;
            }
            _obj_smhr_empcompoff.LASTMDFBY   = Convert.ToInt32(Session["USER_ID"]);
            _obj_smhr_empcompoff.LASTMDFDATE = DateTime.Now;
            _obj_smhr_empcompoff.OPERATION   = operation.Update1;
            status = BLL.set_empcompoffs(_obj_smhr_empcompoff);
            if (status == true)
            {
                bool rs = false;
                for (int index = 0; index <= RG_CompoffApproval.Items.Count - 1; index++)
                {
                    chkBox = RG_CompoffApproval.Items[index].FindControl("chk_choose") as CheckBox;
                    if (chkBox.Checked)
                    {
                        lblid    = RG_CompoffApproval.Items[index].FindControl("lblCompoffID") as Label;
                        lblempid = RG_CompoffApproval.Items[index].FindControl("lblEMPID") as Label;
                        lblleave = RG_CompoffApproval.Items[index].FindControl("lblleavetype") as Label;
                        _obj_smhr_leavebal.OPERATION      = operation.Update;
                        _obj_smhr_leavebal.EMPNAME        = lblempid.Text;
                        _obj_smhr_leavebal.MODE           = 4;
                        _obj_smhr_leavebal.LT_LEAVETYPEID = Convert.ToInt32(lblleave.Text);
                        rs = BLL.set_leavebalances(_obj_smhr_leavebal);
                    }
                }
                if (rs == true)
                {
                    BLL.ShowMessage(this, "Selected Compoffs approved and Leave Balance Updated");
                    LoadData();
                    RG_CompoffApproval.DataBind();
                    return;
                }
                //_obj_smhr_leavebal.OPERATION = operation.Update;
                //_obj_smhr_leavebal.EMPNAME = str1;
                //_obj_smhr_leavebal.MODE = 4;
                //SMHR_LEAVEMASTER _obj_smhr_leavemaster = new SMHR_LEAVEMASTER();
                //_obj_smhr_leavemaster.OPERATION = operation.Empty;
                //_obj_smhr_leavemaster.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);
                //DataTable dtid = new DataTable();
                //dtid = BLL.get_LeaveMaster(_obj_smhr_leavemaster);
                //if (dtid.Rows.Count > 0)
                //{
                //    _obj_smhr_leavebal.LT_LEAVETYPEID = Convert.ToInt32(dtid.Rows[0]["LEAVEMASTER_ID"]);
                //    bool rs = BLL.set_leavebalances(_obj_smhr_leavebal);
                //    BLL.ShowMessage(this, "selected Compoffs approved and Leave Balance Updated");
                //    LoadData();
                //    RG_CompoffApproval.DataBind();
                //    return;
                //}


                //else
                //{
                //    BLL.ShowMessage(this,"Please select allow Comp-off check in either of the leaves in Leave Master screen");
                //}
            }
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_CompOffApproval", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }