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; })); }
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); }); }
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(); })); }
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; })); }