Пример #1
0
        public async Task <List <RoleModel> > GetUserRolesById(string userName, string agencyCode, int CommitteeTypeId, UsersSearchCriteriaModel searchCriteria)
        {
            searchCriteria.PageSize = 100;
            searchCriteria.NationalIds.Add(userName);
            var result = await _iDMAppService.GetMonafasatUsers(searchCriteria);

            var employeeList = result.Items;
            var employee     = employeeList.FirstOrDefault(d => d.nationalId == userName);

            if (CommitteeTypeId == 0 && employee.roles != null && employee.roles.Any())
            {
                return(employee.roles.Where(r => r != null && (r.RoleName == RoleNames.PurshaseSpecialist.ToString() || r.RoleName == RoleNames.EtimadOfficer.ToString() || r.RoleName == RoleNames.PrePlanningAuditor.ToString() || r.RoleName == RoleNames.PrePlanningCreator.ToString() || r.RoleName == RoleNames.Auditer.ToString() || r.RoleName == RoleNames.ApproveTenderAward.ToString() || r.RoleName == RoleNames.DataEntry.ToString())).Select(d => new RoleModel {
                    RoleId = d.RoleId, RoleName = d.RoleName, RoleNameAr = d.RoleNameAr
                }).ToList());
            }
            else if (CommitteeTypeId == (int)Enums.CommitteeType.CheckOfferCommittee)
            {
                return(employee.roles.Where(r => r != null && (r.RoleName == RoleNames.OffersCheckManager.ToString() || r.RoleName == RoleNames.OffersCheckSecretary.ToString())).Select(r => new RoleModel {
                    RoleId = r.RoleId, RoleName = r.RoleName, RoleNameAr = r.RoleNameAr
                }).ToList());
            }
            else if (CommitteeTypeId == (int)Enums.CommitteeType.OpenOfferCommittee)
            {
                return(employee.roles.Where(r => r != null && (r.RoleName == RoleNames.OffersOppeningManager.ToString() || r.RoleName == RoleNames.OffersOppeningSecretary.ToString())).Select(r => new RoleModel {
                    RoleId = r.RoleId, RoleName = r.RoleName, RoleNameAr = r.RoleNameAr
                }).ToList());
            }
            else if (CommitteeTypeId == (int)Enums.CommitteeType.TechincalCommittee)
            {
                return(employee.roles.Where(r => r != null && r.RoleName == RoleNames.TechnicalCommitteeUser.ToString()).Select(r => new RoleModel {
                    RoleId = r.RoleId, RoleName = r.RoleName, RoleNameAr = r.RoleNameAr
                }).ToList());
            }
            else if (CommitteeTypeId == (int)Enums.CommitteeType.PreQualificationCommittee)
            {
                return(employee.roles.Where(r => r != null && (r.RoleName == RoleNames.PreQualificationCommitteeManager.ToString() || r.RoleName == RoleNames.PreQualificationCommitteeSecretary.ToString())).Select(r => new RoleModel {
                    RoleId = r.RoleId, RoleName = r.RoleName, RoleNameAr = r.RoleNameAr
                }).ToList());
            }
            else if (CommitteeTypeId == (int)Enums.CommitteeType.PurchaseCommittee)
            {
                return(employee.roles.Where(r => r != null && (r.RoleName == RoleNames.OffersPurchaseManager.ToString() || r.RoleName == RoleNames.OffersPurchaseSecretary.ToString())).Select(r => new RoleModel {
                    RoleId = r.RoleId, RoleName = r.RoleName, RoleNameAr = r.RoleNameAr
                }).ToList());
            }
            else if (CommitteeTypeId == (int)Enums.CommitteeType.VROCommittee)
            {
                return(employee.roles.Where(r => r != null && (r.RoleName == RoleNames.OffersOpeningAndCheckManager.ToString() || r.RoleName == RoleNames.OffersOpeningAndCheckSecretary.ToString())).Select(r => new RoleModel {
                    RoleId = r.RoleId, RoleName = r.RoleName, RoleNameAr = r.RoleNameAr
                }).ToList());
            }
            else
            {
                return(null);
            }
        }
Пример #2
0
        public async Task <QueryResult <ManageUsersAssignationModel> > Find(UsersSearchCriteriaModel userSearchCriteriaModel)
        {
            if (User.IsInRole(RoleNames.UnitSpecialistLevel1) || User.IsInRole(RoleNames.UnitSpecialistLevel2) || User.IsInRole(RoleNames.UnitManagerUser) || User.IsInRole(RoleNames.UnitBusinessManagement))
            {
                userSearchCriteriaModel.RoleName = RoleNames.OffersCheckSecretary;
            }

            userSearchCriteriaModel = await GetUserAgencyTypeAndIdWithFlags(userSearchCriteriaModel);

            var employeeList = await _iDMAppService.GetMonafasatUsers(userSearchCriteriaModel);

            return(employeeList);
        }