예제 #1
0
        public TeamClassification UpdateTeamClassification(TeamClassification teamClassification)
        {
            return(ExecuteFaultHandledOperation(() =>
            {
                var groupNames = new List <string>()
                {
                    BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS
                };
                AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames);

                ITeamClassificationRepository teamClassificationRepository = _DataRepositoryFactory.GetDataRepository <ITeamClassificationRepository>();

                TeamClassification updatedEntity = null;

                if (teamClassification.TeamClassificationId == 0)
                {
                    updatedEntity = teamClassificationRepository.Add(teamClassification);
                }
                else
                {
                    updatedEntity = teamClassificationRepository.Update(teamClassification);
                }

                return updatedEntity;
            }));
        }
예제 #2
0
        public void DeleteTeamClassification(int teamClassificationId)
        {
            ExecuteFaultHandledOperation(() =>
            {
                var groupNames = new List <string>()
                {
                    BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS
                };
                AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames);

                ITeamClassificationRepository teamClassificationRepository = _DataRepositoryFactory.GetDataRepository <ITeamClassificationRepository>();

                teamClassificationRepository.Remove(teamClassificationId);
            });
        }
예제 #3
0
        public TeamClassification[] GetAllTeamClassifications()
        {
            return(ExecuteFaultHandledOperation(() =>
            {
                var groupNames = new List <string>()
                {
                    BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS
                };
                AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames);

                ITeamClassificationRepository teamClassificationRepository = _DataRepositoryFactory.GetDataRepository <ITeamClassificationRepository>();

                IEnumerable <TeamClassification> teamClassification = teamClassificationRepository.Get().ToArray();

                return teamClassification.ToArray();
            }));
        }
예제 #4
0
        public TeamClassification GetTeamClassification(int teamClassificationId)
        {
            return(ExecuteFaultHandledOperation(() =>
            {
                var groupNames = new List <string>()
                {
                    BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS
                };
                AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames);

                ITeamClassificationRepository teamClassificationRepository = _DataRepositoryFactory.GetDataRepository <ITeamClassificationRepository>();

                TeamClassification teamClassificationEntity = teamClassificationRepository.Get(teamClassificationId);
                if (teamClassificationEntity == null)
                {
                    NotFoundException ex = new NotFoundException(string.Format("TeamClassification with ID of {0} is not in database", teamClassificationId));
                    throw new FaultException <NotFoundException>(ex, ex.Message);
                }

                return teamClassificationEntity;
            }));
        }