예제 #1
0
        private void barButtonItem7_ItemClick(object sender, ItemClickEventArgs e)
        {
            panelMain.Controls.Clear();
            BoatLostInfor uc = new BoatLostInfor();

            uc.Dock = DockStyle.Fill;
            panelMain.Controls.Add(uc);
        }
        public bool Insert(DateTime Lastconnect, float lat, float Long, int ID_jouney, bool status, int ID_boat, string ocean)
        {
            BoatLostInfor BoatLostInfor = new BoatLostInfor();

            BoatLostInfor.IDBoat      = ID_boat;
            BoatLostInfor.Latitude    = lat;
            BoatLostInfor.Longitude   = Long;
            BoatLostInfor.LastConnect = Lastconnect;
            BoatLostInfor.Ocean       = ocean;
            BoatLostInfor.Status      = status;
            BoatLostInfor.IDJourney   = ID_jouney;
            try
            {
                db.BoatLostInfor.InsertOnSubmit(BoatLostInfor);
                db.SubmitChanges();
                return(true);
            }
            catch
            {
                return(false);
            }
        }
        public bool Update(int ID, DateTime timeconnect, float lat, float Long, int ID_jouney, string ocean)
        {
            BoatLostInfor boatlost = db.BoatLostInfor.Where(p => p.ID == ID).FirstOrDefault();

            try
            {
                Position po = new Position();
                po.IDJourney = ID_jouney;
                po.Latitude  = lat;
                po.Longitude = Long;
                po.Time      = timeconnect;
                po.Oceans    = ocean;
                db.Position.InsertOnSubmit(po);
                db.SubmitChanges();

                db.BoatLostInfor.DeleteOnSubmit(boatlost);
                db.SubmitChanges();
                return(true);
            }
            catch
            {
                return(false);
            }
        }