Exemplo n.º 1
0
 public string GetSummonerGamesById()
 {
     try
     {
         using (this.client = new WebClient())
         {
             summonerGamesResponse = client.DownloadString(URLManager.SummonerGamesById(summonerId));
         }
         responseCode = "#02";
     }
     catch (Exception ex)
     {
         return("#03");
     }
     try
     {
         idName = ReaderManager.FileReader(jsonFilePath);
         SummonerGames summonerGamesModel = SerializerManager.SummonerGamesSerializer(summonerGamesResponse);
         this.SummonerGames = NameManager.GamesNameFiller(summonerGamesModel, this.summonerName, idName);
     }
     catch (Exception ex)
     {
         throw new ArgumentException("Either response serializing or finding name went wrong " + ex.Message);
     }
     return(responseCode);
 }
Exemplo n.º 2
0
        public void Create_With_Static_Counter()
        {
            string createQuery = null;
            var    serializer  = new SerializerManager(ProtocolVersion.MaxSupported);
            var    sessionMock = GetSessionMock(serializer);

            sessionMock
            .Setup(s => s.Execute(It.IsAny <string>()))
            .Returns(() => new RowSet())
            .Callback <string>(q => createQuery = q);

            var table = GetTable <AllTypesEntity>(sessionMock.Object,
                                                  new Map <AllTypesEntity>().ExplicitColumns()
                                                  .TableName("tbl1")
                                                  .PartitionKey(t => t.UuidValue)
                                                  .ClusteringKey(t => t.StringValue)
                                                  .Column(t => t.UuidValue, cm => cm.WithName("id1"))
                                                  .Column(t => t.StringValue, cm => cm.WithName("id2"))
                                                  .Column(t => t.Int64Value, cm => cm.WithName("counter_col1")
                                                          .AsCounter().AsStatic())
                                                  .Column(t => t.IntValue, cm => cm.WithName("counter_col2")
                                                          .AsCounter()));

            table.Create();
            Assert.AreEqual("CREATE TABLE tbl1 (" +
                            "counter_col1 counter static, counter_col2 counter, id1 uuid, id2 text," +
                            " PRIMARY KEY (id1, id2))", createQuery);
        }
Exemplo n.º 3
0
        protected override ITransportServer CreateTransport(KeyValueCollection parameters)
        {
            var queueServerName      = parameters["QueueServerName"];
            var enableGetDescriptors = parameters["EnableGetDescriptors"].ParseTo(true);
            var serializerMimeType   = parameters["SerializerMimeType"];
            var compressorEncoding   = parameters["CompressorEncoding"];
            var serializer           = SerializerManager.GetByMimeType(serializerMimeType);

            if (serializer != null && compressorEncoding.IsNotNullOrEmpty())
            {
                var compressor = CompressorManager.GetByEncodingType(compressorEncoding);
                if (compressor != null)
                {
                    serializer.Compressor = compressor;
                }
            }
            Core.Log.LibDebug("Creating a new MessagingTransportServer with the parameters:");
            Core.Log.LibDebug("\tQueueServerName: {0}", queueServerName.IsNotNullOrWhitespace() ?
                              queueServerName :
                              "Using Default QueueServer from configuration file.");
            Core.Log.LibDebug("\tEnableGetDescriptors: {0}", enableGetDescriptors);
            if (serializerMimeType != null)
            {
                Core.Log.LibDebug("\tSerializer: {0}", serializer);
                if (serializer?.Compressor != null)
                {
                    Core.Log.LibDebug("\tCompressorEncoding: {0}", compressorEncoding);
                }
            }
            var queueServer = queueServerName.IsNotNullOrWhitespace()
                ? Core.Services.GetQueueServer(queueServerName)
                : Core.Services.GetQueueServer();

            return(new MessagingTransportServer(queueServer, serializer));
        }
Exemplo n.º 4
0
        private void StartReceive(object sender, DoWorkEventArgs e)
        {
            while (_socket.Connected)
            {
                // Read the command object.
                var bytes = new byte[8192];
                try
                {
                    var readBytes = _socket.Receive(bytes);
                    if (readBytes == 0)
                    {
                        break;
                    }
                    CommandContainer command = (CommandContainer)SerializerManager.Deserialize(bytes);

                    if ((command.CommandType == CommandType.ClientSignUp) || (command.CommandType == CommandType.ClientLogIn))
                    {
                        ProfileContainer profile = (ProfileContainer)command.Data;
                        _clientName = profile.UserName;
                    }

                    OnCommandReceived(new CommandEventArgs(command));
                }
                catch (Exception)
                {
                }
            }
            OnDisconnected(new ClientEventArgs(_socket));
            Disconnect();
        }
Exemplo n.º 5
0
        public void Create_With_Frozen_Collection_Value()
        {
            string createQuery = null;
            var    serializer  = new SerializerManager(ProtocolVersion.MaxSupported);
            var    sessionMock = GetSessionMock(serializer);

            sessionMock
            .Setup(s => s.Execute(It.IsAny <string>()))
            .Returns(() => new RowSet())
            .Callback <string>(q => createQuery = q);
            var definition = new Map <UdtAndTuplePoco>()
                             .PartitionKey(c => c.Id1)
                             .Column(c => c.Id1, cm => cm.WithName("id"))
                             .Column(c => c.UdtList1, cm => cm.WithName("my_list").WithFrozenValue())
                             .Column(c => c.TupleMapValue1, cm => cm.WithName("my_map").WithFrozenValue())
                             .ExplicitColumns()
                             .TableName("tbl1");
            var udtInfo = new UdtColumnInfo("song");

            udtInfo.Fields.Add(new ColumnDesc {
                Name = "title", TypeCode = ColumnTypeCode.Ascii
            });
            udtInfo.Fields.Add(new ColumnDesc {
                Name = "releasedate", TypeCode = ColumnTypeCode.Timestamp
            });
            var udtMap = UdtMap.For <Song>();

            udtMap.SetSerializer(serializer.GetCurrentSerializer());
            udtMap.Build(udtInfo);
            serializer.SetUdtMap("song", udtMap);
            var table = GetTable <UdtAndTuplePoco>(sessionMock.Object, definition);

            table.Create();
            Assert.AreEqual("CREATE TABLE tbl1 (id uuid, my_list list<frozen<\"song\">>, my_map map<text, frozen<tuple<double, double>>>, PRIMARY KEY (id))", createQuery);
        }
Exemplo n.º 6
0
        private void StartReceive(object sender, DoWorkEventArgs e)
        {
            while (_clientSocket.Connected)
            {
                // Read the command object.
                var bytes = new byte[8192];
                try
                {
                    var readBytes = _clientSocket.Receive(bytes);
                    if (readBytes == 0)
                    {
                        break;
                    }
                    CommandContainer cmd = (CommandContainer)SerializerManager.Deserialize(bytes);

                    OnCommandReceived(new CommandEventArgs(cmd));
                }
                catch (Exception exception)
                {
                    Console.WriteLine(exception);
                }
            }
            OnServerDisconnected(new ServerEventArgs(_clientSocket));
            Disconnect();
        }
Exemplo n.º 7
0
        public void Init(MQPairConfig config, bool sendOnly)
        {
            if (config is null)
            {
                return;
            }

            Config   = config;
            SendOnly = sendOnly;
            Name     = Config.Name;
            Counters = new MQClientCounters(Name, Config.IgnoreClientCounters);

            SenderSerializer = SerializerManager.GetByMimeType(Config.RequestOptions?.SerializerMimeType);
            if (SenderSerializer != null && Config.RequestOptions?.CompressorEncodingType.IsNotNullOrEmpty() == true)
            {
                SenderSerializer.Compressor = CompressorManager.GetByEncodingType(Config.RequestOptions?.CompressorEncodingType);
            }
            ReceiverSerializer = SerializerManager.GetByMimeType(Config.ResponseOptions?.SerializerMimeType);
            if (ReceiverSerializer != null && Config.ResponseOptions?.CompressorEncodingType.IsNotNullOrEmpty() == true)
            {
                ReceiverSerializer.Compressor = CompressorManager.GetByEncodingType(Config.ResponseOptions?.CompressorEncodingType);
            }

            OnInit();
        }
Exemplo n.º 8
0
        /// <summary>
        /// Adds all defined routes on a HttpController type
        /// </summary>
        /// <typeparam name="T">Type of HttpControllerBase</typeparam>
        /// <returns>SimpleHttpServer instance</returns>
        public SimpleHttpServer AddHttpControllerRoutes <T>() where T : HttpControllerBase
        {
            var type    = typeof(T);
            var methods = type.GetRuntimeMethods();

            methods.Each(m =>
            {
                var routes = m.GetCustomAttributes <HttpRouteAttribute>().ToArray();
                if (routes?.Any() == true)
                {
                    routes.Each(route => AddRouteHandler(route.Method, route.Url, context =>
                    {
                        var ctl     = Activator.CreateInstance <T>();
                        ctl.Context = context;
                        var mParams = m.GetParameters();
                        if (mParams.Length > 0)
                        {
                            ParameterInfo postObjectParam = null;
                            object postObject             = null;
                            var ivkParams = new List <object>();
                            if (context.Request.HasPostObject)
                            {
                                postObjectParam = mParams.FirstOrDefault(p => p.GetCustomAttribute(typeof(PostObjectAttribute)) != null);
                                if (postObjectParam == null && mParams.Length == 1)
                                {
                                    postObjectParam = mParams[0];
                                }
                                if (postObjectParam != null)
                                {
                                    postObject = Try.Do(() => context.Request.GetPostObject(postObjectParam.ParameterType));
                                }
                            }
                            var dictionary = context.Route.GetRouteParameters(context.Request.Url.AbsolutePath);
                            foreach (var mParam in mParams)
                            {
                                if (mParam == postObjectParam)
                                {
                                    ivkParams.Add(postObject);
                                }
                                else if (dictionary.ContainsKey(mParam.Name))
                                {
                                    ivkParams.Add(dictionary[mParam.Name]);
                                }
                                else
                                {
                                    ivkParams.Add(null);
                                }
                            }

                            var response = m.Invoke(ctl, ivkParams.ToArray());
                            if (response == null)
                            {
                                return;
                            }
                            var serializer = SerializerManager.GetByMimeType(ctl.Context.Response.ContentType);
                            switch (serializer)
                            {
                            case null when response is string:
                                ctl.Context.Response.Write((string)response);
                                break;
        private InformacionEstacionBO consultarUsuariosPorID(string tipoIdEstacion, string numIdEstacion)
        {
            BizAgiWSParam           param  = new BizAgiWSParam();
            BizAgiWSParamEntityData entity = new BizAgiWSParamEntityData();

            entity.EntityName = "WFUSER";
            entity.Filters    = "SNumeroidentificacion = '" + numIdEstacion + "' and idTipodeDocumento = ";
            param.EntityData  = entity;

            XmlDocument schemaDoc  = new XmlDocument();
            string      schemaPath = Path.Combine(AsDirectory.AssemblyDirectory, Properties.Resources.SchemaConsultarCasoDesembolso);

            schemaDoc.Load(schemaPath);

            BizagiSOALayerOperations ejecutar = new BizagiSOALayerOperations();
            string xml = SerializerManager.SerializarToXml <BizAgiWSParam>(param);

            ejecutar.Url = ProxyUtils.GetServiceEndpoint("URLEntityManager");
            string respuesta = ejecutar.getEntitiesUsingSchemaAsString(xml, schemaDoc.OuterXml);

            // pendiente ajustar esta parte, se debe generar objetos de tipo wfuser para poder hacer la extracción de la información.
            InformacionEstacionBO datosEstacion = new InformacionEstacionBO();

            return(datosEstacion);
        }
Exemplo n.º 10
0
        /// <summary>
        ///     Serializes the content into the correct output.
        /// </summary>
        /// <param name="content"></param>
        /// <param name="contentType"></param>
        /// <param name="encoding"></param>
        /// <returns></returns>
        public ContentStage SerializeContent(object content, string contentType = "", Encoding encoding = null)
        {
            PipelineContext.RequestMessage.Content = SerializerManager.SendToSerializer(content, PipelineContext.RequestMessage,
                                                                                        contentType, encoding);

            return(this);
        }
        public static CountryIpIntervalCollection Load(string fileName)
        {
            var serializer = SerializerManager.GetByFileName(fileName);
            var list       = serializer.DeserializeFromFile <List <CountryIpInterval> >(fileName);

            return(new CountryIpIntervalCollection(list));
        }
Exemplo n.º 12
0
        /// <inheritdoc />
        /// <summary>
        /// Create a new storage from a KeyValueCollection parameters
        /// </summary>
        /// <param name="parameters">Parameters to create the storage</param>
        /// <returns>Storage</returns>
        protected override StorageBase CreateStorage(KeyValueCollection parameters)
        {
            var basePath = parameters["BasePath"];
            var indexSerializerMimeType = parameters["IndexSerializerMimeType"] ?? SerializerMimeTypes.WBinary;
            var numberOfSubFolder       = parameters["NumberOfSubFolder"].ParseTo((byte)25);
            var transactionLogThreshold = parameters["TransactionLogThreshold"].ParseTo(250);
            var slowDownWriteThreshold  = parameters["SlowDownWriteThreshold"].ParseTo(1000);
            var storageType             = parameters["StorageType"].ParseTo(FileStorageType.Normal);
            var indexSerializer         = SerializerManager.GetByMimeType <ISerializer>(indexSerializerMimeType);

            SerializerManager.SupressFileExtensionWarning = true;

            switch (storageType)
            {
            case FileStorageType.Normal:
                Core.Log.LibDebug("Creating a new FileStorage with the parameters:");
                Core.Log.LibDebug("\tBasePath: {0}", basePath);
                Core.Log.LibDebug("\tNumberOfSubFolders: {0}", numberOfSubFolder);
                Core.Log.LibDebug("\tTransactionLogThreshold: {0}", transactionLogThreshold);
                Core.Log.LibDebug("\tSlowDownWriteThreshold: {0}", slowDownWriteThreshold);
                Core.Log.LibDebug("\tIndexSerializer: {0}", indexSerializer);
                return(new FileStorage(basePath)
                {
                    NumberOfSubFolders = numberOfSubFolder,
                    TransactionLogThreshold = transactionLogThreshold,
                    SlowDownWriteThreshold = slowDownWriteThreshold,
                    IndexSerializer = (BinarySerializer)indexSerializer
                });
            }
            return(null);
        }
Exemplo n.º 13
0
 /// <summary>
 /// Default private constructor.
 /// </summary>
 private App()
 {
     fields      = new AppFieldList();
     modules     = new AppModuleList();
     mediaTypes  = new MediaManager();
     serializers = new SerializerManager();
 }
Exemplo n.º 14
0
        protected override ITransportClient CreateTransport(KeyValueCollection parameters)
        {
            var queueClientName    = parameters["QueueClientName"];
            var serializerMimeType = parameters["SerializerMimeType"];
            var compressorEncoding = parameters["CompressorEncoding"];
            var serializer         = SerializerManager.GetByMimeType(serializerMimeType);

            if (serializer != null && compressorEncoding.IsNotNullOrEmpty())
            {
                var compressor = CompressorManager.GetByEncodingType(compressorEncoding);
                if (compressor != null)
                {
                    serializer.Compressor = compressor;
                }
            }
            Core.Log.LibDebug("Creating a new MessagingTransportServer with the parameters:");
            Core.Log.LibDebug("\tQueueClientName: {0}", queueClientName);
            if (serializerMimeType != null)
            {
                Core.Log.LibDebug("\tSerializer: {0}", serializer);
                if (serializer?.Compressor != null)
                {
                    Core.Log.LibDebug("\tCompressorEncoding: {0}", compressorEncoding);
                }
            }
            Ensure.ArgumentNotNull(queueClientName, "The QueueClientName parameter in the MessagingTransportClientFactory can't be null.");
            var queueClient = Core.Services.GetQueueClient(queueClientName);

            return(new MessagingTransportClient(queueClient, serializer));
        }
Exemplo n.º 15
0
        public void Should_HandleDifferentProtocolVersionsInDifferentConnections_When_OneConnectionResponseVersionIsDifferentThanSerializer()
        {
            var serializer      = new SerializerManager(ProtocolVersion.V4);
            var connectionMock  = GetConnectionMock(null, serializer);
            var connectionMock2 = GetConnectionMock(null, serializer);
            var streamIds       = new List <short>();
            var responses       = new ConcurrentBag <Response>();

            connectionMock.Setup(c => c.RemoveFromPending(It.IsAny <short>()))
            .Callback <short>(id => streamIds.Add(id))
            .Returns(() => OperationStateExtensions.CreateMock((ex, r) => responses.Add(r)));
            connectionMock2.Setup(c => c.RemoveFromPending(It.IsAny <short>()))
            .Callback <short>(id => streamIds.Add(id))
            .Returns(() => OperationStateExtensions.CreateMock((ex, r) => responses.Add(r)));
            var connection = connectionMock.Object;
            var buffer     = GetResultBuffer(128, ProtocolVersion.V4);

            connection.ReadParse(buffer, buffer.Length);
            buffer = ConnectionTests.GetResultBuffer(100, ProtocolVersion.V2);
            connectionMock2.Object.ReadParse(buffer, buffer.Length);
            buffer = GetResultBuffer(129, ProtocolVersion.V4);
            connection.ReadParse(buffer, buffer.Length);
            CollectionAssert.AreEqual(new short[] { 128, 100, 129 }, streamIds);
            TestHelper.WaitUntil(() => responses.Count == 3);
            Assert.AreEqual(3, responses.Count);
        }
Exemplo n.º 16
0
        public static Row CreateRow(ICollection <KeyValuePair <string, object> > valueMap)
        {
            var columns    = new List <CqlColumn>();
            var rowValues  = new List <object>();
            var serializer = new SerializerManager(ProtocolVersion.MaxSupported).GetCurrentSerializer();

            foreach (var kv in valueMap)
            {
                if (kv.Value != null)
                {
                    IColumnInfo typeInfo;
                    var         typeCode = serializer.GetCqlType(kv.Value.GetType(), out typeInfo);
                    columns.Add(new CqlColumn {
                        Name = kv.Key, TypeCode = typeCode, TypeInfo = typeInfo
                    });
                }
                else
                {
                    columns.Add(new CqlColumn()
                    {
                        Name = kv.Key, TypeCode = ColumnTypeCode.Text
                    });
                }
                rowValues.Add(kv.Value);
            }
            var i = 0;

            return(new Row(rowValues.ToArray(), columns.ToArray(), valueMap.ToDictionary(kv => kv.Key, kv => i++)));
        }
Exemplo n.º 17
0
        internal static List <ObjetoSalidaECM> ConsultarDocumentos(ObjetoEntradaECM obj)
        {
            try
            {
                List <ObjetoSalidaECM> lstSalida = new List <ObjetoSalidaECM>();

                #region Request

                #region Header
                ECMService.HeaderDto header = new ECMService.HeaderDto();
                header.Token   = obj.Header.Token;
                header.Usuario = obj.Header.Usuario;
                #endregion

                ECMService.Gestor_ConsultarDocumentoRequest req
                    = new ECMService.Gestor_ConsultarDocumentoRequest(header, obj.NumeroRadicado, obj.Identificacion);
                #endregion

                #region Trace Request
                if (obj.Trace.ActivarTrace)
                {
                    var respuestaObj = SerializerManager.SerializarToXml <ECMService.Gestor_ConsultarDocumentoRequest>(req);
                    ECMManager.CrearArchivo(obj, "RequestConsultar_ECM", respuestaObj);
                }
                #endregion
                var res = EcmService.Gestor_ConsultarDocumento(req);
                #region Trace Response
                if (obj.Trace.ActivarTrace)
                {
                    var respuestaObj = SerializerManager.SerializarToXml <Bizagi.ECM.Manager.ECMService.Gestor_ConsultarDocumentoResponse>(res);
                    ECMManager.CrearArchivo(obj, "ResponseConsultar_ECM", respuestaObj);
                }
                #endregion
                if (res.Gestor_ConsultarDocumentoResult.Sucess)
                {
                    foreach (var item in res.Gestor_ConsultarDocumentoResult.Results)
                    {
                        foreach (var itemDoc in item.Documentos)
                        {
                            ObjetoSalidaECM oSalida = new ObjetoSalidaECM();
                            oSalida.NumeroDocumento      = itemDoc.CodigoArchivo;
                            oSalida.CodigoTipoDocumental = itemDoc.CodigoDirectorio;
                            oSalida.NumeroRadicado       = item.Radicado;
                            lstSalida.Add(oSalida);
                            DateTime.Now.ToShortDateString();
                        }
                    }
                }
                else
                {
                    throw new Exception("Error : " + res.Gestor_ConsultarDocumentoResult.Message);
                }
                return(lstSalida);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 18
0
        public SerializerManager Register()
        {
            var manager = new SerializerManager();

            manager.Register <TextField>(new StringFieldSerializer <TextField>());

            return(manager);
        }
Exemplo n.º 19
0
            internal MediaTypeFormatter CreateFormatter()
            {
                JsonMediaTypeFormatter formatter = new JsonMediaTypeFormatter();
                SerializerManager      factory   = new SerializerManager(_setups, SerializationTypeRegistry.Default);

                factory.ConfigureJsonSerializerSettings(formatter.SerializerSettings);
                return(formatter);
            }
Exemplo n.º 20
0
        public processes performActivity(string xml)
        {
            WorkflowEngineSOA.WorkflowEngineSOA wfEngine = new WorkflowEngineSOA.WorkflowEngineSOA();
            wfEngine.Url = url;
            string    xmlRespuesta = wfEngine.performActivityAsString(xml);
            processes respuesta    = SerializerManager.DeserializarTo <processes>(xmlRespuesta);

            return(respuesta);
        }
Exemplo n.º 21
0
        public void Should_SkipMetadata_When_NotBoundStatement(ProtocolVersion version)
        {
            var serializerManager = new SerializerManager(version);
            var stmt         = new SimpleStatement("DUMMY QUERY");
            var queryOptions = new QueryOptions();
            var request      = (QueryRequest)RequestHandler.GetRequest(stmt, serializerManager.GetCurrentSerializer(), GetRequestOptions(queryOptions));

            Assert.IsFalse(request.SkipMetadata);
        }
Exemplo n.º 22
0
    void Start()
    {
        // get serialized data
        serializerManager = SerializerManager.Instance;
        gameData          = serializerManager.LoadGameData();

        PopulateUIGameData();
        MLInput.OnTriggerDown += HandleOnTriggerDown;
    }
Exemplo n.º 23
0
 /// <summary>
 /// Default private constructor.
 /// </summary>
 private App()
 {
     fields       = new AppFieldList();
     modules      = new AppModuleList();
     mediaTypes   = new MediaManager();
     serializers  = new SerializerManager();
     contentTypes = new ContentTypeManager();
     hooks        = new HookManager();
 }
Exemplo n.º 24
0
        /// <summary>
        /// Sets the default TWCoreValues
        /// </summary>
        public static void SetDefaultTWCoreValues(this IServiceCollection services, CoreWebSettings settings = null)
        {
            settings = settings ?? new CoreWebSettings();
            services.AddMvc(options =>
            {
                try
                {
                    options.OutputFormatters.Add(new XmlSerializerOutputFormatter());

                    if (settings.EnableFormatMapping)
                    {
                        options.FormatterMappings.SetMediaTypeMappingForFormat
                            ("xml", MediaTypeHeaderValue.Parse("application/xml"));
                        options.FormatterMappings.SetMediaTypeMappingForFormat
                            ("js", MediaTypeHeaderValue.Parse("application/json"));
                    }

                    if (settings.EnableTWCoreSerializers)
                    {
                        var serializers = SerializerManager.GetBinarySerializers();
                        foreach (var serializer in serializers)
                        {
                            options.AddISerializerInputFormatter(serializer);
                            options.AddISerializerOutputFormatter(serializer);
                            if (settings.EnableFormatMapping)
                            {
                                options.FormatterMappings.SetMediaTypeMappingForFormat(serializer.Extensions[0].Substring(1),
                                                                                       MediaTypeHeaderValue.Parse(serializer.MimeTypes[0]));
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Core.Log.Write(ex);
                }
            })
            .AddJsonOptions(options =>
            {
                if (settings.EnableJsonStringEnum)
                {
                    options.SerializerSettings.Converters.Add(new Newtonsoft.Json.Converters.StringEnumConverter());
                }
            });
            services.AddLogging(cfg =>
            {
                if (settings.EnableTWCoreLogger)
                {
                    cfg.AddTWCoreLogger();
                }
            });
            if (settings.EnableGZipCompressor)
            {
                services.Configure <GzipCompressionProviderOptions>(options => options.Level = System.IO.Compression.CompressionLevel.Fastest);
                services.AddResponseCompression();
            }
        }
Exemplo n.º 25
0
        internal static ObjetoSalidaECM ActualizarDocumento(ObjetoEntradaECM obj)
        {
            try
            {
                ObjetoSalidaECM salida = new Manager.ObjetoSalidaECM();
                #region Request

                #region File
                FileDto file = new FileDto();
                //file.Base64String = Convert.ToBase64String(obj.Base64String);
                file.CodigoTipoDocumental = obj.CodigoTipoDocumental;
                file.Ext    = obj.Ext;
                file.Nombre = obj.NombreDocumento;
                #endregion

                #region Header
                ECMService.HeaderDto header = new ECMService.HeaderDto();
                header.Token   = obj.Header.Token;
                header.Usuario = obj.Header.Usuario;
                #endregion

                ECMService.Gestor_CambiarDocumentoRequest req
                    = new ECMService.Gestor_CambiarDocumentoRequest(header, obj.NumeroDocumento, file);
                #endregion

                #region Trace Request
                if (obj.Trace.ActivarTrace)
                {
                    var respuestaObj = SerializerManager.SerializarToXml <ECMService.Gestor_CambiarDocumentoRequest>(req);
                    ECMManager.CrearArchivo(obj, "RequestModificar_ECM", respuestaObj);
                }
                #endregion
                var res = EcmService.Gestor_CambiarDocumento(req);
                #region Trace Response
                if (obj.Trace.ActivarTrace)
                {
                    var respuestaObj = SerializerManager.SerializarToXml <Bizagi.ECM.Manager.ECMService.Gestor_CambiarDocumentoResponse>(res);
                    ECMManager.CrearArchivo(obj, "ResponseModificar_ECM", respuestaObj);
                }
                #endregion
                if (res.Gestor_CambiarDocumentoResult.Sucess)
                {
                    salida.NumeroDocumento = res.Gestor_CambiarDocumentoResult.CodeFiles[0];
                    salida.NumeroRadicado  = res.Gestor_CambiarDocumentoResult.Results;
                    return(salida);
                }
                else
                {
                    throw new Exception("Error : " + res.Gestor_CambiarDocumentoResult.Message);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 26
0
        public void Should_NotSkipMetadata_When_BoundStatementDoesNotContainColumnDefinitions(ProtocolVersion version)
        {
            var serializerManager = new SerializerManager(version);
            var ps           = GetPrepared(serializerManager: serializerManager);
            var stmt         = ps.Bind();
            var queryOptions = new QueryOptions();
            var request      = (ExecuteRequest)RequestHandler.GetRequest(stmt, serializerManager.GetCurrentSerializer(), GetRequestOptions(queryOptions));

            Assert.IsFalse(request.SkipMetadata);
        }
Exemplo n.º 27
0
        public static void LoadSettings(string settingsFilePath, string environmentName = null, string machineName = null, string applicationName = null)
        {
            if (settingsFilePath == null)
            {
                throw new NullReferenceException("The settings file path is null.");
            }

            environmentName = environmentName ?? EnvironmentName;
            machineName     = machineName ?? MachineName;
            applicationName = applicationName ?? ApplicationName;

            settingsFilePath = settingsFilePath?.Replace("{EnvironmentName}", environmentName);
            settingsFilePath = settingsFilePath?.Replace("{MachineName}", machineName);
            settingsFilePath = settingsFilePath?.Replace("{ApplicationName}", applicationName);
            Ensure.ExistFile(settingsFilePath);
            var serializer = SerializerManager.GetByFileExtension(Path.GetExtension(settingsFilePath));

            Ensure.ReferenceNotNull(serializer, $"A serializer for file '{settingsFilePath}' was not found");
            GlobalSettings globalSettings;

            try
            {
                if (serializer is ITextSerializer txtSerializer)
                {
                    var fileContent = File.ReadAllText(settingsFilePath);
                    fileContent    = ReplaceEnvironmentTemplate(fileContent);
                    globalSettings = txtSerializer.DeserializeFromString <GlobalSettings>(fileContent);
                }
                else
                {
                    globalSettings = serializer.DeserializeFromFile <GlobalSettings>(settingsFilePath);
                }
            }
            catch (Exception ex)
            {
                throw new Exception($"The Global settings file: {settingsFilePath} can't be deserialized.", ex);
            }
            try
            {
                LoadSettings(globalSettings, environmentName, machineName, applicationName);
                RebindSettings();
            }
            catch (Exception ex)
            {
                throw new Exception("Error loading the settings definitions.", ex);
            }
            //Checks if a reload time is set.
            if (GlobalSettings != null && GlobalSettings.SettingsReloadTimeInMinutes > 0)
            {
                Task.Delay(GlobalSettings.SettingsReloadTimeInMinutes * 60 * 1000).ContinueWith(t =>
                {
                    LoadSettings(settingsFilePath, environmentName, machineName, applicationName);
                });
            }
        }
Exemplo n.º 28
0
        protected override ITransportClient CreateTransport(KeyValueCollection parameters)
        {
            var url = parameters["Url"];
            var serializerMimeType = parameters["SerializerMimeType"];
            var serializer         = SerializerManager.GetByMimeType(serializerMimeType);

            Core.Log.LibDebug("Creating a new HttpTransportClient with the parameters:");
            Core.Log.LibDebug("\tUrl: {0}", url);
            Core.Log.LibDebug("\tSerializer: {0}", serializer);
            return(new HttpTransportClient(url, serializer));
        }
        public AjustePNCSegurosResponse AjustarPNCSeguros(AjustePNCSegurosRequest request)
        {
            try
            {
                AjustePNCSegurosResponse res = new AjustePNCSegurosResponse();
                res.Codigo  = "1";
                res.Mensaje = "Proceso Ejecutado";
                var rr2 = SerializerManager.SerializarToXml <AjustePNCSegurosRequest>(request);

                #region Consultar
                XmlDocument schemaDoc  = new XmlDocument();
                string      schemaPath = Path.Combine(AsDirectory.AssemblyDirectory, Properties.Resources.SchemaConsultarCasoSeguros);
                schemaDoc.Load(schemaPath);
                string      respuesta = Ejecutar.getCaseDataUsingSchemaAsString(string.Empty, request.WorkItem, schemaDoc.OuterXml);
                XmlDocument doc       = new XmlDocument();
                doc.LoadXml(respuesta);

                BizAgiWSResponseType con = SerializerManager.DeserializarTo2 <BizAgiWSResponseType>(respuesta);

                #endregion

                #region Modificar
                M_Solicitud mSol = new M_Solicitud();

                mSol.key                                         = con.M_Solicitud.key;
                mSol.keySpecified                                = true;
                mSol.OidReclamacionSeguro                        = new M_SolicitudOidReclamacionSeguro();
                mSol.OidReclamacionSeguro.key                    = con.M_Solicitud.OidReclamacionSeguro;
                mSol.OidReclamacionSeguro.keySpecified           = true;
                mSol.OidReclamacionSeguro.XDocumentosReclamacion =
                    new List <M_SolicitudOidReclamacionSeguroXDocumentosReclamacionM_DocumentoRecSeguro>();
                foreach (var item in request.LstDocumentos)
                {
                    mSol.OidReclamacionSeguro.XDocumentosReclamacion.Add
                        (new M_SolicitudOidReclamacionSeguroXDocumentosReclamacionM_DocumentoRecSeguro()
                    {
                        SUrlDocumento = item
                    });
                }
                BizAgiWSParamType <M_Solicitud> saveEntity = new BizAgiWSParamType <M_Solicitud>();
                saveEntity.Entities             = new EntitiesType <M_Solicitud>();
                saveEntity.Entities.Informacion = new M_Solicitud();
                saveEntity.Entities.Informacion = mSol;

                var save = SerializerManager.SerializarToXml <BizAgiWSParamType <M_Solicitud> >(saveEntity);
                var rt   = Ejecutar.saveEntityAsString(save);
                #endregion
                return(res);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 30
0
 /// <summary>
 /// Default private constructor.
 /// </summary>
 private App()
 {
     _blocks       = new AppBlockList();
     _fields       = new AppFieldList();
     _modules      = new AppModuleList();
     _mediaTypes   = new MediaManager();
     _serializers  = new SerializerManager();
     _contentTypes = new ContentTypeManager();
     _hooks        = new HookManager();
     _permissions  = new PermissionManager();
 }