Пример #1
0
 public IHttpActionResult PutQuotation(int id, int quotationid, [FromBody] Quotation quotation)
 {
     try
     {
         QuotationManager manager = new QuotationManager();
         Quotation        temp    = manager.Obtener(quotationid);
         if (temp.specialist.id == id)
         {
             quotation.specialist.id = id;
             Quotation result = manager.Editar(quotationid, quotation);
             if (result != null)
             {
                 return(Ok());
             }
             else
             {
                 return(BadRequest());
             }
         }
         else
         {
             return(NotFound());
         }
     }
     catch (Exception e)
     {
         return(NotFound());
     }
 }
Пример #2
0
 public IHttpActionResult DeleteQuotation(int id, int quotationid)
 {
     try
     {
         QuotationManager manager = new QuotationManager();
         Quotation        temp    = manager.Obtener(quotationid);
         if (temp.specialist.id == id)
         {
             Quotation result = manager.Eliminar(quotationid);
             if (result != null)
             {
                 return(Ok());
             }
             else
             {
                 return(BadRequest());
             }
         }
         else
         {
             return(NotFound());
         }
     }
     catch (Exception e)
     {
         return(NotFound());
     }
 }
Пример #3
0
        internal void ConstructQuotManager()
        {
            MongoMessagePackRecorder recorder = new MongoMessagePackRecorder("192.168.1.167", 6678, this.logHelper);

            QuotV5.Binary.RealTimeQuotConnection stockRealtimeQuotConn  = ConstructRealTimeQuotConnection("StockRealtime", recorder);
            QuotV5.Binary.RealTimeQuotConnection optionRealtimeQuotConn = ConstructRealTimeQuotConnection("OptionRealtime", recorder);
            QuotationRepository quotRepository = new QuotationRepository();


            QuotationMQPublisherConfig publisherConfig = new QuotationMQPublisherConfig()
            {
                Address           = PluginContext.Configuration.ActiveMQ.Address,
                RecordsPerPackage = PluginContext.Configuration.ActiveMQ.RecordsPerPackage
            };
            QuotationMQPublisher quotPublisher = new QuotationMQPublisher(publisherConfig, this.logHelper);


            StaticInfoProviderConfig securityInfoProviderConfig = GetStaticInfoProviderConfig("Securities");
            SecurityInfoProvider     securityInfoProvider       = new SecurityInfoProvider(securityInfoProviderConfig, this.logHelper);


            StaticInfoProviderConfig indexInfoProviderConfig = GetStaticInfoProviderConfig("IndexInfo");
            IndexInfoProvider        indexInfoProvider       = new IndexInfoProvider(indexInfoProviderConfig, this.logHelper);

            StaticInfoProviderConfig  cashAuctionParamsProviderConfig = GetStaticInfoProviderConfig("CashAuctionParams");
            CashAuctionParamsProvider cashAuctionParamsProvider       = new CashAuctionParamsProvider(cashAuctionParamsProviderConfig, this.logHelper);

            StaticInfoProviderConfig        derivativeAuctionParamsProviderConfig = GetStaticInfoProviderConfig("DerivativeAuctionParams");
            DerivativeAuctionParamsProvider derivativeAuctionParamsProvider       = new DerivativeAuctionParamsProvider(derivativeAuctionParamsProviderConfig, this.logHelper);

            StaticInfoProviderConfig  negotiationParamsProviderConfig = GetStaticInfoProviderConfig("NegotiationParams");
            NegotiationParamsProvider negotiationParamsProvider       = new NegotiationParamsProvider(negotiationParamsProviderConfig, this.logHelper);

            StaticInfoProviderConfig securityCloseMDProviderConfig = GetStaticInfoProviderConfig("SecurityCloseMD");
            SecurityCloseMDProvider  securityCloseMDProvider       = new SecurityCloseMDProvider(securityCloseMDProviderConfig, this.logHelper);

            this.quotManager = new QuotationManager(
                //new QuotV5.Binary.RealTimeQuotConnection[] { optionRealtimeQuotConn },
                new QuotV5.Binary.RealTimeQuotConnection[] { stockRealtimeQuotConn, optionRealtimeQuotConn },
                quotRepository,
                quotPublisher,
                // null,
                securityInfoProvider,
                indexInfoProvider,
                cashAuctionParamsProvider,
                derivativeAuctionParamsProvider,
                negotiationParamsProvider,
                securityCloseMDProvider,
                this.logHelper
                );


            QuotationSnapServiceConfig sc = new QuotationSnapServiceConfig()
            {
                Address = PluginContext.Configuration.ActiveMQ.Address, RecordsPerPackage = PluginContext.Configuration.ActiveMQ.RecordsPerPackage
            };

            this.quotSnapService = new QuotationSnapService(sc, quotPublisher, this.logHelper);
        }
Пример #4
0
 public IHttpActionResult PostQuotation(int id, [FromBody] Quotation quotation)
 {
     try
     {
         QuotationManager manager = new QuotationManager();
         quotation.specialist.id = id;
         Quotation result = manager.Insertar(quotation);
         if (result != null)
         {
             return(Created(new Uri(Url.Link(ViewRouteName, new { id = result.specialist.id })), result));
         }
         else
         {
             return(BadRequest());
         }
     }
     catch (Exception e)
     {
         return(NotFound());
     }
 }