protected void btnAppSubmit_Click1(object sender, EventArgs e)
    {
        try
        {
            List <ATTEmployeeLeave> lstEmployeeLeave = (List <ATTEmployeeLeave>)Session["EmployeeLeave"];
            ATTEmployeeLeave        objEmp           = lstEmployeeLeave[int.Parse(Session["index"].ToString())];
            objEmp.EntryBy = Session["UserName"].ToString();
            if (objEmp.Approved == "N")
            {
                if (BLLEmployeeLeaveApprove.LeaveApprove(objEmp))
                {
                    this.lblStatusMessage.Text = "Employee Leave Approved Successfully";
                    this.programmaticModalPopup.Show();
                    grdRecLeaveApplications.DataSource = BLLEmployeeLeave.GetEmployeeLeave(null, "APP");
                    grdRecLeaveApplications.DataBind();
                }
            }
            else
            {
                List <ATTEmployeeLeave> LSTLvAPP = BLLEmployeeLeaveApprove.LeaveCheck(objEmp);
                if (LSTLvAPP[0].OutMessage != "OK")
                {
                    this.lblStatusMessage2.Text = LSTLvAPP[0].OutMessage;
                    this.programmaticModalPopup2.Show();
                    return;
                }
                else if (LSTLvAPP[0].OutMessage == "OK")
                {
                    if (BLLEmployeeLeaveApprove.LeaveApprove(objEmp))
                    {
                        this.lblStatusMessage.Text = "Employee Leave Approved Successfully";
                        this.programmaticModalPopup.Show();
                        this.CollapsiblePanelExtender1.Collapsed   = true;
                        this.CollapsiblePanelExtender1.ClientState = "true";
                        grdRecLeaveApplications.DataSource         = BLLEmployeeLeave.GetEmployeeLeave(null, "APP");
                        grdRecLeaveApplications.DataBind();
                    }
                }
            }
            ClearControls("Submit");
        }

        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message.ToString();
            this.programmaticModalPopup.Show();
        }
    }
Example #2
0
    protected void btnAppSubmit_Click1(object sender, EventArgs e)
    {
        try
        {
            List <ATTEmployeeLeave> lstEmployeeLeave = (List <ATTEmployeeLeave>)Session["EmployeeLeave"];
            ATTEmployeeLeave        objEmp           = lstEmployeeLeave[int.Parse(Session["index"].ToString())];
            objEmp.EntryBy = Session["UserName"].ToString();
            if (objEmp.Approved == "N")
            {
                if (BLLEmployeeLeaveApprove.LeaveApprove(objEmp))
                {
                    this.lblStatusMessage.Text = "Information Saved";
                    this.programmaticModalPopup.Show();
                }
            }
            else
            {
                List <ATTEmployeeLeave> LSTLvAPP = BLLEmployeeLeaveApprove.LeaveCheck(objEmp);
                if (LSTLvAPP[0].OutMessage != "OK")
                {
                    this.lblStatusMessage2.Text = LSTLvAPP[0].OutMessage;
                    this.programmaticModalPopup2.Show();
                }
                else if (LSTLvAPP[0].OutMessage == "OK")
                {
                    if (BLLEmployeeLeaveApprove.LeaveApprove(objEmp))
                    {
                        this.lblStatusMessage.Text = "Information Saved";
                        this.programmaticModalPopup.Show();
                    }
                }
            }

            //if (BLLEmployeeLeave.SaveEmpLeaveApplication(lstEmployeeLeave))
            //{
            //    this.lblStatusMessage.Text = "Information Saved.";
            //    this.programmaticModalPopup.Show();
            //}
            ClearControls("Submit");
        }

        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message.ToString();
            this.programmaticModalPopup.Show();
        }
    }