Beispiel #1
0
        public TeamSetting UpdateTeamSetting(TeamSetting teamSetting)
        {
            return(ExecuteFaultHandledOperation(() =>
            {
                var groupNames = new List <string>()
                {
                    BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS
                };
                AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames);

                ITeamSettingRepository teamSettingRepository = _DataRepositoryFactory.GetDataRepository <ITeamSettingRepository>();

                TeamSetting updatedEntity = null;

                if (teamSetting.TeamSettingId == 0)
                {
                    updatedEntity = teamSettingRepository.Add(teamSetting);
                }
                else
                {
                    updatedEntity = teamSettingRepository.Update(teamSetting);
                }

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

                ITeamSettingRepository teamSettingRepository = _DataRepositoryFactory.GetDataRepository <ITeamSettingRepository>();

                teamSettingRepository.Remove(teamSettingId);
            });
        }
Beispiel #3
0
        public TeamSetting[] GetAllTeamSettings()
        {
            return(ExecuteFaultHandledOperation(() =>
            {
                var groupNames = new List <string>()
                {
                    BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS
                };
                AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames);

                ITeamSettingRepository teamSettingRepository = _DataRepositoryFactory.GetDataRepository <ITeamSettingRepository>();

                IEnumerable <TeamSetting> teamSettings = teamSettingRepository.Get().ToArray();

                return teamSettings.ToArray();
            }));
        }
Beispiel #4
0
        public TeamSetting GetTeamSetting(int teamSettingId)
        {
            return(ExecuteFaultHandledOperation(() =>
            {
                var groupNames = new List <string>()
                {
                    BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS
                };
                AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames);

                ITeamSettingRepository teamSettingRepository = _DataRepositoryFactory.GetDataRepository <ITeamSettingRepository>();

                TeamSetting teamSettingEntity = teamSettingRepository.Get(teamSettingId);
                if (teamSettingEntity == null)
                {
                    NotFoundException ex = new NotFoundException(string.Format("TeamSetting with ID of {0} is not in database", teamSettingId));
                    throw new FaultException <NotFoundException>(ex, ex.Message);
                }

                return teamSettingEntity;
            }));
        }