Esempio n. 1
0
        /// <summary>
        /// Transforma un SARSURPICType en un SARSURPICRequest
        /// </summary>
        /// <param name="SARSURPICRequest">SARSURPICType</param>
        /// <returns>SARSURPICRequest</returns>
        public static SARSURPICRequest Map2DB(DataCenterLogic.DataCenterTypesIDE.SARSURPICType SARSURPICRequest)
        {
            SARSURPICRequest retSARSURPICRequest = new SARSURPICRequest();

            retSARSURPICRequest.DataUserRequestor = SARSURPICRequest.DataUserRequestor;
            retSARSURPICRequest.DDPVersionNum     = SARSURPICRequest.DDPVersionNum;
            retSARSURPICRequest.Item              = SARSURPICRequest.Item;
            retSARSURPICRequest.ItemElementName   = SARSURPICRequest.ItemElementName.ToString();
            retSARSURPICRequest.MessageId         = SARSURPICRequest.MessageId;
            retSARSURPICRequest.MessageType       = ToInt(SARSURPICRequest.MessageType);
            retSARSURPICRequest.NumberOfPositions = int.Parse(SARSURPICRequest.NumberOfPositions);
            retSARSURPICRequest.schemaVersion     = SARSURPICRequest.schemaVersion;
            retSARSURPICRequest.test              = ToInt(SARSURPICRequest.test);
            retSARSURPICRequest.TimeStamp         = SARSURPICRequest.TimeStamp;

            return(retSARSURPICRequest);
        }
Esempio n. 2
0
        private string SendSARSurpicRequest(Message msg)
        {
            DataCenterLogic.DataCenterTypesIDE.SARSURPICType SARSurpicReq = (DataCenterLogic.DataCenterTypesIDE.SARSURPICType)(msg.Body);

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

            //Guarda el mensaje en la base de datos
            using (var dao = new SARSURPICRequestDataAccess())
            {
                dao.Create(TypeHelper.Map2DB(SARSurpicReq), 1);
            }
            log.Info("SARSurpicReq stored");
            return(SARSurpicReq.MessageId);
        }
Esempio n. 3
0
        public ActionResult CreateAndSendSarsurpic(DataCenterLogic.DataCenterTypesIDE.SARSURPICType SARSURPICMsg, int areaIndex, int NumberOfPositions, string Lat, string Long, string var1, string var2)
        {
            var    cfgman  = new ConfigurationManager();
            var    ddpVer  = new DDPVersionDataAccess();
            var    sprda   = new SARSURPICRequestDataAccess(context);
            string strItem = string.Empty;



            MakeComboSARService();


            //\


            if (!Regex.IsMatch(Lat, @"(([0-8][0-9]\.[0-5][0-9]\.[nNsS])|(90\.00\.[nNsS]))"))
            {
                ModelState.AddModelError("Lat", "Latitud: El formato correcto es 00.00.N/S");
            }

            if (!Regex.IsMatch(Long, @"(([0-1][0-7][0-9]\.[0-5][0-9]\.[eEwW])|(180\.00\.[eEwW]))"))
            {
                ModelState.AddModelError("Long", "Longitud: El formato correcto es 000.00.E/W");
            }

            //SARSURPICMsg.DataUserRequestor = "1005";
            var v = ddpVer.TodaysDDP();

            SARSURPICMsg.DDPVersionNum = v.regularVer + ":" + v.inmediateVer;


            if (areaIndex == 0)
            {
                if (!Regex.IsMatch(var1, @"([0-9]{3})"))
                {
                    ModelState.AddModelError("var1", "Radio: El formato correcto es 000");
                }

                strItem                      = string.Format(Lat + ":" + Long + ":" + var1);
                SARSURPICMsg.Item            = strItem;
                SARSURPICMsg.ItemElementName = DataCenterLogic.DataCenterTypesIDE.ItemChoiceType1.SARCircularArea;
            }
            if (areaIndex == 1)
            {
                if (!Regex.IsMatch(var1, @"(([0-8][0-9]\.[0-5][0-9]\.[nN])|(90\.00\.[nN]))"))
                {
                    ModelState.AddModelError("var1", "Offset Norte: El formato correcto es 00.00.N");
                }

                if (!Regex.IsMatch(var2, @"(([0-1][0-7][0-9]\.[0-5][0-9]\.[eE])|(180\.00\.[eE]))"))
                {
                    ModelState.AddModelError("var2", "Offset Este: es 000.00.E");
                }

                strItem                      = string.Format(Lat + ":" + Long + ":" + var1 + ":" + var2);
                SARSURPICMsg.Item            = strItem;
                SARSURPICMsg.ItemElementName = DataCenterLogic.DataCenterTypesIDE.ItemChoiceType1.SARRectangularArea;
            }

            if (!ModelState.IsValid)
            {
                return(ShowNewSarsurpic(areaIndex));
            }

            SARSURPICMsg.MessageId   = MessageIdManager.Generate(SARSURPICMsg.DataUserRequestor);
            SARSURPICMsg.MessageType = (DataCenterLogic.DataCenterTypesIDE.messageTypeType2)Enum.Parse(typeof(DataCenterLogic.DataCenterTypesIDE.messageTypeType2), "Item6");
            //SARSURPICMsg.NumberOfPositions = dc3NumberOfPositions.Text;
            SARSURPICMsg.schemaVersion = decimal.Parse(cfgman.Configuration.SchemaVersion);
            SARSURPICMsg.test          = DataCenterLogic.DataCenterTypesIDE.testType.Item1;
            SARSURPICMsg.TimeStamp     = DateTime.UtcNow;



            Message msgout = new Message(SARSURPICMsg);

            msgout.Label = "SARSURPICRequest";

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

            QueueManager.Instance().SetOut(outQueue);

            QueueManager.Instance().EnqueueOut(msgout);

            //sprda.Create( TypeHelper.Map2DB(SARSURPICMsg), 1);


            return(View("Sent"));
        }