public List <Inf_TaskListData> ListCompleteEmployeeData()
        {
            List <Inf_TaskListData> lResult = new List <Inf_TaskListData>();

            try
            {
                using (PerformanceAppraisalEntities entity = new PerformanceAppraisalEntities())
                {
                    var listData = (from e in entity.EmployeeMasters
                                    join h in entity.AppraisalDocHeaders on e.EmployeeID equals h.EmployeeID
                                    where h.AppraisalStatus == "Completed" &&
                                    h.AppraisalYear == DateTime.Now.Year
                                    select new
                    {
                        EmployeeID = e.EmployeeID,
                        EmployeeName = e.EmployeeName,
                        DepartmentName = e.DepartmentName,
                        CompanyID = e.CompanyID,
                        Position = e.Position,
                        FirstManager = e.FirstManager,
                        SecondManager = e.SecondManager,
                        HRStaff = e.HRStaff,
                        CreatedBy = e.CreatedBy,
                        CreatedDate = e.CreatedDate,
                        AppraisalDocNo = h.AppraisalDocNo,
                        TaskOfUser = h.CreatedBy,
                        AppraisalYear = h.AppraisalYear,
                        AppraisalStatus = h.AppraisalStatus
                    }).ToList();

                    foreach (var item in listData)
                    {
                        Inf_TaskListData data = new Inf_TaskListData();
                        data.AppraisalDocNo  = item.AppraisalDocNo;
                        data.AppraisalYear   = item.AppraisalYear;
                        data.CompanyID       = item.CompanyID;
                        data.CreatedBy       = item.CreatedBy;
                        data.CreatedDate     = item.CreatedDate;
                        data.DepartmentName  = item.DepartmentName;
                        data.EmployeeID      = item.EmployeeID;
                        data.EmployeeName    = item.EmployeeName;
                        data.FirstManager    = item.FirstManager;
                        data.HRStaff         = item.HRStaff;
                        data.Position        = item.Position;
                        data.SecondManager   = item.SecondManager;
                        data.TaskOfUser      = item.TaskOfUser;
                        data.AppraisalStatus = item.AppraisalStatus;
                        lResult.Add(data);
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                logger.Error(ex.StackTrace);
            }

            return(lResult);
        }
        public List <Inf_TaskListData> ListTaskEmployeeData(string UserName)
        {
            List <Inf_TaskListData> lResult = new List <Inf_TaskListData>();

            try
            {
                using (PerformanceAppraisalEntities entity = new PerformanceAppraisalEntities())
                {
                    var listData = (from e in entity.EmployeeMasters
                                    join a in entity.ActionHistories on e.EmployeeID equals a.EmployeeID
                                    join h in entity.AppraisalDocHeaders on e.EmployeeID equals h.EmployeeID
                                    into gj
                                    from h in gj.Where(f => f.AppraisalYear == DateTime.Now.Year).DefaultIfEmpty()
                                    where a.CreatedBy == UserName &&
                                    a.Status == null &&
                                    a.AppraisalYear == DateTime.Now.Year
                                    select new
                    {
                        EmployeeID = e.EmployeeID,
                        EmployeeName = e.EmployeeName,
                        DepartmentName = e.DepartmentName,
                        CompanyID = e.CompanyID,
                        Position = e.Position,
                        FirstManager = e.FirstManager,
                        SecondManager = e.SecondManager,
                        HRStaff = e.HRStaff,
                        CreatedBy = e.CreatedBy,
                        CreatedDate = e.CreatedDate,
                        Status = a.Status,
                        AppraisalDocNo = a.AppraisalDocNo,
                        TaskOfUser = a.CreatedBy,
                        AppraisalYear = a.AppraisalYear,
                        Responsibility = a.Responsibility,
                        AppraisalStatus = h.AppraisalStatus
                    }).ToList();

                    foreach (var item in listData)
                    {
                        Inf_TaskListData data = new Inf_TaskListData();
                        data.AppraisalDocNo  = item.AppraisalDocNo;
                        data.AppraisalYear   = item.AppraisalYear;
                        data.CompanyID       = item.CompanyID;
                        data.CreatedBy       = item.CreatedBy;
                        data.CreatedDate     = item.CreatedDate;
                        data.DepartmentName  = item.DepartmentName;
                        data.EmployeeID      = item.EmployeeID;
                        data.EmployeeName    = item.EmployeeName;
                        data.FirstManager    = item.FirstManager;
                        data.HRStaff         = item.HRStaff;
                        data.Position        = item.Position;
                        data.SecondManager   = item.SecondManager;
                        data.Status          = item.Status;
                        data.TaskOfUser      = item.TaskOfUser;
                        data.Responsibility  = item.Responsibility;
                        data.AppraisalStatus = item.AppraisalStatus;
                        lResult.Add(data);
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                logger.Error(ex.StackTrace);
            }

            return(lResult);
        }