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();
        }
    }
 //tab container event
 protected void tabContainerEmpLeave_ActiveTabChanged(object sender, EventArgs e)
 {
     if (tabContainerEmpLeave.ActiveTabIndex == 0)
     {
         List <ATTEmployeeLeave> lstEmployeeLeave = new List <ATTEmployeeLeave>();
         if (Session["EmployeeLeave"] != null)
         {
             lstEmployeeLeave = (List <ATTEmployeeLeave>)Session["EmployeeLeave"];
         }
         Session["EmployeeLeave"]        = lstEmployeeLeave;
         grdLeaveApplications.DataSource = lstEmployeeLeave;
         grdLeaveApplications.DataBind();
     }
     else if (tabContainerEmpLeave.ActiveTabIndex == 1)
     {
         chkbxRec.Checked = true;
         List <ATTEmployeeLeave> lstEmployeeLeave = BLLEmployeeLeave.GetEmployeeLeave(null, "REQ");
         grdLeaveApplications.DataSource = lstEmployeeLeave;
         grdLeaveApplications.DataBind();
         Session["EmployeeLeave"] = lstEmployeeLeave;
     }
 }
Exemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.ExpiresAbsolute = DateTime.Now.AddDays(-1d);
        Response.Expires         = -1500;
        Response.CacheControl    = "no-cache";

        //block if without login
        if (Session["Login_User_Detail"] == null)
        {
            Response.Redirect("~/MODULES/Login.aspx", true);
        }

        //block if from URL
        ATTUserLogin user = ((ATTUserLogin)Session["Login_User_Detail"]);

        Session["OrgID"] = 9;
        if (user.MenuList.ContainsKey("2,23,1") == true)
        {
            Session["UserName"] = user.UserName;
            if (!IsPostBack)
            {
                Session["index"] = -1;
                List <ATTEmployeeLeave> lstEmployeeLeave = BLLEmployeeLeave.GetEmployeeLeave(null, "REQ");
                grdRecLeaveApplications.DataSource = lstEmployeeLeave;
                grdRecLeaveApplications.DataBind();
                Session["EmployeeLeave"] = lstEmployeeLeave;
                chkbxAppr.Checked        = true;
                LoadOrganizationWithChilds(int.Parse(Session["OrgID"].ToString()));
                LoadDesignations();
            }
        }
        else
        {
            Response.Redirect("~/MODULES/Login.aspx", true);
        }
    }
    protected void grdEmployee_SelectedIndexChanged(object sender, EventArgs e)
    {
        this.CollapsiblePanelExtender1.Collapsed = true;
        //System.Threading.Thread.Sleep(1000);

        this.CollapsiblePanelExtender1.ClientState = "true";
        this.CollapsiblePanelExtender1.Collapsed   = true;


        string Name = Server.HtmlDecode(grdEmployee.Rows[grdEmployee.SelectedIndex].Cells[5].Text).ToString();
        int    id   = 0;
        List <ATTEmployeeLeave> lstEmployeeLeave = new List <ATTEmployeeLeave>();

        if (tabContainerEmpLeave.ActiveTabIndex == 0)
        {
            id = int.Parse(grdEmployee.Rows[grdEmployee.SelectedIndex].Cells[0].Text);
            txtEmpName.Text = Name;
            txtEmpName.Attributes.Add("ID", grdEmployee.Rows[grdEmployee.SelectedIndex].Cells[0].Text);
            lstEmployeeLeave = BLLEmployeeLeave.GetEmployeeLeave(id, "REQ");
            //grdEmployee.SelectedIndex = -1;
            Session["EmployeeLeave"]        = lstEmployeeLeave;
            grdLeaveApplications.DataSource = lstEmployeeLeave;
            grdLeaveApplications.DataBind();
        }
        else if (tabContainerEmpLeave.ActiveTabIndex == 1)
        {
            id = int.Parse(grdEmployee.Rows[grdEmployee.SelectedIndex].Cells[0].Text);
            txtRecName.Text = Name;
            txtRecName.Attributes.Add("ID", grdEmployee.Rows[grdEmployee.SelectedIndex].Cells[0].Text);
        }

        //Loading Leave Type Drop Down List

        if (tabContainerEmpLeave.ActiveTabIndex == 0)
        {
            int eid = int.Parse(txtEmpName.Attributes["ID"].ToString());
            List <ATTEmployeeLeave> LSTEmpDesLeave = BLLEmployeeLeave.GetEmpDesLeave(eid);
            //LSTEmpDesLeave.Insert(0, new ATTEmployeeLeave(0, 0, "-बिदाको किसिम छान्नुहोस्-"));
            ddlAppType.DataSource     = LSTEmpDesLeave;
            ddlAppType.DataTextField  = "LeaveType";
            ddlAppType.DataValueField = "LeaveTypeID";
            ddlAppType.DataBind();
            List <ATTLeaveTypeEmployee>    LSTLeaveTypeEmp = BLLLeaveTypeEmployee.GetLeaveTypeEmployee(null, eid);
            List <ATTLeaveTypeDesignation> LSTLeaveTypeDes = new List <ATTLeaveTypeDesignation>();
            int desID = 0;
            List <ATTEmployeePosting> LSTEmpPosting = BLLEmployeePosting.GetEmpPosting(double.Parse(eid.ToString()));
            if (LSTEmpPosting.Count > 0)
            {
                desID = LSTEmpPosting[0].DesID;
            }

            if (desID > 0)
            {
                LSTLeaveTypeDes = BLLLeaveTypeDesignation.GetLeaveTypeDesignation(null, desID);
                LSTLeaveTypeDes.Insert(0, new ATTLeaveTypeDesignation(0, "-बिदाको किसिम छान्नुहोस्-", 0, 0, "", 0, false, 0, false, "", "", ""));
            }
            //int? accrDays;
            if (LSTLeaveTypeEmp.Count < 1)
            {
                ddlAppType.DataSource     = LSTLeaveTypeDes;
                ddlAppType.DataTextField  = "LeaveType";
                ddlAppType.DataValueField = "LeaveTypeID";
                ddlAppType.DataBind();
            }
            else
            {
                List <ATTLeaveType> lstLeavetype = new List <ATTLeaveType>();
                foreach (ATTLeaveTypeEmployee var in LSTLeaveTypeEmp)
                {
                    ATTLeaveType attlv = new ATTLeaveType(var.LeaveTypeID, var.LeaveType, "");
                    lstLeavetype.Add(attlv);
                }
                if (desID > 0)
                {
                    foreach (ATTLeaveTypeEmployee var in LSTLeaveTypeEmp)
                    {
                        int i = LSTLeaveTypeDes.FindIndex(delegate(ATTLeaveTypeDesignation obj)
                        {
                            return(obj.LeaveTypeID != var.LeaveTypeID);
                        });
                        if (i > 0)
                        {
                            ATTLeaveType attlv = new ATTLeaveType(LSTLeaveTypeDes[i].LeaveTypeID, LSTLeaveTypeDes[i].LeaveType, "");
                            lstLeavetype.Add(attlv);
                        }
                    }
                }
                lstLeavetype.Insert(0, new ATTLeaveType(0, "-बिदाको किसिम छान्नुहोस्-", ""));
                ddlAppType.DataSource     = lstLeavetype;
                ddlAppType.DataTextField  = "LeaveTypeName";
                ddlAppType.DataValueField = "LeaveTypeID";
                ddlAppType.DataBind();
            }

            List <ATTEmployeeLeave> LSTEmpLeave = BLLEmployeeLeave.GetEmployeeLeave(eid, "REQ");
            Session["EmployeeLeave"] = LSTEmpLeave;


            if (BLLEmployeeLeave.GetEmployeeLeave(eid, "REQ").Count > 0)
            {
                PanelSearch.Enabled = true;
            }
            grdLeaveApplications.DataSource = LSTEmpLeave;
            grdLeaveApplications.DataBind();
        }
    }