Пример #1
0
        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();
            }));
        }
Пример #2
0
        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;
            }));
        }
Пример #3
0
        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);
            });
        }
Пример #4
0
        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;
            }));
        }