Exemplo n.º 1
0
 public DDPVersion GetRegularDDPVersion(string version)
 {
     using (var ddpda = new DDPVersionDataAccess())
     {
         return(ddpda.GetRegularDDPVersion(version));
     }
 }
Exemplo n.º 2
0
 public DDPVersion DDPFromDate(DateTime startTime)
 {
     using (var ddpa = new DDPVersionDataAccess())
     {
         return(ddpa.DDPForDate(startTime));
     }
 }
Exemplo n.º 3
0
 public static string currentDDP()
 {
     using (var ddpda = new DDPVersionDataAccess())
     {
         var dv = ddpda.TodaysDDP();
         return(dv.regularVer + ":" + dv.inmediateVer);
     }
 }
Exemplo n.º 4
0
        public ActionResult ShowNewView(int?requestType, int?accessType)
        {
            List <ItemDrop> AccessTypeIndex  = new List <ItemDrop>();
            List <ItemDrop> RequestTypeIndex = new List <ItemDrop>();
            List <string>   ItemElementIndex = new List <string>();

            AccessTypeIndex.Clear();
            RequestTypeIndex.Clear();
            ItemElementIndex.Clear();

            AccessTypeIndex.Add(new ItemDrop("0 - Reset entitlement", "0"));
            AccessTypeIndex.Add(new ItemDrop("1 - Coastal State", "1"));
            AccessTypeIndex.Add(new ItemDrop("2 - Flag State", "2"));
            AccessTypeIndex.Add(new ItemDrop("3 - Port State with distance trigger", "3"));
            AccessTypeIndex.Add(new ItemDrop("5 - Port with time trigger", "5"));
            AccessTypeIndex.Add(new ItemDrop("6 - SAR", "6"));

            ItemElementIndex.Add("Place");
            ItemElementIndex.Add("Port");
            ItemElementIndex.Add("PortFacility");

            RequestTypeIndex.Add(new ItemDrop("0 - Reset", "0"));
            RequestTypeIndex.Add(new ItemDrop("1 - One Time Poll", "1"));
            RequestTypeIndex.Add(new ItemDrop("2 - 15 min Period", "2"));
            RequestTypeIndex.Add(new ItemDrop("3 - 30 min Period", "3"));
            RequestTypeIndex.Add(new ItemDrop("4 - 1 hour Period", "4"));
            RequestTypeIndex.Add(new ItemDrop("5 - 3 hour Period", "5"));
            RequestTypeIndex.Add(new ItemDrop("6 - 6 hour Period", "6"));
            RequestTypeIndex.Add(new ItemDrop("7 - Archived LRIT info request", "7"));
            RequestTypeIndex.Add(new ItemDrop("8 - Stop sending position reports", "8"));
            RequestTypeIndex.Add(new ItemDrop("9 - Most recent Position", "9"));
            RequestTypeIndex.Add(new ItemDrop("10 - 12 hour Period", "10"));
            RequestTypeIndex.Add(new ItemDrop("11 - 24 hour Period", "11"));


            if (accessType == 0)
            {
                RequestTypeIndex.Clear();
                RequestTypeIndex.Add(new ItemDrop("Reset", "0"));
            }

            ViewData["AccessTypeIndex"]  = new SelectList(AccessTypeIndex, "ID", "NAME", accessType);
            ViewData["RequestTypeIndex"] = new SelectList(RequestTypeIndex, "ID", "NAME", requestType);
            ViewData["ItemElement"]      = new SelectList(ItemElementIndex);


            var ddpda = new DDPVersionDataAccess();

            ViewData["ItemField"] = new SelectList(BuildPlaceDropDown(ddpda.TodaysDDP().Id), "ID", "NAME");

            ViewData["AccessType"]  = accessType.ToString();
            ViewData["RequestType"] = requestType.ToString();

            return(View("New"));
        }
