コード例 #1
0
        public DataSet GetPositionsOnStandingOrder()
        {
            using (var sqlconn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["mio"].ConnectionString))
            {
                sqlconn.Open();
                var dsout = new DataSet();
                var dt    = new DataTable();
                var pos   = new SqlGeography();

                ShipDataAccess          sda  = null;
                StandingOrderDataAccess soda = null;

                using (var da = new SqlDataAdapter("SELECT * FROM AIS", sqlconn))
                {
                    da.Fill(dt);
                }
                dt.Columns.Add("LATITUD", typeof(Decimal));
                dt.Columns.Add("LONGITUD", typeof(Decimal));

                foreach (DataRow row in dt.Rows)
                {
                    try
                    {
                        sda  = new ShipDataAccess();
                        soda = new StandingOrderDataAccess();

                        var spman               = new ShipPositionManager();
                        var ddpman              = new DDPVersionManager();
                        var ddpver              = ddpman.GetCurrentDDPVersion();
                        var lastpos             = spman.GetLastShipPosition(sda.getById((int)row["ID_BARCO"]).IMONum);
                        List <StandingOrder> so = new List <StandingOrder>();
                        if (lastpos != null)
                        {
                            so = soda.GetOrdersForPosition(lastpos, ddpver);
                        }
                        if (so.Count == 0)
                        {
                            dt.Rows.Remove(row);
                            continue;
                        }
                    }
                    catch (Exception ex)
                    {
                        System.Diagnostics.Debug.WriteLine(ex);
                    }
                    finally
                    {
                        sda.Dispose();
                        soda.Dispose();
                    }

                    pos             = SqlGeography.STGeomFromWKB(new SqlBytes((byte[])row["Position"]), 4326);
                    row["LATITUD"]  = decimal.Parse(pos.Lat.ToString());
                    row["LONGITUD"] = decimal.Parse(pos.Long.ToString());
                }
                dt.Columns.Remove("Position");
                dsout.Tables.Add(dt);
                return(dsout);
            }
        }
コード例 #2
0
    private void InitializeScripts()
    {
        PrefabsList = this.GetComponent <PrefabsList>();
        UI          = this.GetComponent <UI>();

        Movement = this.GetComponent <ShipMovementScript>();
        Position = this.GetComponent <ShipPositionManager>();
    }
コード例 #3
0
 void OnTriggerEnter(Collider ship)
 {
     //Debug.Log("Algo ha entrado en el" + this.gameObject.name); Funciona
     spm = ship.gameObject.GetComponent <ShipPositionManager>();
     if (spm.cp == 9 && CPnumber == 0)
     {
         spm.lap++;
         if (spm.gameObject.tag == "Player")
         {
             laptext.upgradeLap(spm.lap);
         }
     }
     spm.updateCP(CPnumber);
 }
コード例 #4
0
        public ActionResult Index()
        {
            if (User.IsInRole("ExternoVerificarFacturas"))
            {
                return(RedirectToAction("List", "ExternalInvoice"));
            }

            if (User.IsInRole("Facturador"))
            {
                return(RedirectToAction("List", "Contract"));
            }

            // Barcos
            var         sda    = new ShipDataAccess(context);
            var         sman   = new ShipManager();
            var         spman  = new ShipPositionManager();
            var         asprda = new ActiveShipPositionRequestDataAccess(context);
            List <Ship> barcos = sda.GetAll();

            string[] latlong = { "N/A", "N/A" };

            int i = 0;

            foreach (Ship barco in barcos)
            {
                ViewData[string.Format("State{0}", i)] = "normal"; //sman.GetShipState(barco);

                DataCenterDataAccess.ShipPosition LastPos = spman.GetLastShipPosition(barco.IMONum);
                if (LastPos == null)
                {
                    latlong[0] = "N/A";
                    latlong[1] = "N/A";
                }
                else
                {
                    latlong = spman.GetLatLongOfPoint(LastPos);
                }

                ViewData[string.Format("Nombre{0}", i)] = barco.Name.ToString();
                ViewData[string.Format("OMIId{0}", i)]  = barco.IMONum.ToString();
                if (LastPos != null)
                {
                    string temp  = latlong[0].Length > 6 ? latlong[0].Remove(6) : latlong[0];
                    string temp2 = latlong[1].Length > 6 ? latlong[1].Remove(6) : latlong[1];
                    ViewData[string.Format("UltimaPosicion{0}", i)] = "Lat: " + temp + " Long: " + temp2;
                    ViewData[string.Format("Fecha{0}", i)]          = LastPos.TimeStamp.ToString();
                }
                else
                {
                    ViewData[string.Format("UltimaPosicion{0}", i)] = "Lat: N/A Long: N/A";
                    ViewData[string.Format("Fecha{0}", i)]          = "N/A";
                }
                i++;
            }
            ViewData["total_barcos"] = i;
            //ViewData["total_barcos"] = 0;


            //Status

            int      status, aspStatus;
            TimeSpan since, aspSince;
            var      ssman = new SystemStatusManager();

            /*
             * ssman.getLastStatus(out status, out since);
             * ssman.GetLastAspStatus(out aspStatus, out aspSince);
             *
             * ViewData["IDEStatus"] = status;
             * ViewData["IDESince"] = since;
             * ViewData["DDPStatus"] = status;
             * ViewData["DDPSince"] = since;
             * ViewData["ASPStatus"] = aspStatus;
             * ViewData["ASPSince"] = aspSince;
             *
             * ViewData["AsprCount"] = asprda.Count();
             *
             * // Tráfico
             *
             * var tman = new TrafficManager();
             * var ts = tman.GetTrafficStats();
             *
             * ViewData["InMonth"] = ts.InMonth;
             * ViewData["InWeek"] = ts.InWeek;
             * ViewData["InDay"] = ts.InDay;
             * ViewData["OutMonth"] = ts.OutMonth;
             * ViewData["OutWeek"] = ts.OutWeek;
             * ViewData["OutDay"] = ts.OutDay;
             */


            return(View());
        }