public List <EServicesAuthorizationsBLL> GetFirstLevel(int OrganizationID, EServicesTypesEnum EServiceTypeID)
        {
            try
            {
                List <int> ChildOrganizationIDs = new OrganizationsStructuresBLL().GetOrganizationFirstLevelByID(OrganizationID); //new List<int>(); ChildOrganizationIDs.Add(1803); //
                List <EServicesAuthorizations>    EServiceAuthorizationList     = new EServicesAuthorizationsDAL().GetOrganizationsByOrganizationIDs(ChildOrganizationIDs, (int)EServiceTypeID);
                List <EServicesAuthorizationsBLL> EServicesAuthorizationBLLList = new List <EServicesAuthorizationsBLL>();

                foreach (var item in EServiceAuthorizationList)
                {
                    EServicesAuthorizationBLLList.Add(new EServicesAuthorizationsBLL()
                    {
                        EServiceAuthorizationID = item.EServiceAuthorizationID,
                        //AuthorizedPerson = new EmployeesCodesBLL()
                        //{
                        //    EmployeeCodeNo = item.AuthorizedPersonNav.EmployeeCodeNo,
                        //    Employee = new EmployeesBLL()
                        //    {
                        //        FirstNameAr = item.AuthorizedPersonNav.Employees.FirstNameAr,
                        //        MiddleNameAr = item.AuthorizedPersonNav.Employees.MiddleNameAr,
                        //        GrandFatherNameAr = item.AuthorizedPersonNav.Employees.GrandFatherNameAr,
                        //        LastNameAr = item.AuthorizedPersonNav.Employees.LastNameAr,
                        //    }
                        //},
                        //Organization = new OrganizationsStructuresBLL()
                        //{
                        //    OrganizationID = item.OrganizationsStructures.OrganizationID,
                        //    ParentOrganization = item.OrganizationsStructures.ParentOrganization == null ? null : new OrganizationsStructuresBLL()
                        //    {
                        //        OrganizationID = item.OrganizationsStructures.ParentOrganization.OrganizationID
                        //    },
                        //    OrganizationName = item.OrganizationsStructures.OrganizationName,
                        //    Branch = new BranchesBLL().MapBranch(item.OrganizationsStructures.Branches),
                        //    OrganizationManager = item.OrganizationsStructures.EmployeesCodes != null ? new EmployeesCodesBLL()
                        //    {
                        //        EmployeeCodeID = item.OrganizationsStructures.EmployeesCodes.EmployeeCodeID,
                        //        EmployeeCodeNo = item.OrganizationsStructures.EmployeesCodes.EmployeeCodeNo,
                        //        Employee = new EmployeesBLL()
                        //        {
                        //            FirstNameAr = item.OrganizationsStructures.EmployeesCodes.Employees.FirstNameAr,
                        //            MiddleNameAr = item.OrganizationsStructures.EmployeesCodes.Employees.MiddleNameAr,
                        //            GrandFatherNameAr = item.OrganizationsStructures.EmployeesCodes.Employees.GrandFatherNameAr,
                        //            LastNameAr = item.OrganizationsStructures.EmployeesCodes.Employees.LastNameAr,
                        //        },
                        //    } : null,
                        //},
                        AuthorizedPerson = new EmployeesCodesBLL().MapEmployeeCode(item.AuthorizedPersonNav),
                        Organization     = new OrganizationsStructuresBLL().MapOrganization(item.OrganizationsStructures),
                        EServiceType     = new EServicesTypesBLL().MapEServicesTypes(item.EServicesTypes)
                    });
                }

                return(EServicesAuthorizationBLLList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#2
0
        public List <EServicesProxiesBLL> Get(EServicesTypesEnum EServiceType)
        {
            try
            {
                List <EServicesProxies>    EServiceProxyList    = new EServicesProxiesDAL().Get((int)EServiceType).ToList();
                List <EServicesProxiesBLL> EServiceProxyBLLList = new List <EServicesProxiesBLL>();

                foreach (EServicesProxies item in EServiceProxyList)
                {
                    EServiceProxyBLLList.Add(this.MapEServiceProxy(item));
                }

                return(EServiceProxyBLLList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public EServicesAuthorizationsBLL GetByOrganizationID(int OrganizationID, EServicesTypesEnum EServiceTypeID)
        {
            try
            {
                EServicesAuthorizations    EServiceAuthorization    = new EServicesAuthorizationsDAL().GetByOrganizationID(OrganizationID, (int)EServiceTypeID);
                EServicesAuthorizationsBLL EServiceAuthorizationBLL = new EServicesAuthorizationsBLL();

                EServiceAuthorizationBLL = new EServicesAuthorizationsBLL()
                {
                    EServiceAuthorizationID = EServiceAuthorization.EServiceAuthorizationID,
                    AuthorizedPerson        = new EmployeesCodesBLL().MapEmployeeCode(EServiceAuthorization.AuthorizedPersonNav),
                    Organization            = new OrganizationsStructuresBLL().MapOrganization(EServiceAuthorization.OrganizationsStructures),
                    EServiceType            = new EServicesTypesBLL().MapEServicesTypes(EServiceAuthorization.EServicesTypes)
                };

                return(EServiceAuthorizationBLL);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#4
0
        /// <summary>
        /// Get Active Proxy based on Creator Employee and ServiceType
        /// </summary>
        /// <param name="FromEmployeeCodeID"></param>
        /// <param name="EServiceType"></param>
        /// <returns></returns>
        public EServicesProxiesBLL GetActiveByFromEmployeeCodeID(int FromEmployeeCodeID, EServicesTypesEnum EServiceType)
        {
            try
            {
                EServicesProxies EServiceProxy
                    = new EServicesProxiesDAL().GetByFromEmployeeCodeID(FromEmployeeCodeID, (int)EServiceType)
                      .FirstOrDefault(x => x.IsActive == true);

                return(this.MapEServiceProxy(EServiceProxy));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// get authorized person to specific organization and e service type
        /// </summary>
        /// <param name="OrganizationID"></param>
        /// <param name="EServiceType"></param>
        /// <returns></returns>
        public EServicesAuthorizationsBLL GetOrganizationAuthorizedPerson(int OrganizationID, EServicesTypesEnum EServiceType)
        {
            try
            {
                EServicesAuthorizations    EServiceAuthorization     = new EServicesAuthorizationsDAL().Get(OrganizationID, (int)EServiceType).FirstOrDefault();
                EServicesAuthorizationsBLL EServicesAuthorizationBLL = null;
                if (EServiceAuthorization != null)
                {
                    EServicesAuthorizationBLL = new EServicesAuthorizationsBLL()
                    {
                        AuthorizedPerson = new EmployeesCodesBLL().MapEmployeeCode(EServiceAuthorization.AuthorizedPersonNav),
                        Organization     = new OrganizationsStructuresBLL().MapOrganizationWithoutManager(EServiceAuthorization.OrganizationsStructures),
                        EServiceType     = new EServicesTypesBLL()
                        {
                            EServiceTypeID = EServiceAuthorization.EServiceTypeID, EServiceTypeName = EServiceAuthorization.EServicesTypes.EServiceTypeName
                        }
                    }
                }
                ;

                return(EServicesAuthorizationBLL);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// get all organizations under person authorizations and service type
        /// </summary>
        /// <param name="AuthorizedPersonCodeNo"></param>
        /// <param name="EServiceType"></param>
        /// <returns></returns>
        public List <EServicesAuthorizationsBLL> GetBasedOnAuthorizedPerson(string AuthorizedPersonCodeNo, EServicesTypesEnum EServiceType)
        {
            try
            {
                List <EServicesAuthorizations>    EServiceAuthorizationList     = new EServicesAuthorizationsDAL().GetOrganizations(AuthorizedPersonCodeNo, (int)EServiceType);
                List <EServicesAuthorizationsBLL> EServicesAuthorizationBLLList = new List <EServicesAuthorizationsBLL>();
                foreach (var item in EServiceAuthorizationList)
                {
                    EServicesAuthorizationBLLList.Add(new EServicesAuthorizationsBLL()
                    {
                        AuthorizedPerson = new EmployeesCodesBLL().MapEmployeeCode(item.AuthorizedPersonNav),
                        Organization     = new OrganizationsStructuresBLL().MapOrganizationWithoutManager(item.OrganizationsStructures),
                        EServiceType     = new EServicesTypesBLL()
                        {
                            EServiceTypeID = item.EServiceTypeID, EServiceTypeName = item.EServicesTypes.EServiceTypeName
                        }
                    });
                }

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