Exemple #1
0
        //TODO need to add to SQL
        internal static void AddAFL(AccurateFallLocation afl)
        {
            string key     = CreateKey(afl.Date);
            bool   isAdded = false;


            List <Report> r = new List <Report>();

            double[] latLog      = bl.GetCoordinate(afl.Adress);
            DateTime enteredDate = DateTime.Parse(afl.Date);
            Drop     d1          = new Drop
            {
                Drop_Id     = afl.ID,
                Drop_Adress = afl.Adress,
                Drop_time   = enteredDate,

                Reports_list   = r,
                Real_lat       = latLog[0],
                Real_log       = latLog[1],
                Estimeated_lat = latLog[0],
                Estimeated_log = latLog[1],
            };

            bl.AddDrop(d1);


            foreach (var item in FallLocationData)
            {
                if (item.GruopId.Equals(key))
                {
                    item.AccurateFallLocation = afl;
                    isAdded = true;
                    break;
                }
            }
            if (!isAdded)
            {
                FallsLocationGroup flg = new FallsLocationGroup(key)
                {
                    AccurateFallLocation = afl
                };
                FallLocationData.Add(flg);
            }
            if (DataChanged != null)
            {
                DataChanged.Invoke();
            }
            ;
        }
        public MainWindow()
        {
            #region test
            this.DataContext = new Entitys();
            List <Report> r = new List <Report>()
            {
                new Report
                {
                    Id            = 10,
                    Report_Id     = 23,
                    Time          = new DateTime(2000, 10, 10),
                    Name          = "Moshe",
                    Report_Adress = "report_Adress",
                    Boom_count    = 0,
                    ImagePath     = "imagePath",
                    lat           = 32.2323,
                    log           = 23.345324
                },
                new Report {
                    Id            = 11,
                    Report_Id     = 123,
                    Time          = new DateTime(2019, 10, 10),
                    Name          = "Netanel",
                    Report_Adress = "report_Adress",
                    Boom_count    = 0,
                    ImagePath     = "imagePath",
                    lat           = 32.2323,
                    log           = 23.345324
                }
            };
            Drop d = new Drop
            {
                Id             = 3,
                Drop_Id        = 344981147,
                Drop_Adress    = "drop_Adress",
                Drop_time      = new DateTime(2010, 10, 10),
                Reports_list   = r,
                Real_lat       = 2.3333,
                Real_log       = 4.5654,
                Estimeated_lat = 2.3333,
                Estimeated_log = 4.5654,
            };
            BL_imp bl    = new BL_imp();
            Drop   dNati = new Drop
            {
                Id          = 207544131,
                Drop_Id     = 207544131,
                Drop_Adress = "ישראל יבנה הזמיר 4",
                Drop_time   = new DateTime(2010, 10, 10),

                Reports_list   = r,
                Real_lat       = 0,
                Real_log       = 0,
                Estimeated_lat = 31.874153,
                Estimeated_log = 34.741990,
            };
            bl.AddDrop(dNati);

            for (int i = 0; i < 100; i++)
            {
                Random random = new Random();

                const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
                string       random_Drop_Adress = new string(Enumerable.Repeat(chars, 8)
                                                             .Select(s => s[random.Next(s.Length)]).ToArray());

                bl.AddDrop(d);
                d.Drop_Adress = random_Drop_Adress;
                d.Drop_Id++;
            }

            bool flag = true;

            while (flag)
            {
                flag = bl.RemoveDrop(d.Drop_Id);
                d.Drop_Id++;
            }

            #endregion
            InitializeComponent();
            //var pushpinLayer = new MapLayer();
            //pushpinLayer.Name = "PushPinLayer";
            //myMap.Children.Add(pushpinLayer);
            //Drop FromDB = bl.GetDropById(207544131);
            ////var location = new Location(31.874153, 34.741990);
            //var location = new Location(FromDB.Estimeated_lat, FromDB.Estimeated_log);
            //// var location = new Location(31.874153, 34.741990);
            //var pushpin = new Pushpin();
            //pushpin.Name = "MyNewPushpin";
            //pushpin.Background = new SolidColorBrush(Colors.Blue);
            //pushpin.Location = location;
            //pushpinLayer.AddChild(pushpin, location);
        }