public PumpCategoryController(IService <PumpCategory> pumpCategoryService,
                               IMappingServiceProvider mapper,
                               ILogger logger) : base(logger)
 {
     _pumpCategoryService = pumpCategoryService;
     _mapper = mapper;
 }
        public void Configure(IMappingServiceProvider mappingServiceProvider)
        {
            mappingServiceProvider.RegisterByKey <string, List <Transaction> >("application/vnd.ms-excel", new Func <string, List <Transaction> >((input) =>
            {
                var result       = new List <Transaction>();
                var stringReader = new StringReader(input);

                var transactionLine = "";
                while ((transactionLine = stringReader.ReadLine()) != null)
                {
                    var splitted = transactionLine.Matches("(?<=\")(.*?)(?=\")").Where(value => value != ",").ToArray();

                    var transaction = new Transaction
                    {
                        TransactionId   = splitted[0],
                        Amount          = decimal.Parse(splitted[1]),
                        CurrencyCode    = (ISO4217CurrencyCode.Values)Enum.Parse(typeof(ISO4217CurrencyCode.Values), splitted[2]),
                        TransactionDate = DateTime.ParseExact(splitted[3], "dd/MM/yyyy hh:mm:ss", CultureInfo.InvariantCulture),
                        Status          = (TransactionStatus.Values)Enum.Parse(typeof(TransactionStatus.Values), splitted[4].ToUpper()),
                    };
                    result.Add(transaction);
                }

                return(result);
            }));
        }
예제 #3
0
 private RemoteApiRequest(IRemoteApiInfo api, IRemoteApiRepository apiRepository, IRemoteApiMethodInfo methodInfo, IMappingServiceProvider mapping)
 {
     _api           = api;
     _apiRepository = apiRepository;
     _methodInfo    = methodInfo;
     _mapping       = mapping;
 }
예제 #4
0
 public OutputController(OutputService outputService,
                         IMappingServiceProvider mapper,
                         ILogger logger) : base(logger)
 {
     _outputService = outputService;
     _mapper        = mapper;
 }
예제 #5
0
 public Mapper()
 {
     if (_mapper == null)
     {
         _mapper = ExpressMapper.Mapper.Instance;
         RegisterMaps();
     }
 }
예제 #6
0
 public ProductSubCategoryController(IService <ProductSubCategory> productSubCategoryService,
                                     IService <ProductCategory> productCategoryService,
                                     IMappingServiceProvider mapper,
                                     ILogger logger) : base(logger)
 {
     _productSubCategoryService = productSubCategoryService;
     _productCategoryService    = productCategoryService;
     _mapper = mapper;
 }
예제 #7
0
        protected override void InitializeRecursiveMappings(IMappingServiceProvider serviceProvider)
        {
            MethodInfo mapMethod = typeof(IMappingServiceProvider).GetInfo().GetMethods()
                                   .First(mi => mi.Name == "Map" && mi.GetParameters().Length == 1)
                                   .MakeGenericMethod(typeof(T), typeof(TN));

            MethodCallExpression methodCall = Expression.Call(Expression.Constant(serviceProvider), mapMethod, this.SourceParameter);

            this.RecursiveExpressionResult.Add(Expression.Assign(this.DestFakeParameter, methodCall));
        }
예제 #8
0
 protected TypeMapperBase(IMappingService service, IMappingServiceProvider serviceProvider)
 {
     ResultExpressionList      = new List <Expression>();
     RecursiveExpressionResult = new List <Expression>();
     PropertyCache             = new Dictionary <string, Expression>();
     CustomPropertyCache       = new Dictionary <string, Expression>();
     IgnoreMemberList          = new List <string>();
     MappingService            = service;
     InitializeRecursiveMappings(serviceProvider);
 }
예제 #9
0
 public AdminController(IService <Product> productService,
                        IService <Pump> pumpService,
                        IService <Output> outputService,
                        IMappingServiceProvider mapper,
                        ILogger logger) : base(logger)
 {
     _productService  = productService;
     this.pumpService = pumpService;
     _outputService   = outputService;
     _mapper          = mapper;
 }
예제 #10
0
        protected override void InitializeRecursiveMappings(IMappingServiceProvider serviceProvider)
        {
            var mapMethod =
                typeof(IMappingServiceProvider).GetMethods()
                .First(mi => mi.Name == MapStr && mi.GetParameters().Length == 2)
                .MakeGenericMethod(typeof(T), typeof(TN));

            var methodCall = Expression.Call(Expression.Constant(serviceProvider), mapMethod, SourceParameter, DestFakeParameter);

            RecursiveExpressionResult.Add(Expression.Assign(DestFakeParameter, methodCall));
        }
예제 #11
0
 public HomeController(IService <ProductCategory> productCategoryService,
                       IService <PumpCategory> pumpCategoryService,
                       IEmailSender emailSender,
                       ILogger logger,
                       IMappingServiceProvider mapper) : base(logger)
 {
     _productCategoryService = productCategoryService;
     _pumpCategoryService    = pumpCategoryService;
     _emailSender            = emailSender;
     _logger = logger;
     _mapper = mapper;
 }
