Пример #1
0
        /// <summary>
        /// Transforma un PricingUpdateType en un PricingUpdateSent
        /// </summary>
        /// <param name="pricingUpdate">PricingUpdateType</param>
        /// <returns>PricingUpdateSent</returns>
        public static PricingUpdate Map2DB(DataCenterLogic.DataCenterTypesIDE.PricingUpdateType pricingUpdate)
        {
            PricingUpdate retPricingUpdate = new PricingUpdate();

            retPricingUpdate.DDPVersionNum = pricingUpdate.DDPVersionNum;
            retPricingUpdate.Message       = pricingUpdate.Message;
            retPricingUpdate.MessageId     = pricingUpdate.MessageId;
            retPricingUpdate.MessageType   = ToInt(pricingUpdate.MessageType);
            retPricingUpdate.PricingFile   = pricingUpdate.PricingFile;
            retPricingUpdate.schemaVersion = pricingUpdate.schemaVersion;
            retPricingUpdate.Test          = ToInt(pricingUpdate.test);
            retPricingUpdate.TimeStamp     = pricingUpdate.TimeStamp;

            return(retPricingUpdate);
        }
Пример #2
0
        /// <summary>
        /// Envia un mensaje de tipo PricingUpdate al IDE
        /// </summary>
        /// <param name="msg">Mensaje PricingUpdate</param>
        private string SendPricingUpdate(Message msg)
        {
            DataCenterLogic.DataCenterTypesIDE.PricingUpdateType pricingUpdate = (DataCenterLogic.DataCenterTypesIDE.PricingUpdateType)(msg.Body);

            //Send to IDE
            if (System.Configuration.ConfigurationManager.AppSettings["send2servers"] != "False")
            {
                pricingUpdate.test = DataCenterLogic.DataCenterTypesIDE.testType.Item0;
                ideClient.PricingUpdate(pricingUpdate);
                log.Info("SendPricingUpdate: pricingUpdate sent to IDE");
            }

            //Guarda el mensaje en la base de datos
            using (var dao = new PricingUpdateDataAccess())
            {
                dao.Create(TypeHelper.Map2DB(pricingUpdate), 0);
            }
            log.Info("PricingUpdate stored");
            return(pricingUpdate.MessageId);
        }
Пример #3
0
        public ActionResult Change(Price price)
        {
            ViewData["title"] = "Precios";
            try
            {
                var pm     = new PricingManager();
                var ddpMan = new DDPVersionManager();
                var cfgMan = new ConfigurationManager();
                var queMan = new QueueManager();

                var pud = new DataCenterLogic.DataCenterTypesIDE.PricingUpdateType();
                pud.DDPVersionNum = DDPVersionManager.currentDDP();
                pud.Message       = "Price changed";
                pud.MessageId     = MessageIdManager.Generate("1005");
                pud.MessageType   = DataCenterLogic.DataCenterTypesIDE.messageTypeType7.Item15;
                pud.PricingFile   = pm.GeneratePriceFile(price);
                pud.ReferenceId   = "";
                pud.schemaVersion = decimal.Parse(cfgMan.Configuration.SchemaVersion);
                pud.test          = DataCenterLogic.DataCenterTypesIDE.testType.Item0;
                pud.TimeStamp     = DateTime.UtcNow;

                Message msgout = new Message(pud);
                msgout.Label = "pricingUpdate";

                string outQueue = System.Configuration.ConfigurationManager.AppSettings["CoreOutQueue"];
                QueueManager.Instance().SetOut(outQueue);
                QueueManager.Instance().EnqueueOut(msgout);

                FlashOK("El mensaje fue encolado con exito");
            }
            catch (Exception ex)
            {
                FlashOK(string.Format("Hubo un problema al enviar el mensaje => {0}", ex.Message));
            }

            return(View());
        }