Exemple #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);
            }
        }
Exemple #2
0
        private void MakeComboSARService()
        {
            DDPVersionManager v = new DDPVersionManager();
            var pepe            = new List <object>();

            foreach (var sser in context.SARServices.Where(ss => ss.ContractingGoverment.LRITId == 1005 && ss.ContractingGoverment.DDPVersion.Id == v.GetCurrentDDPVersion().Id))
            {
                pepe.Add(new { @id = sser.LRITid, @value = sser.Name + " (" + sser.LRITid + ") " });
            }
            ViewData["sar_services"] = pepe;
        }
Exemple #3
0
        //
        // GET: /Receipt/
        public ActionResult List(int msgInOut)
        {
            DDPVersionManager v = new DDPVersionManager();

            ViewData["msgInOut"]        = msgInOut;
            ViewData["LritIDNamePairs"] = ContractingGovermentManager.LritIdNamePairs(v.GetCurrentDDPVersion().Id);
            return(View());
        }
Exemple #4
0
        public ActionResult List(int msgInOut, string refid)
        {
            DDPVersionManager v = new DDPVersionManager();

            if (refid != null)
            {
                ViewData["referenceId"] = refid;
            }

            ViewData["msgInOut"]        = msgInOut;
            ViewData["LritIDNamePairs"] = ContractingGovermentManager.LritIdNamePairs(v.GetCurrentDDPVersion().Id);

            return(View("List"));
        }