예제 #1
0
        private static void SaveDataTable()
        {
            try
            {
                using (var db = new OtakEntities())
                {
                    db.GpsDataGenerated.RemoveRange(db.GpsDataGenerated);

                    db.SaveChanges();

                    GpsDataGenerated gpsDataGenerated = null;

                    for (int i = 0; i < LatLngDetailList.Count; i++)
                    {
                        gpsDataGenerated           = new GpsDataGenerated();
                        gpsDataGenerated.Latitude  = LatLngDetailList[i].Lat;
                        gpsDataGenerated.Longitude = LatLngDetailList[i].Lng;
                        gpsDataGenerated.Id        = i + 1;
                        db.GpsDataGenerated.Add(gpsDataGenerated);
                        db.SaveChanges();
                    }
                    Console.WriteLine("Db Save Changes Suuccessfully...");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
예제 #2
0
        public static List <GpsDataGenerated> GetPointList()
        {
            List <GpsDataGenerated> retList = new List <GpsDataGenerated>();

            try
            {
                using (var db = new OtakEntities())
                {
                    retList = db.GpsDataGenerated.OrderBy(o => o.Id).ToList();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                throw;
            }
            return(retList);
        }