internal BaseAssigningsBLL MapAssigning(Assignings Assigning) { try { BaseAssigningsBLL AssigningBLL = null; if (Assigning != null) { if (Assigning.AssigningTypID == (Int32)AssigningsTypesEnum.Internal) { AssigningBLL = new InternalAssigningBLL() { Job = new JobsBLL().MapJob(Assigning.Jobs), Organization = new OrganizationsStructuresBLL().MapOrganization(Assigning.OrganizationsStructures), Manager = new EmployeesCodesBLL().MapEmployeeCode(Assigning.ManagerCode) }; ((InternalAssigningBLL)AssigningBLL).Organization.FullOrganizationName = new OrganizationsStructuresBLL().GetOrganizationNameTillLastParentExceptPresident(((InternalAssigningBLL)AssigningBLL).Organization.OrganizationID); } else if (Assigning.AssigningTypID == (Int32)AssigningsTypesEnum.External) { AssigningBLL = new ExternalAssigningBLL() { ExternalKSACity = new KSACitiesBLL().MapKSACity(Assigning.KSACities), ExternalOrganization = Assigning.ExternalOrganization, }; } AssigningBLL.AssigningID = Assigning.AssigningID; AssigningBLL.AssigningStartDate = Assigning.AssigningStartDate; AssigningBLL.AssigningEndDate = Assigning.AssigningEndDate; AssigningBLL.AssigningType = new AssigningsTypesBLL().MapAssigningType(Assigning.AssigningsTypes); AssigningBLL.EmployeeCareerHistory = new EmployeesCareersHistoryBLL().MapEmployeeCareerHistory(Assigning.EmployeesCareersHistory); AssigningBLL.IsFinished = Assigning.IsFinished; AssigningBLL.AssigningReason = new AssigningsReasonsBLL().MapAssigningReason(Assigning.AssigningsReasons); AssigningBLL.AssigningReasonOther = "" + Assigning.AssigningReasonOther; AssigningBLL.CreatedDate = Assigning.CreatedDate; AssigningBLL.CreatedBy = new EmployeesCodesBLL().MapEmployeeCode(Assigning.CreatedByNav); } return(AssigningBLL); } catch (Exception ex) { throw ex; } }
public List <PlacementBLL> GetOrganizationsPlacement(int OrgnizationID) { try { List <PlacementBLL> PlacementBLLList = new List <PlacementBLL>(); List <InternalAssigningBLL> AssigningBLLList = new InternalAssigningBLL().Get(); List <OrganizationsStructuresBLL> OrganizationsBLLList = new OrganizationsStructuresBLL().GetByOrganizationIDWithhAllChilds(OrgnizationID); foreach (var item in OrganizationsBLLList) { PlacementBLLList.Add(new PlacementBLL() { Organization = item, EmployeesPlacedCount = AssigningBLLList.Where(x => x.Organization.OrganizationID == item.OrganizationID).Count() }); } return(PlacementBLLList); } catch (Exception) { throw; } }
/// <summary> /// get Actual Org and Actual Job from organization structure module if he is a manager, but if he is a normal employee, get from internal assignings module /// </summary> /// <param name="EmployeeCodeNo"></param> /// <returns></returns> public PlacementBLL GetCurrentActualOrgAndActualJob(string EmployeeCodeNo) { try { PlacementBLL CurrentOrgAndJob = null; OrganizationsStructuresBLL OrganizationsStructureBasedOnManagement = new OrganizationsStructuresBLL().GetAllOrganizationsForManagerByManagerCodeNo(EmployeeCodeNo)?.FirstOrDefault(); if (OrganizationsStructureBasedOnManagement != null) { OrganizationsStructureBasedOnManagement.FullOrganizationName = new OrganizationsStructuresBLL().GetOrganizationNameTillLastParentExceptPresident(OrganizationsStructureBasedOnManagement.OrganizationID); CurrentOrgAndJob = new PlacementBLL() { Organization = OrganizationsStructureBasedOnManagement, Job = new JobsBLL() { JobName = Globalization.ManagerText + " " + OrganizationsStructureBasedOnManagement.OrganizationName } }; } else { BaseAssigningsBLL CurrentAssigningRecord = new InternalAssigningBLL().GetEmployeeActiveAssigning(EmployeeCodeNo); if (CurrentAssigningRecord != null) { CurrentOrgAndJob = new PlacementBLL() { Organization = ((InternalAssigningBLL)CurrentAssigningRecord).Organization, Job = ((InternalAssigningBLL)CurrentAssigningRecord).Job } } ; } return(CurrentOrgAndJob); } catch (Exception ex) { throw ex; } }