Esempio n. 1
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());
        }
Esempio n. 2
0
        public ActionResult CreateAndSend(DataCenterLogic.DataCenterTypesIDE.ShipPositionRequestType spr, int accessTypeIndex, int requestTypeIndex, string itemElementIndex, string strStartTime, string strStopTime)
        {
            var cfgman = new ConfigurationManager();

            DateTime dateStartTime = DateTime.UtcNow;
            DateTime dateStopTime  = DateTime.UtcNow;

            if (spr.IMONum.Trim().Length == 0)
            {
                ModelState.AddModelError("IMONum", "Numero OMI requerido");
            }
            if (spr.DataUserProvider.Trim().Length == 0)
            {
                ModelState.AddModelError("DataUserProvider", "LRIT Id del DataCenter requerido");
            }

            if (new int[] { 2, 3, 4, 5, 6, 7, 10, 11 }.Contains(requestTypeIndex))
            {
                if (DateTime.TryParse(strStartTime, out dateStartTime) == false)
                {
                    ModelState.AddModelError("StartTime", "Fecha Inicio requerida");
                }
                if (DateTime.TryParse(strStopTime, out dateStopTime) == false)
                {
                    ModelState.AddModelError("StopTime", "Fecha Fin requerida");
                }
            }

            if (accessTypeIndex == 3 || accessTypeIndex == 5)
            {
                string ItemField   = this.Request.Params["ItemField"];
                string ItemElement = this.Request.Params["ItemElement"];
                if (ItemElement == "Port")
                {
                    spr.ItemElementName = DataCenterLogic.DataCenterTypesIDE.ItemChoiceType.Port;
                }
                if (ItemElement == "PortFacility")
                {
                    spr.ItemElementName = DataCenterLogic.DataCenterTypesIDE.ItemChoiceType.PortFacility;
                }

                spr.Item = ItemField;
            }



            ViewData["AccessType"]  = accessTypeIndex.ToString();
            ViewData["RequestType"] = requestTypeIndex.ToString();
            if (!ModelState.IsValid)
            {
                return(ShowNewView(requestTypeIndex, accessTypeIndex));
            }

            if (accessTypeIndex != 6)
            {
                spr.MessageType = DataCenterLogic.DataCenterTypesIDE.messageTypeType1.Item4;
            }
            else
            {
                spr.MessageType = DataCenterLogic.DataCenterTypesIDE.messageTypeType1.Item5;
            }

            spr.MessageId = MessageIdManager.Generate("1005");
            //spr.IMONum;
            //spr.DataUserProvider

            if (accessTypeIndex == 0)
            {
                spr.AccessType = DataCenterLogic.DataCenterTypesIDE.accessTypeType.Item0;
            }
            else if (accessTypeIndex == 1)
            {
                spr.AccessType = DataCenterLogic.DataCenterTypesIDE.accessTypeType.Item1;
            }
            else if (accessTypeIndex == 2)
            {
                spr.AccessType = DataCenterLogic.DataCenterTypesIDE.accessTypeType.Item2;
            }
            else if (accessTypeIndex == 3)
            {
                spr.AccessType = DataCenterLogic.DataCenterTypesIDE.accessTypeType.Item3;
            }
            else if (accessTypeIndex == 5)
            {
                spr.AccessType = DataCenterLogic.DataCenterTypesIDE.accessTypeType.Item5;
            }
            else if (accessTypeIndex == 6)
            {
                spr.AccessType = DataCenterLogic.DataCenterTypesIDE.accessTypeType.Item6;
            }


            //spr.Item
            if (itemElementIndex != null)
            {
                spr.ItemElementName = (DataCenterLogic.DataCenterTypesIDE.ItemChoiceType)Enum.Parse(typeof(DataCenterLogic.DataCenterTypesIDE.ItemChoiceType), itemElementIndex);
            }

            //this.Request.Params["
            //spr.Distance = ;
            spr.RequestType     = (DataCenterLogic.DataCenterTypesIDE.requestTypeType)Enum.Parse(typeof(DataCenterLogic.DataCenterTypesIDE.requestTypeType), "Item" + requestTypeIndex.ToString());
            spr.RequestDuration = new DataCenterLogic.DataCenterTypesIDE.requestDurationType();

            if (spr.RequestType == DataCenterLogic.DataCenterTypesIDE.requestTypeType.Item1 || spr.RequestType == DataCenterLogic.DataCenterTypesIDE.requestTypeType.Item9)
            {
                spr.RequestDuration.startTimeSpecified = false;
            }
            else
            {
                spr.RequestDuration.startTimeSpecified = true;
                spr.RequestDuration.startTime          = dateStartTime;
            }

            if (spr.RequestType == DataCenterLogic.DataCenterTypesIDE.requestTypeType.Item1 || spr.RequestType == DataCenterLogic.DataCenterTypesIDE.requestTypeType.Item9)
            {
                spr.RequestDuration.stopTimeSpecified = false;
            }
            else
            {
                spr.RequestDuration.stopTimeSpecified = true;
                spr.RequestDuration.stopTime          = dateStopTime;
            }

            spr.DataUserRequestor = "1005";//;cfgman.Configuration.DataCenterID;
            spr.TimeStamp         = DateTime.UtcNow;
            spr.DDPVersionNum     = DDPVersionManager.currentDDP();
            spr.schemaVersion     = decimal.Parse(cfgman.Configuration.SchemaVersion);
            spr.test = DataCenterLogic.DataCenterTypesIDE.testType.Item1;

            Message msgout = new Message(spr);

            msgout.Label = "shipPositionRequest";

            string outQueue = System.Configuration.ConfigurationManager.AppSettings["CoreOutQueue"];

            QueueManager.Instance().SetOut(outQueue);
            QueueManager.Instance().EnqueueOut(msgout);

            return(View("Sent"));
        }