public FairValueBasisExemptionData[] GetAllFairValueBasisExemptions() { return(ExecuteFaultHandledOperation(() => { var groupNames = new List <string>() { GROUP_ADMINISTRATOR, GROUP_USER }; AllowAccessToOperation(SOLUTION_NAME, groupNames); IFairValueBasisExemptionRepository fairValueBasisExemptionRepository = _DataRepositoryFactory.GetDataRepository <IFairValueBasisExemptionRepository>(); List <FairValueBasisExemptionData> fairValueBasisExemptions = new List <FairValueBasisExemptionData>(); IEnumerable <FairValueBasisExemption> fairValueBasisExemptionInfo = fairValueBasisExemptionRepository.Get().ToArray(); foreach (var fairValueBasisExemption in fairValueBasisExemptionInfo) { fairValueBasisExemptions.Add( new FairValueBasisExemptionData { FairValueBasisExemptionId = fairValueBasisExemption.EntityId, BasisLevel = fairValueBasisExemption.BasisLevel, RefNo = fairValueBasisExemption.RefNo, InstrumentType = fairValueBasisExemption.InstrumentType, InstrumentTypeName = fairValueBasisExemption.InstrumentType.ToString(), CompanyCode = fairValueBasisExemption.CompanyCode, Active = fairValueBasisExemption.Active }); } return fairValueBasisExemptions.ToArray(); })); }
public FairValueBasisExemption UpdateFairValueBasisExemption(FairValueBasisExemption fairValueBasisExemption) { return(ExecuteFaultHandledOperation(() => { var groupNames = new List <string>() { GROUP_ADMINISTRATOR }; AllowAccessToOperation(SOLUTION_NAME, groupNames); IFairValueBasisExemptionRepository fairValueBasisExemptionRepository = _DataRepositoryFactory.GetDataRepository <IFairValueBasisExemptionRepository>(); FairValueBasisExemption updatedEntity = null; if (fairValueBasisExemption.FairValueBasisExemptionId == 0) { updatedEntity = fairValueBasisExemptionRepository.Add(fairValueBasisExemption); } else { updatedEntity = fairValueBasisExemptionRepository.Update(fairValueBasisExemption); } return updatedEntity; })); }
public void DeleteFairValueBasisExemption(int fairValueBasisExemptionId) { ExecuteFaultHandledOperation(() => { var groupNames = new List <string>() { GROUP_ADMINISTRATOR }; AllowAccessToOperation(SOLUTION_NAME, groupNames); IFairValueBasisExemptionRepository fairValueBasisExemptionRepository = _DataRepositoryFactory.GetDataRepository <IFairValueBasisExemptionRepository>(); fairValueBasisExemptionRepository.Remove(fairValueBasisExemptionId); }); }
public FairValueBasisExemption GetFairValueBasisExemption(int fairValueBasisExemptionId) { return(ExecuteFaultHandledOperation(() => { var groupNames = new List <string>() { GROUP_ADMINISTRATOR, GROUP_USER }; AllowAccessToOperation(SOLUTION_NAME, groupNames); IFairValueBasisExemptionRepository fairValueBasisExemptionRepository = _DataRepositoryFactory.GetDataRepository <IFairValueBasisExemptionRepository>(); FairValueBasisExemption fairValueBasisExemptionEntity = fairValueBasisExemptionRepository.Get(fairValueBasisExemptionId); if (fairValueBasisExemptionEntity == null) { NotFoundException ex = new NotFoundException(string.Format("FairValueBasisExemption with ID of {0} is not in database", fairValueBasisExemptionId)); throw new FaultException <NotFoundException>(ex, ex.Message); } return fairValueBasisExemptionEntity; })); }