Exemple #1
0
        public static void AddFL(FallLocation fl)
        {
            //add to DATALayer
            Report report = FlToReport(fl);

            bl.AddReport(report);


            //add fitt gouplist
            string key     = CreateKey(fl.Date);
            bool   isAdded = false;

            foreach (var item in FallLocationData)
            {
                if (item.GruopId.Equals(key))
                {
                    item.FallsLocationlist.Add(fl);
                    isAdded = true;
                    break;
                }
            }
            if (!isAdded)
            {
                FallsLocationGroup flg = new FallsLocationGroup(key);
                flg.FallsLocationlist.Add(fl);
                FallLocationData.Add(flg);
            }
            if (DataChanged != null)
            {
                DataChanged.Invoke();
            }
            ;
        }
Exemple #2
0
 public FallLocation(FallLocation fl)
 {
     ID            = fl.ID;
     Adress        = fl.Adress;
     Date          = fl.Date;
     NumberOfFalls = fl.NumberOfFalls;
 }
Exemple #3
0
        public static FallLocation FromReportToFallLocation(Report r)
        {
            FallLocation fl = new FallLocation();

            fl.Adress        = r.Report_Adress;
            fl.Date          = r.Time.ToString();
            fl.ID            = r.Report_Id;
            fl.NumberOfFalls = r.Boom_count;
            return(fl);
        }
Exemple #4
0
        //TODO: implement this with  ניתוח אשכולות
        internal static FallLocation EstimateFallLocation(ObservableCollection <FallLocation> fallsLocationlist)
        {
            List <FallLocation> flList = new List <FallLocation>(fallsLocationlist);
            List <Drop>         res    = bl.CalculateEstimateDrop(ListOfFallLocationToReports(flList));
            FallLocation        fl     = new FallLocation();

            fl.Adress        = res.First().Drop_Adress;
            fl.Date          = res.First().Drop_time.ToString();
            fl.ID            = res.First().Drop_Id; //צריך לבדוק ID או REOPRT_ID
            fl.NumberOfFalls = 1;                   //logically correct
            return(fl);
        }
Exemple #5
0
        static FallLocation EvaluateEstimateFallLocation(ObservableCollection <FallLocation> fallLocations)
        {
            //TODO Implement for real
            List <FallLocation> flList = new List <FallLocation>(fallLocations);
            List <Drop>         res    = bl.CalculateEstimateDrop(ListOfFallLocationToReports(flList));
            FallLocation        fl     = new FallLocation();

            fl.Adress        = res.First().Drop_Adress;
            fl.Date          = res.First().Drop_time.ToString();
            fl.ID            = res.First().Drop_Id;
            fl.NumberOfFalls = 1; //logically correct

            return(fl);
        }
Exemple #6
0
 public FallLocation(string adress, string date, int numberOfFalls, Action sucsess, Action fail)
 {
     try
     {
         FallLocation fl = new FallLocation(adress, date, numberOfFalls);
         ID            = fl.ID;
         Adress        = fl.Adress;
         Date          = fl.Date;
         NumberOfFalls = fl.NumberOfFalls;
         sucsess();
     }
     catch
     {
         fail();
     }
 }
Exemple #7
0
        public static Report FlToReport(FallLocation fl)
        {
            DateTime enteredDate = DateTime.Parse(fl.Date);

            double[] latLog = bl.GetCoordinate(fl.Adress);

            Report r = new Report();

            r.lat           = latLog[0];
            r.log           = latLog[1];
            r.Report_Adress = fl.Adress;
            r.Time          = enteredDate;
            r.Report_Id     = fl.ID;
            r.Boom_count    = fl.NumberOfFalls;
            return(r);
        }
Exemple #8
0
        private static int GetDistance(FallLocation efl, FallLocation afl)
        {
            //TODO impliment real one, now it return a random number
            double[] d1ll = { 0, 0 };
            double[] d2ll = { 0, 0 };
            d1ll = bl.GetCoordinate(efl.Adress);
            d2ll = bl.GetCoordinate(afl.Adress);
            Drop d1 = new Drop {
                Estimeated_lat = d1ll[0], Estimeated_log = d1ll[1]
            };
            Drop d2 = new Drop {
                Estimeated_lat = d2ll[0], Estimeated_log = d2ll[1]
            };
            int result = (int)bl.EvaluateDistance(d1, d2);

            return(result);
        }
 public void AddFallLocation(FallLocation fl)
 {
     FallsLocationlist.Add(fl);
     //        FallLocationChanged.BeginInvoke(this, null, null);
 }