Exemplo n.º 5
0
        static public DDPVersion InsertCompleteDDP(string version, DateTime publishDate, byte[] file)
        {
            var ddpVersion = new DDPVersion();

            using (var ddpvda = new DDPVersionDataAccess())
            {
                ddpVersion.published_at = publishDate;
                ddpVersion.received_at  = DateTime.UtcNow;
                ddpVersion.regularVer   = version.Split(':')[0];
                ddpVersion.inmediateVer = version.Split(':')[1];
                ddpVersion.DDPFile      = file;
                ddpvda.InsertCompleteDDP(ddpVersion);
                return(ddpVersion);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Procesa un mensaje de tipo DDP Update.
        /// Esta funcion utiliza el DDPImportHelper para incorporar la informacion del DDP en formato XML a la base de datos.
        /// </summary>
        /// <param name="msg">Mensaje de DDP Update</param>
        public void ProcessDDPUpdate(DDPUpdateType ddpUpdate)
        {
            DDPUpdate dbupd;

            using (DDPUpdateDataAccess dao = new DDPUpdateDataAccess())
            {
                dbupd = dao.Create(TypeHelper.Map2DB(ddpUpdate), 0);
            }

            if (ddpUpdate.UpdateType != DDPUpdateTypeUpdateType.Item4)
            {
                //Full??
                if (ddpUpdate.UpdateType == DDPUpdateTypeUpdateType.Item3)
                {
                    ICSharpCode.SharpZipLib.Zip.ZipFile zipFile = new ZipFile(new MemoryStream(ddpUpdate.DDPFile));

                    var ddpVersion = InsertCompleteDDP(ddpUpdate, DateTime.UtcNow.AddYears(-100));

                    log.Info("ProcessDDPUpdate: Starting full");
                    DDPImportHelper importer = new DDPImportHelper();
                    ddpVersion.published_at = importer.Import(zipFile.GetInputStream(0), ddpVersion);
                    zipFile.Close();

                    using (DDPVersionDataAccess ddpverda = new DDPVersionDataAccess())
                    {
                        ddpverda.update(ddpVersion);
                    }
                }
                else
                {
                    //Salvamos como updates pendientes y luego el scheduler procesa (incrementales y regulares)
                    ICSharpCode.SharpZipLib.Zip.ZipFile zipFile = new ZipFile(new MemoryStream(ddpUpdate.DDPFile));
                    DDPImportHelper importer = new DDPImportHelper();
                    importer.SavePendingUpdates(zipFile.GetInputStream(0), dbupd.Id);
                    log.Info("ProcessDDPUpdate: Saved in pending updates..");
                    zipFile.Close();
                }
            }
            else
            {
                log.Info("ProcessDDPUpdate: Not processing archived or mixed incr/reg ddpupdate");
            }

            log.Info("ProcessDDPUpdate: DDPUpdate finished");
        }
Exemplo n.º 7
0
        /// <summary>
        /// Procesa un mensaje de tipo DDP Notification.
        /// Esta funcion incorpora el mensaje a la base de datos y pide al DDP un requerimiento de actualizacion
        /// </summary>
        /// <param name="msg">Mensaje DDPNotification</param>
        public void ProcessDDPNotification(DDPNotificationType ddpNotification)
        {
            var ddpRequest = new DataCenterLogic.DDPServerTypes.DDPRequestType();

            ConfigurationManager configMgr = new ConfigurationManager();

            var dver = new DDPVersionDataAccess();
            var ver  = dver.TodaysDDP();

            ddpRequest.ArchivedDDPTimeStamp          = DateTime.UtcNow;
            ddpRequest.ArchivedDDPTimeStampSpecified = false;
            ddpRequest.ArchivedDDPVersionNum         = null;
            ddpRequest.DDPVersionNum = ver.regularVer + ":" + ver.inmediateVer;
            ddpRequest.MessageId     = MessageIdManager.Generate();
            ddpRequest.MessageType   = DataCenterLogic.DDPServerTypes.messageTypeType.Item9;
            ddpRequest.Originator    = configMgr.Configuration.DataCenterID;
            ddpRequest.schemaVersion = decimal.Parse(configMgr.Configuration.SchemaVersion);
            ddpRequest.test          = DataCenterLogic.DDPServerTypes.testType.Item1;
            ddpRequest.TimeStamp     = DateTime.UtcNow;

            //Si el notification es 0 (Regular) pedimos regular
            if (ddpNotification.UpdateType == DDPNotificationTypeUpdateType.Item0)
            {
                ddpRequest.UpdateType = DataCenterLogic.DDPServerTypes.DDPRequestTypeUpdateType.Item0;
            }

            //Si el notification es 1 (Inmediate) pedimos inmediate
            if (ddpNotification.UpdateType == DDPNotificationTypeUpdateType.Item1)
            {
                ddpRequest.UpdateType = DataCenterLogic.DDPServerTypes.DDPRequestTypeUpdateType.Item1;
            }

            //Enqueue DDPrequest
            Message msgout = new Message(ddpRequest);

            msgout.Label = "ddpRequest";
            QueueManager.Instance().EnqueueOut(msgout);

            using (DDPNotificationDataAccess dao = new DDPNotificationDataAccess())
            {
                dao.Create(TypeHelper.Map2DB(ddpNotification), 0);
            }
            log.Info("DDPNotification successfully processed");
        }
Exemplo n.º 8
0
        public ActionResult GridData(int page, int rows, string[] _search, string sidx, string sord, int?ddpid)
        {
            string[]      ReqParams = { "Name", "DataCenterId", "LRITId", "PlaceStringId", "PlaceName", "AreaType", "PlaceId" };
            List <string> columns   = new List <string>();
            List <string> querys    = new List <string>();


            //Vectores Apareados SearchQuery, Columns
            for (int i = 0; i < ReqParams.Count(); i++)
            {
                var tempValue = Request.Params[ReqParams[i]];
                if (tempValue != null)
                {
                    columns.Add(ReqParams[i]);
                    querys.Add(tempValue);
                }
            }

            var ddpda = new DDPVersionDataAccess(context);
            var ddp   = new DDPVersion();

            if (ddpid == null)
            {
                ddpid = ddpda.TodaysDDP().Id;
            }

            var ddpdata = ddpda.GetAllFromVersion((int)ddpid);

            var model = from entity in ddpdata.OrderBy(sidx + " " + sord)
                        select new
            {
                Name          = entity.Name,
                DataCenterId  = entity.DataCenterId,
                LRITId        = entity.LRITId,
                PlaceStringId = entity.PlaceStringId,
                PlaceName     = entity.PlaceName,
                AreaType      = entity.AreaType,
                PlaceId       = entity.PlaceId.ToString(),
            };

            return(Json(model.ToJqGridData(page, rows, null, querys.ToArray(), columns.ToArray())));
        }
Exemplo n.º 9
0
        //
        // GET: /Receipt/
        public ActionResult List(int?ddpid)
        {
            var ddpda = new DDPVersionDataAccess(context);

            DDPVersion ddpVersion;

            if (ddpid == null)
            {
                ddpVersion = ddpda.TodaysDDP();
            }
            else
            {
                ddpVersion = ddpda.GetVersionById((int)ddpid);
            }

            ViewData["version"] = ddpVersion.regularVer + ":" + ddpVersion.inmediateVer;
            ViewData["ddpId"]   = ddpid;

            return(View());
        }
Exemplo n.º 10
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"));
        }