예제 #12
0
        public void Configure(IMappingServiceProvider mappingServiceProvider)
        {
            mappingServiceProvider.RegisterByKey("text/xml", new Func <string, List <Transaction> >((input) =>
            {
                var result          = new List <Transaction>();
                var xmlDeserializer = new XmlSerializer(typeof(List <Transaction>));

                var buffer       = Encoding.UTF8.GetBytes(input);
                var memoryStream = new MemoryStream(buffer);
                result           = (List <Transaction>)xmlDeserializer.Deserialize(memoryStream);

                return(result);
            }));
        }
예제 #13
0
        protected TypeMapperBase(IMappingService service, IMappingServiceProvider serviceProvider)
        {
            this.ResultExpressionList      = new List <Expression>();
            this.RecursiveExpressionResult = new List <Expression>();
            this.PropertyCache             = new Dictionary <string, Expression>();
            this.CustomPropertyCache       = new Dictionary <string, Expression>();
            this.IgnoreMemberList          = new List <string>();
            this.MappingService            = service;
            this.MappingServiceProvider    = serviceProvider;
            this.InitializeRecursiveMappings(serviceProvider);

            this.CustomMembers         = new List <KeyValuePair <MemberExpression, Expression> >();
            this.FlattenMembers        = new List <KeyValuePair <MemberExpression, Expression> >();
            this.CustomFunctionMembers = new List <KeyValuePair <MemberExpression, Expression> >();
        }
예제 #14
0
 public void Configure(IMappingServiceProvider mappingServiceProvider)
 {
     mappingServiceProvider.Register(new Func <List <Transaction>, List <GetAllTransactionsResponseModel> >((input) =>
     {
         var result = input.Select(transaction => new GetAllTransactionsResponseModel
         {
             Id      = transaction.TransactionId,
             Payment = $"{transaction.Amount} {transaction.CurrencyCode}",
             Status  = transaction.Status == TransactionStatus.Values.APPROVED ? "A"
             : transaction.Status == TransactionStatus.Values.FAILED || transaction.Status == TransactionStatus.Values.REJECTED ? "R"
                       //FINISHED,DONE
             : "D"
         }).ToList();
         return(result);
     }));
 }
예제 #15
0
        public void Configure(IMappingServiceProvider mappingServiceProvider)
        {
            mappingServiceProvider.RegisterByKey <string, List <Transaction> >("text/xml", new Func <string, List <Transaction> >((input) =>
            {
                var result       = new List <Transaction>();
                var transactions = XElement.Parse(input);
                transactions.Descendants("Transaction").ToList().ForEach(element =>
                {
                    var transaction = new Transaction
                    {
                        TransactionId   = element.Attribute("id").Value,
                        TransactionDate = DateTime.Parse(element.Element("TransactionDate").Value),
                        Status          = (TransactionStatus.Values)Enum.Parse(typeof(TransactionStatus.Values), element.Element("Status").Value.ToUpper()),
                        Amount          = decimal.Parse(element.Element("PaymentDetails").Element("Amount").Value),
                        CurrencyCode    = (ISO4217CurrencyCode.Values)Enum.Parse(typeof(ISO4217CurrencyCode.Values), element.Element("PaymentDetails").Element("CurrencyCode").Value)
                    };
                    result.Add(transaction);
                });

                return(result);
            }));
        }
예제 #16
0
 internal MappingServiceBase(IMappingServiceProvider mappingServiceProvider)
 {
     MappingServiceProvider = mappingServiceProvider;
     TypeMappers            = new Dictionary <int, ITypeMapper>();
 }
예제 #17
0
 protected abstract void InitializeRecursiveMappings(IMappingServiceProvider serviceProvider);
예제 #18
0
 public TransactionManager(DataContext dataContext, IValidationServiceProvider validationService, IMappingServiceProvider mappingServiceProvider)
 {
     _validationService      = validationService;
     _mappingServiceProvider = mappingServiceProvider;
     _dataContext            = dataContext;
 }
예제 #19
0
 public MemberConfiguration(ITypeMapper <T, TN>[] typeMappers, IMappingServiceProvider mappingServiceProvider)
 {
     this._typeMappers            = typeMappers;
     this._mappingServiceProvider = mappingServiceProvider;
 }
예제 #20
0
 internal MappingServiceBase(IMappingServiceProvider mappingServiceProvider)
 {
     this.MappingServiceProvider = mappingServiceProvider;
     this.TypeMappers            = new Dictionary <long, ITypeMapper>();
 }
예제 #21
0
 public DestinationMappingService(IMappingServiceProvider mappingServiceProvider)
     : base(mappingServiceProvider)
 {
 }
 public EntityFrameworkMapper(IMappingServiceProvider mapper)
 {
     _mapper = mapper;
 }
예제 #23
0
 public SourceMappingService(IMappingServiceProvider mappingServiceProvider)
     : base(mappingServiceProvider)
 {
 }
예제 #24
0
 public DestinationTypeMapper(IMappingService service, IMappingServiceProvider serviceProvider) : base(service, serviceProvider)
 {
 }
예제 #25
0
 public ProductSubCategoryService(IUnitOfWork unitOfWork,
                                  IMappingServiceProvider mapper)
 {
     _unitOfWork = unitOfWork;
     _mapper     = mapper;
 }
예제 #26
0
 public PumpService(IUnitOfWork unitOfWork,
                    IMappingServiceProvider mapper)
 {
     _unitOfWork = unitOfWork;
     _mapper     = mapper;
 }
예제 #27
0
 public SourceTypeMapper(IMappingService service, IMappingServiceProvider serviceProvider) : base(service, serviceProvider)
 {
 }