Beispiel #1
0
        public virtual List <PlacementBLL> GetEmployeesInPlaced()
        {
            try
            {
                List <PlacementBLL>            EmployeesInPlacedBLLList = new List <PlacementBLL>();
                List <EmployeesCareersHistory> Employees = new EmployeesCareersHistoryDAL().GetActiveEmployeesCareersHistory();
                List <Assignings> Assignings             = new AssigningsDAL().GetAssignings();
                List <OrganizationsStructures> OrganizationsStructures = new OrganizationsStructuresDAL().GetOrganizationStructure();
                int[] EmployeeCareerHistoryIDs = Assignings.Select(c => (int)c.EmployeeCareerHistoryID).ToArray();
                int[] ManagerCodeIDs           = OrganizationsStructures.Where(p => p.ManagerCodeID.HasValue == true).Select(c => c.ManagerCodeID.Value).ToArray(); //.Select(c => (int)c.ManagerCodeID).ToArray();
                Employees.RemoveAll(x => EmployeeCareerHistoryIDs.Contains(x.EmployeeCareerHistoryID));
                Employees.RemoveAll(o => ManagerCodeIDs.Contains(o.EmployeeCodeID));

                foreach (var item in Employees)
                {
                    EmployeesInPlacedBLLList.Add(new PlacementBLL()
                    {
                        EmployeeCareerHistory = new EmployeesCareersHistoryBLL().MapEmployeeCareerHistory(item)
                    });
                    //new OrganizationsStructuresBLL().GetOrganizationNameTillLastParentExceptPresident(((InternalAssigningBLL)AssigningBLL).Organization.OrganizationID);
                    EmployeesInPlacedBLLList.ForEach(x => x.EmployeeCareerHistory.OrganizationJob.OrganizationStructure.FullOrganizationName = new OrganizationsStructuresBLL().GetOrganizationNameTillLastParentExceptPresident(x.EmployeeCareerHistory.OrganizationJob.OrganizationStructure.OrganizationID));
                }
                return(EmployeesInPlacedBLLList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #2
0
        public IQueryable <AssigngingsDTO> GetActualEmployeesBasedOnAssigningsAsRanksCategories(int OrganizationID)
        {
            try
            {
                List <int> OrganizationIDsList = new OrganizationsStructuresBLL().GetByOrganizationIDsWithhAllChilds(OrganizationID);

                // Get actual employees Based On Assignings by date
                List <vwActualEmployeesBasedOnAssignings> ActualEmployeesBasedOnAssignings = new AssigningsDAL().GetActualEmployeeBasedOnAssignings().Where(x => OrganizationIDsList.Contains(x.OrganizationID.Value)).ToList();

                var query = ActualEmployeesBasedOnAssignings.Select(y => new AssigngingsDTO(y.EmployeeCodeNo,
                                                                                            y.EmployeeNameAr,
                                                                                            y.OrganizationName,
                                                                                            y.JobName,
                                                                                            y.RankCategoryName,
                                                                                            y.RankName,
                                                                                            y.Sorting
                                                                                            ));


                return(query.AsQueryable());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        //public List<ChartsAxis> GetQualificationsBasedOnAssigningsAsRanksCategories(int QualificationDegreeID, int QualificationID, int GeneralSpecializationID, int OrganizationID)
        //{
        //    try
        //    {
        //        List<int> OrganizationIDsList = new OrganizationsStructuresBLL().GetByOrganizationIDsWithhAllChilds(OrganizationID);

        //        // Get actual employees Based On Assignings by date
        //        List<vwActualEmployeesBasedOnAssignings> ActualEmployeesBasedOnAssignings = new AssigningsDAL().GetActualEmployeeBasedOnAssignings().Where(x => OrganizationIDsList.Contains(x.OrganizationID.Value)).ToList();

        //        List<int> EmployeesCodesIDs = new List<int>();
        //        ActualEmployeesBasedOnAssignings.ForEach(x => EmployeesCodesIDs.Add(x.EmployeeCodeID));

        //        List<EmployeesQualificationsBLL> EmployeesQualificationsList = new EmployeesQualificationsBLL().GetEmployeesQualifications(EmployeesCodesIDs);

        //        List<EmployeesQualificationsBLL> EmployeesQualificationsOfActualEmployeesList = new List<EmployeesQualificationsBLL>();

        //        ActualEmployeesBasedOnAssignings.ForEach(x => EmployeesQualificationsOfActualEmployeesList.Add(new EmployeesQualificationsBLL().GetLastEmployeeQualification(EmployeesQualificationsList, x.EmployeeCodeID)));

        //        EmployeesQualificationsOfActualEmployeesList = EmployeesQualificationsOfActualEmployeesList.Where(x => x.QualificationDegree.QualificationDegreeID == QualificationDegreeID
        //                                                                                                            && (QualificationID != 0 ? x.Qualification.QualificationID == QualificationID : x.Qualification.QualificationID == x.Qualification.QualificationID)
        //                                                                                                            && (GeneralSpecializationID != 0 ? x.GeneralSpecialization.GeneralSpecializationID == GeneralSpecializationID : x.GeneralSpecialization.GeneralSpecializationID == x.GeneralSpecialization.GeneralSpecializationID)).ToList();

        //        ActualEmployeesBasedOnAssignings.RemoveAll(x => !EmployeesQualificationsOfActualEmployeesList.Any(y => y.EmployeeCode.EmployeeCodeID == x.EmployeeCodeID));

        //        var query = ActualEmployeesBasedOnAssignings.GroupBy(x => x.RankCategoryName)
        //                                                    .Select(y => new
        //                                                    {
        //                                                        RankCategoryName = y.Key,
        //                                                        RecordCount = y.Count()
        //                                                    }).ToList();

        //        List<ChartsAxis> ChartAxisList = new List<ChartsAxis>();
        //        foreach (var item in query)
        //            ChartAxisList.Add(new ChartsAxis { KeyName = item.RankCategoryName, Value = item.RecordCount });

        //        return ChartAxisList;
        //    }
        //    catch
        //    {
        //        throw;
        //    }
        //}

        public IQueryable <EmployeesQualificationBasedOnAssigngingsDTO> GetQualificationsBasedOnAssigningsAsRanksCategoriesDetails(int QualificationDegreeID, int QualificationID, int GeneralSpecializationID, int OrganizationID)
        {
            try
            {
                List <int> OrganizationIDsList = new OrganizationsStructuresBLL().GetByOrganizationIDsWithhAllChilds(OrganizationID);

                // Get actual employees Based On Assignings by date
                List <vwActualEmployeesBasedOnAssignings> ActualEmployeesBasedOnAssignings = new AssigningsDAL().GetActualEmployeeBasedOnAssignings().Where(x => OrganizationIDsList.Contains(x.OrganizationID.Value)).ToList();

                List <int> EmployeesCodesIDs = new List <int>();
                ActualEmployeesBasedOnAssignings.ForEach(x => EmployeesCodesIDs.Add(x.EmployeeCodeID));

                List <EmployeesQualificationsBLL> EmployeesQualificationsList = new EmployeesQualificationsBLL().GetEmployeesQualifications(EmployeesCodesIDs);

                List <EmployeesQualificationsBLL> EmployeesQualificationsOfActualEmployeesList = new List <EmployeesQualificationsBLL>();

                ActualEmployeesBasedOnAssignings.ForEach(x => EmployeesQualificationsOfActualEmployeesList.Add(new EmployeesQualificationsBLL().GetLastEmployeeQualification(EmployeesQualificationsList, x.EmployeeCodeID)));

                EmployeesQualificationsOfActualEmployeesList = EmployeesQualificationsOfActualEmployeesList.Where(x => x.QualificationDegree.QualificationDegreeID == QualificationDegreeID &&
                                                                                                                  (QualificationID != 0 ? x.Qualification.QualificationID == QualificationID : x.Qualification.QualificationID == x.Qualification.QualificationID) &&
                                                                                                                  (GeneralSpecializationID != 0 ? x.GeneralSpecialization.GeneralSpecializationID == GeneralSpecializationID : x.GeneralSpecialization.GeneralSpecializationID == x.GeneralSpecialization.GeneralSpecializationID)).ToList();

                ActualEmployeesBasedOnAssignings.RemoveAll(x => !EmployeesQualificationsOfActualEmployeesList.Any(y => y.EmployeeCode.EmployeeCodeID == x.EmployeeCodeID));

                var query = ActualEmployeesBasedOnAssignings.Select(y => new EmployeesQualificationBasedOnAssigngingsDTO(y.EmployeeCodeNo,
                                                                                                                         y.EmployeeNameAr,
                                                                                                                         y.OrganizationName,
                                                                                                                         y.JobName,
                                                                                                                         y.RankCategoryName,
                                                                                                                         y.RankName,
                                                                                                                         EmployeesQualificationsOfActualEmployeesList.FirstOrDefault(x => x.EmployeeCode.EmployeeCodeID == y.EmployeeCodeID).QualificationDegree.QualificationDegreeName,
                                                                                                                         EmployeesQualificationsOfActualEmployeesList.FirstOrDefault(x => x.EmployeeCode.EmployeeCodeID == y.EmployeeCodeID).Qualification.QualificationName,
                                                                                                                         EmployeesQualificationsOfActualEmployeesList.FirstOrDefault(x => x.EmployeeCode.EmployeeCodeID == y.EmployeeCodeID).GeneralSpecialization.GeneralSpecializationName,
                                                                                                                         y.Sorting
                                                                                                                         ));

                return(query.AsQueryable());
            }
            catch
            {
                throw;
            }
        }