Exemple #1
0
 protected void txtEIdNo_TextChanged(object sender, EventArgs e)
 {
     try
     {
         string OCODE      = ((SessionUser)Session["SessionUser"]).OCode;
         string employeeID = Convert.ToString(txtEid_TRNS.Text);
         Emp_IMG_TRNS.ImageUrl = "EmployeeIMG.ashx?eId=" + employeeID + "&oCode=" + OCODE;
         var result = objEmp_BLL.GetEmployeeDetailsIDCard(employeeID, OCODE).ToList();
         if (result.Count > 0)
         {
             var objNewEmp = result.First();
             txtEid_TRNS.Text     = Convert.ToString(objNewEmp.EID);
             txtEmpName_TRNS.Text = Convert.ToString(objNewEmp.EMP_FIRSTNAME + " " + objNewEmp.EMP_LASTNAME);
             txtDepartment.Text   = objNewEmp.DPT_NAME;
             txtDesignation.Text  = objNewEmp.DEG_NAME;
         }
         else
         {
             //NO RECORDS FOUND.
         }
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
     }
 }
        public void employeeDetails(string id)
        {
            try
            {
                string OCODE      = ((SessionUser)Session["SessionUser"]).OCode;
                string employeeID = Convert.ToString(id);

                var result = objEmp_BLL.GetEmployeeDetailsIDCard(employeeID, OCODE).ToList();
                if (result.Count > 0)
                {
                    // Emp_IMG_TRNS.Visible = true;
                    //  Emp_IMG_TRNS.ImageUrl = "EmployeeIMG.ashx?eId=" + employeeID + "&oCode=" + OCODE;
                    var objNewEmp = result.First();
                    txtEid_TRNS.Text     = Convert.ToString(objNewEmp.EID);
                    txtEmpName_TRNS.Text = Convert.ToString(objNewEmp.EMP_FIRSTNAME + " " + objNewEmp.EMP_LASTNAME);
                    txtDepartment.Text   = objNewEmp.DPT_NAME;
                    txtDesignation.Text  = objNewEmp.DEG_NAME;
                }
                else
                {
                    //  Emp_IMG_TRNS.Visible = false;
                    txtEid_TRNS.Text     = "";
                    txtEmpName_TRNS.Text = "";
                    txtDepartment.Text   = "";
                    txtDesignation.Text  = "";
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('This Employee is Inactive!')", true);
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
        protected void txtEIdNo_TextChanged(object sender, EventArgs e)
        {
            try
            {
                string OCODE      = ((SessionUser)Session["SessionUser"]).OCode;
                string employeeID = Convert.ToString(txtEid_TRNS.Text.Trim());
                GetLeaveDetailsByEID(employeeID);
                LoadApprovePersonListByEid(employeeID);

                var result = objEmp_BLL.GetEmployeeDetailsIDCard(employeeID, OCODE).ToList();
                if (result.Count > 0)
                {
                    var objNewEmp = result.First();
                    Emp_IMG_TR.Visible  = true;
                    Emp_IMG_TR.ImageUrl = "EmployeeIMG.ashx?eId=" + employeeID + "&oCode=" + OCODE;
                    if (objNewEmp.Gender == "Male")
                    {
                        getLeaveTypeForMale();
                    }
                    else
                    {
                        getLeaveTypesfordrp();
                    }

                    ProbationPeriod();
                    txtEid_TRNS.Text     = Convert.ToString(objNewEmp.EID);
                    txtEmpName_TRNS.Text = Convert.ToString(objNewEmp.EMP_FIRSTNAME + " " + objNewEmp.EMP_LASTNAME);
                    txtDepartment.Text   = objNewEmp.DPT_NAME;
                    txtDesignation.Text  = objNewEmp.DEG_NAME;
                }
                else
                {
                    Emp_IMG_TR.Visible   = false;
                    txtEmpName_TRNS.Text = "";
                    txtDepartment.Text   = "";
                    txtDesignation.Text  = "";
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('This Employee is Inactive!')", true);
                    //NO RECORDS FOUND.
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
        private void LeaveApplyAndDetailsInfo()
        {
            try
            {
                string OCODE = ((SessionUser)Session["SessionUser"]).OCode;

                string eid = ((SessionUser)Session["SessionUser"]).EID;

                //string employeeID = Convert.ToString(txtEid_TRNS.Text);
                getLeaveEnjoyedInfoById(eid);
                LoadApprovePersonListByEid(eid);
                var result = objEmp_BLL.GetEmployeeDetailsIDCard(eid, OCODE).ToList();
                if (result.Count > 0)
                {
                    var objNewEmp = result.First();
                    if (objNewEmp.Gender == "Male")
                    {
                        getLeaveTypeForMale();
                        mlHeader.Visible = false;
                        rdToal.Visible   = false;
                        tdMLE.Visible    = false;
                        tdmlB.Visible    = false;
                    }
                    else
                    {
                        getLeaveTypesfordrp();
                        mlHeader.Visible = true;
                        rdToal.Visible   = true;
                        tdMLE.Visible    = true;
                        tdmlB.Visible    = true;
                    }
                }
                else
                {
                    Emp_IMG_TR.Visible   = false;
                    txtEmpName_TRNS.Text = "";
                    txtDepartment.Text   = "";
                    txtDesignation.Text  = "";
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('This Employee is Inactive!')", true);
                    //NO RECORDS FOUND.
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void GetEmployeeDetails(string Eid)
        {
            try
            {
                string OCODE      = ((SessionUser)Session["SessionUser"]).OCode;
                string employeeID = Convert.ToString(Eid);
                getLeaveEnjoyedInfoById(employeeID);

                var result = objEmp_BLL.GetEmployeeDetailsIDCard(employeeID, OCODE).ToList();
                if (result.Count > 0)
                {
                    var objNewEmp = result.First();
                    if (objNewEmp.Gender == "Male")
                    {
                        getLeaveTypeForMale();
                        mlHeader.Visible = false;
                        rdToal.Visible   = false;
                        tdMLE.Visible    = false;
                        tdmlB.Visible    = false;
                    }
                    else
                    {
                        getLeaveTypesfordrp();
                        mlHeader.Visible = true;
                        rdToal.Visible   = true;
                        tdMLE.Visible    = true;
                        tdmlB.Visible    = true;
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('This Employee is Inactive!')", true);
                    //NO RECORDS FOUND.
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
        void BindGridAttendanceByEID()
        {
            try
            {
                string OCODE = ((SessionUser)Session["SessionUser"]).OCode;

                //load all attendance by eid

                //using (ERPSSLHBEntities context = new ERPSSLHBEntities())
                //{
                //    if (context.HRM_ATTENDANCE.Count() > 0)
                //    {
                //        var row = objAtt_BLL.GetAttendanceByEID(OCODE, txtEid_AT.Text).ToList();
                //        if (row.Count > 0)
                //        {
                //            GridViewEMP_AT.DataSource = row.ToList();
                //            GridViewEMP_AT.DataBind();
                //        }
                //    }
                //    else
                //    {
                //        var obj = new List<HRM_ATTENDANCE>();
                //        obj.Add(new HRM_ATTENDANCE());

                //        // Bind the DataTable which contain a blank row to the GridView
                //        GridViewEMP_AT.DataSource = obj;
                //        GridViewEMP_AT.DataBind();

                //        int columnsCount = GridViewEMP_AT.Columns.Count;
                //        GridViewEMP_AT.Rows[0].Cells.Clear();// clear all the cells in the row
                //        GridViewEMP_AT.Rows[0].Cells.Add(new TableCell()); //add a new blank cell
                //        GridViewEMP_AT.Rows[0].Cells[0].ColumnSpan = columnsCount; //set the column span to the new added cell

                //        GridViewEMP_AT.Rows[0].Cells[0].HorizontalAlign = HorizontalAlign.Center;
                //        GridViewEMP_AT.Rows[0].Cells[0].ForeColor = System.Drawing.Color.Red;
                //        GridViewEMP_AT.Rows[0].Cells[0].Font.Bold = true;

                //        //set No Results found to the new added cell
                //        GridViewEMP_AT.Rows[0].Cells[0].Text = "NO RECORDS FOUND!";
                //    }
                //}

                var result = Emp_BLL.GetEmployeeDetailsIDCard(txtEid_AT.Text, OCODE).ToList();
                if (result.Count > 0)
                {
                    var objNewEmp = result.First();
                    Emp_IMG_TR.Visible         = true;
                    Emp_IMG_TR.ImageUrl        = "EmployeeIMG.ashx?eId=" + txtEid_AT.Text + "&oCode=" + OCODE;
                    txtEid_AT.Text             = Convert.ToString(objNewEmp.EID);
                    txtEmpName_TRNS.Text       = Convert.ToString(objNewEmp.EMP_FIRSTNAME + " " + objNewEmp.EMP_LASTNAME);
                    txtDepartment.Text         = objNewEmp.DPT_NAME;
                    txtDesignation.Text        = objNewEmp.DEG_NAME;
                    hdnEmployeeShiftCode.Value = objNewEmp.SHIFTCODE;

                    rdExtraOT.Visible       = true;
                    rdExtraOTDeduct.Visible = true;
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No Data Found!')", true);
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }