コード例 #1
0
        public ModifyPosSimProviderResponse ModifyPosSimProvider(ModifyPosSimProviderRequest request)
        {
            ModifyPosSimProviderResponse response = new ModifyPosSimProviderResponse();

            PosSimProvider posSimProvider = _posSimProviderRepository
                                            .FindBy(request.SimProviderId);

            posSimProvider.Id = request.SimProviderId;
            posSimProvider.SimProviderName = request.SimProviderName;
            posSimProvider.PosSims         = request.PosSims.ConvertToPosSims();


            if (posSimProvider.GetBrokenRules().Count() > 0)
            {
                response.Errors = posSimProvider.GetBrokenRules().ToList();
            }
            else
            {
                try {
                    _posSimProviderRepository.Save(posSimProvider);
                    _uow.Commit();
                    response.Errors = new List <BusinessRule>();
                } catch (Exception ex)
                {
                    response.Errors = new List <BusinessRule>();
                    response.Errors.Add(new BusinessRule("DAL", "DAL_ERROR: " + ex.Message));
                }
            }


            return(response);
        }
コード例 #2
0
        public CreatePosSimProviderResponse CreatePosSimProvider(CreatePosSimProviderRequest request)
        {
            CreatePosSimProviderResponse response = new CreatePosSimProviderResponse();
            PosSimProvider posSimProvider         = new PosSimProvider();

            posSimProvider.SimProviderName = request.SimProviderName;
            posSimProvider.PosSims         = request.PosSims.ConvertToPosSims();

            if (posSimProvider.GetBrokenRules().Count() > 0)
            {
                response.Errors = posSimProvider.GetBrokenRules().ToList();
            }
            else
            {
                try {
                    _posSimProviderRepository.Add(posSimProvider);
                    _uow.Commit();
                    response.Errors = new List <BusinessRule>();
                } catch (Exception ex)
                {
                    List <BusinessRule> errors = new List <BusinessRule>();
                    do
                    {
                        errors.Add(new BusinessRule("DAL", "DAL_ERROR: " + ex.Message));
                        ex = ex.InnerException;
                    } while (ex != null);

                    response.Errors = errors;
                }
            }

            return(response);
        }
コード例 #3
0
        public GetPosSimProviderResponse GetPosSimProvider(GetPosSimProviderRequest request)
        {
            GetPosSimProviderResponse response = new GetPosSimProviderResponse();

            PosSimProvider posSimProvider = _posSimProviderRepository
                                            .FindBy(request.SimProviderId);

            if (posSimProvider != null)
            {
                response.PosSimProviderFound = true;
                response.PosSimProvider      = posSimProvider.ConvertToPosSimProviderView();
            }
            else
            {
                response.PosSimProviderFound = false;
            }


            return(response);
        }
コード例 #4
0
 public static PosSimProviderView ConvertToPosSimProviderView(
     this PosSimProvider posSimProvider)
 {
     return(Mapper.Map <PosSimProvider,
                        PosSimProviderView>(posSimProvider));
 }