Example #1
0
        public List <EVacationsRequestsBLL> GetPendingEVacationsRequestsByAuthorizedPerson(string AuthorizedPersonCodeNo)
        {
            try
            {
                List <EServicesAuthorizationsBLL> OrganizationsList = new EServicesAuthorizationsBLL().GetBasedOnAuthorizedPerson(AuthorizedPersonCodeNo, EServicesTypesEnum.Vacation);
                List <int> OrganizationsIDs = new List <int>();
                OrganizationsList.ForEach(x => OrganizationsIDs.Add(x.Organization.OrganizationID));

                #region Get evacations requests of normal employees
                List <EVacationsRequests>    EVacationsRequestsList    = new EVacationsRequestsDAL().GetEVacationsRequestsByOrganizations(OrganizationsIDs).Where(x => x.EVacationRequestStatusID == (int)EVacationRequestStatusEnum.Pending).ToList();
                List <EVacationsRequestsBLL> EVacationsRequestsBLLList = new List <EVacationsRequestsBLL>();
                EVacationsRequestsList.ForEach(x => EVacationsRequestsBLLList.Add(MapEVacationRequest(x)));
                #endregion

                #region Get evacations requests of managers under him
                List <int> OrganizationIDList = new List <int>();
                new OrganizationsStructuresBLL().GetAllOrganizationsForManagerByManagerCodeNo(AuthorizedPersonCodeNo).ForEach(x => OrganizationIDList.Add(x.OrganizationID));
                //int? OrganizationID = new OrganizationsStructuresBLL().GetAllOrganizationsForManagerByManagerCodeNo(AuthorizedPersonCodeNo).FirstOrDefault()?.OrganizationID;
                foreach (var OrganizationID in OrganizationIDList)
                {
                    List <int> ChildOrganizationIDs = new OrganizationsStructuresBLL().GetOrganizationFirstLevelByID(OrganizationID);
                    List <EVacationsRequests> ChildOrganizationIDEVacationsRequestsList = new EVacationsRequestsDAL().GetEVacationsRequestsByOrganizations(ChildOrganizationIDs).Where(x => x.EVacationRequestStatusID == (int)EVacationRequestStatusEnum.Pending &&
                                                                                                                                                                                       !x.ActualJobID.HasValue) // thats mean is manager
                                                                                          .ToList();
                    ChildOrganizationIDEVacationsRequestsList.ForEach(x => EVacationsRequestsBLLList.Add(MapEVacationRequest(x)));
                }
                #endregion

                return(EVacationsRequestsBLLList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #2
0
        public List <EVacationsRequestsBLL> GetAllEVacationsRequests()
        {
            try
            {
                List <EVacationsRequests>    EVacationsRequestsList    = new EVacationsRequestsDAL().Get();
                List <EVacationsRequestsBLL> EVacationsRequestsBLLList = new List <EVacationsRequestsBLL>();
                EVacationsRequestsList.ForEach(x => EVacationsRequestsBLLList.Add(MapEVacationRequest(x)));

                return(EVacationsRequestsBLLList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #3
0
        public List <EVacationsRequestsBLL> GetEVacationsRequestsByEmployeeCodeNo(string EmployeeCodeNo)
        {
            try
            {
                List <EVacationsRequests>    EVacationsRequestsList    = new EVacationsRequestsDAL().GetByEmployeeCodeNo(EmployeeCodeNo);
                List <EVacationsRequestsBLL> EVacationsRequestsBLLList = new List <EVacationsRequestsBLL>();
                EVacationsRequestsList.ForEach(x => EVacationsRequestsBLLList.Add(MapEVacationRequest(x)));

                return(EVacationsRequestsBLLList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }