/// <summary>
        /// Maps the properties to object.
        /// </summary>
        /// <param name="obj">The obj.</param>
        /// <param name="service">The service.</param>
        /// <param name="context">The context.</param>
        public void MapPropertiesToObject(object obj, IAbstractService service, AbstractTypeCreationContext context)
        {
            try
            {
                //create properties
                AbstractDataMappingContext dataMappingContext = service.CreateDataMappingContext(context, obj);

                foreach (var prop in Properties)
                {
                    try
                    {
                        prop.Mapper.MapCmsToProperty(dataMappingContext);
                    }
                    catch (Exception e)
                    {
                        throw new MapperException(
                                  "Failed to map property {0} on {1}".Formatted(prop.PropertyInfo.Name,
                                                                                prop.PropertyInfo.DeclaringType.FullName), e);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new MapperException(
                          "Failed to map properties on {0}.".Formatted(context.DataSummary()), ex);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// The default constructor Inheriteda and implemented by all Child classes
        /// </summary>
        /// <param name="_service"></param>
        protected BaseModalsVM(IAbstractService <T> _service, IDinkeyDongleService _dongleService)
        {
            service       = _service;
            dongleService = _dongleService;

            ProcessCommand = new RelayCommand(async() => await Process(), () => CanProcess);
            CloseCommand   = new RelayCommand(Close);
        }
        /// <summary>
        /// Maps the properties to object.
        /// </summary>
        /// <param name="obj">The obj.</param>
        /// <param name="service">The service.</param>
        /// <param name="context">The context.</param>
        public void MapPropertiesToObject(object obj, IAbstractService service, AbstractTypeCreationContext context)
        {
            //create properties
            AbstractDataMappingContext dataMappingContext = service.CreateDataMappingContext(context, obj);

            foreach (var prop in Properties)
            {
                prop.Mapper.MapCmsToProperty(dataMappingContext);
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ObjectSavingArgs"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="target">The target.</param>
 /// <param name="savingContext">The saving context.</param>
 /// <param name="service">The service.</param>
 public ObjectSavingArgs(
     Context context,
     object target,
     AbstractTypeSavingContext savingContext,
     IAbstractService service)
     : base(context)
 {
     Target        = target;
     SavingContext = savingContext;
     Service       = service;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ObjectConstructionArgs"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="abstractTypeCreationContext">The abstract type creation context.</param>
 /// <param name="configuration">The configuration.</param>
 /// <param name="service">The service.</param>
 public ObjectConstructionArgs(
     Context context, 
     AbstractTypeCreationContext abstractTypeCreationContext, 
     AbstractTypeConfiguration configuration,
     IAbstractService service)
     : base(context)
 {
     AbstractTypeCreationContext = abstractTypeCreationContext;
     Configuration = configuration;
     Service = service;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ObjectConstructionArgs"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="abstractTypeCreationContext">The abstract type creation context.</param>
 /// <param name="configuration">The configuration.</param>
 /// <param name="service">The service.</param>
 public ObjectConstructionArgs(
     Context context,
     AbstractTypeCreationContext abstractTypeCreationContext,
     AbstractTypeConfiguration configuration,
     IAbstractService service)
     : base(context)
 {
     AbstractTypeCreationContext = abstractTypeCreationContext;
     Configuration = configuration;
     Service       = service;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ObjectSavingArgs"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="target">The target.</param>
 /// <param name="savingContext">The saving context.</param>
 /// <param name="service">The service.</param>
 public ObjectSavingArgs(
     Context context, 
     object target, 
     AbstractTypeSavingContext savingContext,
     IAbstractService service)
     : base(context)
 {
     Target = target;
     SavingContext = savingContext;
     Service = service;
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Default constructor for this class and should be implemented
        /// by all derived classes
        /// </summary>
        /// <param name="_service">
        /// the default Service class that manages the Type inferred from the Argument passed to the
        /// class
        /// </param>
        protected CollectionsVMWithOneCommand(IAbstractService <T> _service, IDinkeyDongleService _dongleService)
        {
            ChangeStyle(string.Empty);

            service       = _service;
            dongleService = _dongleService;

            ProcessCommand = new RelayCommand(Process);

            LoadAll().ConfigureAwait(false);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Maps the properties to object.
        /// </summary>
        /// <param name="obj">The obj.</param>
        /// <param name="service">The service.</param>
        /// <param name="context">The context.</param>
        public void MapPropertiesToObject(object obj, IAbstractService service, AbstractTypeCreationContext context)
        {
            try
            {
                if (_properties.Count != 0)
                {
                    //create properties
                    AbstractDataMappingContext dataMappingContext = context.CreateDataMappingContext(obj);


                    foreach (var property in _properties.Values)
                    {
                        var prop = property;

                        try
                        {
                            prop.Mapper.MapCmsToProperty(dataMappingContext);
                        }
                        catch (MapperStackException)
                        {
                            throw;
                        }
                        catch (Exception e)
                        {
                            throw new MapperException(
                                      "Failed to map property {0} on {1}".Formatted(prop.PropertyInfo.Name,
                                                                                    prop.PropertyInfo.DeclaringType.FullName), e);
                        }
                    }
                }
            }
            catch (MapperStackException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw new MapperException(
                          "Failed to map properties on {0}.".Formatted(context.DataSummary()), ex);
            }

            MapPrivatePropertiesToObject(obj, service, context);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Maps the properties to object.
        /// </summary>
        /// <param name="obj">The obj.</param>
        /// <param name="service">The service.</param>
        /// <param name="context">The context.</param>
        public void MapPropertiesToObject(object obj, IAbstractService service, AbstractTypeCreationContext context)
        {
            try
            {
                //create properties
                AbstractDataMappingContext dataMappingContext = service.CreateDataMappingContext(context, obj);
                _propertMappingExpression(obj, dataMappingContext);

                //var tasks = Properties.Select(x =>
                //    {
                //        var t = new Task(() => x.Mapper.MapCmsToProperty(dataMappingContext));
                //        t.Start();
                //        return t;
                //    });

                //Task.WaitAll(tasks.ToArray());

                //for(int i  = Properties.Length-1; i >= 0; i--)
                //{
                //    var prop = Properties[i];

                //    try
                //    {
                //        prop.Mapper.MapCmsToProperty(context);
                //    }
                //    catch (Exception e)
                //    {
                //        throw new MapperException(
                //            "Failed to map property {0} on {1}".Formatted(prop.PropertyInfo.Name,
                //                prop.PropertyInfo.DeclaringType.FullName), e);
                //    }

                //}
            }
            catch (Exception ex)
            {
                throw new MapperException(
                          "Failed to map properties on {0}.".Formatted(context.DataSummary()), ex);
            }
        }
        public void Build()
        {
            _AuthenticationService.BaseUrl = _Configuration.ConsultaAcademicaApiURL;

            _Authentication = _AuthenticationService.Autenticar(
                _Configuration.ConsultaAcademicaApiUsername,
                _Configuration.ConsultaAcademicaApiPassword
                );

            if (!_Authentication.Autenticado)
            {
                throw new UnauthorizedAccessException("O usuário e senha informados são inválidos");
            }

            var keys = _Services.Keys;

            foreach (var key in keys)
            {
                IAbstractService service = _Services[key];
                service.BaseUrl = _Configuration.ConsultaAcademicaApiURL;
                service.Token   = _Authentication.Token;
            }
        }
 public BaseConsultaAcademicaProxy(IAbstractService abstractService) : base(abstractService)
 {
     ConsultaAcademicaService = (IConsultaAcademicaService)Service;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ConfigurationResolverArgs"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="abstractTypeCreationContext">The abstract type creation context.</param>
 public ConfigurationResolverArgs(Context context,  AbstractTypeCreationContext abstractTypeCreationContext, Type requestedType, IAbstractService service) :base(context)
 {
     Service = service;
     AbstractTypeCreationContext = abstractTypeCreationContext;
     RequestedType = requestedType;
 }
        public override AbstractDataMappingContext CreateDataMappingContext(IAbstractService service)
        {
            var mappingContext = new SitecoreDataMappingContext(Object, Item, service as ISitecoreService, null);

            return(mappingContext);
        }
        /// <summary>
        /// Maps the properties to object.
        /// </summary>
        /// <param name="obj">The obj.</param>
        /// <param name="service">The service.</param>
        /// <param name="context">The context.</param>
        public void MapPropertiesToObject( object obj, IAbstractService service, AbstractTypeCreationContext context)
        {
            try
            {
                //create properties 
                AbstractDataMappingContext dataMappingContext = service.CreateDataMappingContext(context, obj);
                _propertMappingExpression(obj, dataMappingContext);

                //var tasks = Properties.Select(x =>
                //    {
                //        var t = new Task(() => x.Mapper.MapCmsToProperty(dataMappingContext));
                //        t.Start();
                //        return t;
                //    });

                //Task.WaitAll(tasks.ToArray());

                //for(int i  = Properties.Length-1; i >= 0; i--)
                //{
                //    var prop = Properties[i];

                //    try
                //    {
                //        prop.Mapper.MapCmsToProperty(context);
                //    }
                //    catch (Exception e)
                //    {
                //        throw new MapperException(
                //            "Failed to map property {0} on {1}".Formatted(prop.PropertyInfo.Name,
                //                prop.PropertyInfo.DeclaringType.FullName), e);
                //    }

                //}
            }
            catch (Exception ex)
            {
                throw new MapperException(
                           "Failed to map properties on {0}.".Formatted(context.DataSummary()), ex);
            }
        }
Ejemplo n.º 16
0
 public AbstractController(IAbstractService service)
 {
     Service = service;
 }
 public AbstractServiceBuilder AddService(IAbstractService service)
 {
     _Services.Add(service.ServiceName, service);
     return(this);
 }
Ejemplo n.º 18
0
 public StatusController(IAbstractService service) : base(service)
 {
 }
Ejemplo n.º 19
0
 public DesignController(IAbstractService <T> illustrationsService)
 {
     this.DataServiceService = illustrationsService ?? throw new ArgumentNullException("IllustrationsService cannot be null.");
 }
Ejemplo n.º 20
0
 public abstract AbstractDataMappingContext CreateDataMappingContext(IAbstractService service);
Ejemplo n.º 21
0
 public GlassModelCounter(IAbstractService service, string identifier)
     :this(service, identifier, 0)
 {
   
 }
Ejemplo n.º 22
0
 public GlassModelCounter(IAbstractService service, string identifier, int threshold)
     :this(service.GlassContext, identifier, threshold)
 {
   
 }
        /// <summary>
        /// Maps the properties to object.
        /// </summary>
        /// <param name="obj">The obj.</param>
        /// <param name="service">The service.</param>
        /// <param name="context">The context.</param>
        public void MapPropertiesToObject( object obj, IAbstractService service, AbstractTypeCreationContext context)
        {
            try
            {
                //create properties 
                AbstractDataMappingContext dataMappingContext = service.CreateDataMappingContext(context, obj);

                foreach (var prop in Properties)
                {
                    try
                    {
                        prop.Mapper.MapCmsToProperty(dataMappingContext);
                    }
                    catch (Exception e)
                    {
                        throw new MapperException(
                            "Failed to map property {0} on {1}".Formatted(prop.PropertyInfo.Name,
                                prop.PropertyInfo.DeclaringType.FullName), e);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new MapperException(
                           "Failed to map properties on {0}.".Formatted(context.DataSummary()), ex);
            }
        }
Ejemplo n.º 24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ConfigurationResolverArgs"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="abstractTypeCreationContext">The abstract type creation context.</param>
 public ConfigurationResolverArgs(Context context, AbstractTypeCreationContext abstractTypeCreationContext, IAbstractService service) : base(context)
 {
     Service = service;
     AbstractTypeCreationContext = abstractTypeCreationContext;
 }
        /// <summary>
        /// Maps the properties to object.
        /// </summary>
        /// <param name="obj">The obj.</param>
        /// <param name="service">The service.</param>
        /// <param name="context">The context.</param>
        public void MapPropertiesToObject( object obj, IAbstractService service, AbstractTypeCreationContext context)
        {
            //create properties 
            AbstractDataMappingContext dataMappingContext = service.CreateDataMappingContext(context, obj);

            foreach (var prop in Properties)
            {
                prop.Mapper.MapCmsToProperty(dataMappingContext);
            }
        }
 public BaseParallelConsultaAcademicaProxy(IAbstractService abstractService) : base(abstractService)
 {
     ConsultaAcademicaService = (IConsultaAcademicaService)Service;
     UseParallelism           = false;
     CanLog = false;
 }
Ejemplo n.º 27
0
 public GlassModelCounter(IAbstractService service, string identifier, int threshold)
     : this(service.GlassContext, identifier, threshold)
 {
 }
Ejemplo n.º 28
0
 /// <summary>
 /// The default constructor inherited from the base class and should be implemented
 /// by all derived classes
 /// </summary>
 /// <param name="_service">
 /// the default Service class that manages the Type inferred from the Argument passed to the
 /// class
 /// </param>
 protected CollectionsVMWithTwoCommands(IAbstractService <T> _service, IDinkeyDongleService _dongleService) :
     base(_service: _service, _dongleService: _dongleService)
 {
     FilterCollectionsCommand = new RelayCommand <object>(FilterCollections);
 }
Ejemplo n.º 29
0
 public GlassModelCounter(IAbstractService service, string identifier)
     : this(service, identifier, 0)
 {
 }
Ejemplo n.º 30
0
 public CatController(ICategoryService salesOrderService, IAbstractService <CategoryMaster> salesOrderLineService)
 {
     _salesOrderService     = salesOrderService;
     _salesOrderLineService = salesOrderLineService;
 }
Ejemplo n.º 31
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ConfigurationResolverArgs"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="abstractTypeCreationContext">The abstract type creation context.</param>
 public ConfigurationResolverArgs(Context context, AbstractTypeCreationContext abstractTypeCreationContext, Type requestedType, IAbstractService service) : base(context)
 {
     Service = service;
     AbstractTypeCreationContext = abstractTypeCreationContext;
     RequestedType = requestedType;
 }
Ejemplo n.º 32
0
 public AbstractProxy(IAbstractService abstractService)
 {
     Service = abstractService;
 }