コード例 #1
0
        public OfficerDetail UpdateOfficerDetail(OfficerDetail officerDetail)
        {
            return(ExecuteFaultHandledOperation(() =>
            {
                var groupNames = new List <string>()
                {
                    BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS
                };
                AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames);

                IOfficerDetailRepository officerDetailRepository = _DataRepositoryFactory.GetDataRepository <IOfficerDetailRepository>();

                OfficerDetail updatedEntity = null;

                if (officerDetail.OfficerDetailId == 0)
                {
                    updatedEntity = officerDetailRepository.Add(officerDetail);
                }
                else
                {
                    updatedEntity = officerDetailRepository.Update(officerDetail);
                }

                return updatedEntity;
            }));
        }
コード例 #2
0
        public void DeleteOfficerDetail(int officerDetailId)
        {
            ExecuteFaultHandledOperation(() =>
            {
                var groupNames = new List <string>()
                {
                    BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS
                };
                AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames);

                IOfficerDetailRepository officerDetailRepository = _DataRepositoryFactory.GetDataRepository <IOfficerDetailRepository>();

                officerDetailRepository.Remove(officerDetailId);
            });
        }
コード例 #3
0
        public OfficerDetail[] GetAllOfficerDetails()
        {
            return(ExecuteFaultHandledOperation(() =>
            {
                var groupNames = new List <string>()
                {
                    BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS
                };
                AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames);

                IOfficerDetailRepository officerDetailRepository = _DataRepositoryFactory.GetDataRepository <IOfficerDetailRepository>();

                IEnumerable <OfficerDetail> officerDetails = officerDetailRepository.Get().ToArray();

                return officerDetails.ToArray();
            }));
        }
コード例 #4
0
        public OfficerDetail GetOfficerDetail(int officerDetailId)
        {
            return(ExecuteFaultHandledOperation(() =>
            {
                var groupNames = new List <string>()
                {
                    BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS
                };
                AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames);

                IOfficerDetailRepository officerDetailRepository = _DataRepositoryFactory.GetDataRepository <IOfficerDetailRepository>();

                OfficerDetail officerDetailEntity = officerDetailRepository.Get(officerDetailId);
                if (officerDetailEntity == null)
                {
                    NotFoundException ex = new NotFoundException(string.Format("OfficerDetail with ID of {0} is not in database", officerDetailId));
                    throw new FaultException <NotFoundException>(ex, ex.Message);
                }

                return officerDetailEntity;
            }));
        }