Exemple #1
0
        static void Main(string[] args)
        {
            using (var db = new ProjectContext())
            {
                Coordinate coor = new Coordinate(5, 4);

                var f  = new ReportFall(65, new DateTime(1998, 3, 3), "kkk", "sss", "sss", 2, 2, coor);
                var f2 = new Reporter("mayshar", "1234");
                var f3 = new Analystic("sara", "1234");
                //var f = new ReportFall();// (600,new DateTime(1998,6,6),"name","street","city",2,2,3,3);
                Console.WriteLine("start");
                db.Reports.Add(f);
                db.Reporters.Add(f2);
                db.Analystics.Add(f3);
                Console.WriteLine("mid");
                db.SaveChanges();
                Console.WriteLine("finish");
                //updating
                //var result = db.Falls.SingleOrDefault(f1 => f1.FallId == 3);
                //if (result != null)
                //{
                //    Console.WriteLine("if_start");
                //    result.LatFall = 100;
                //    db.SaveChanges();
                //    Console.WriteLine("if_end");
                //}
                //var f4 = new ReportFall(65, new DateTime(2019, 9, 3,7,32,0), "sari", "Ahad Ha'Am St 3", "Ramat Gan", 1, 2, coor);
                //var f5 = new Fall(3, "Matania 19 - 11", "Ramat Gan", Coordinate coordinateF, DateTime date, String imageLocation));
            }
        }
Exemple #2
0
 public Model()
 {
     CurFall    = new Fall();
     CurRepFall = new ReportFall();
     CurUser    = new User();
     Bl         = BL.FactoryBL.GetBL();
     CurKmeans  = Bl.GetKMeans();
 }
 public void DelReportFall(ReportFall newReport)
 {
     if (GetReport(newReport.DateRep, newReport.NameReporter) == null)
     {
         throw new Exception("The fall is not exist");
     }
     //else
     //   DataSource.Remove(newFall);
 }
 public async void AddReportFall(ReportFall newReport)
 {
     // if (GetReport(newReport.DateRep, newReport.NameReporter) != null)
     //     throw new Exception("The fall is already exist");
     // else
     // {
     using (var db = new ProjectContext())
     {
         db.Reports.Add(newReport);
         await db.SaveChangesAsync();
     }
     //   }
 }
 public void AddNewReport()
 {
     try
     {
         CurrentModel.CurRepFall.CoordinateR = CurrentModel.Bl.GetCoordinate(CurrentModel.CurRepFall.City, CurrentModel.CurRepFall.Address);
         CurrentModel.Bl.AddReportFall(CurrentModel.CurRepFall);
         TheReportFall = new ReportFall();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemple #6
0
 public void UpdateReportFall(ReportFall newReport)
 {
     if (newReport.DateRep > DateTime.Now)
     {
         throw new Exception("The date is not valid");
     }
     if (newReport.BoomsN <= 0)
     {
         throw new Exception("The number is not valid");
     }
     if (newReport.Intensity < 1 || newReport.Intensity > 10)
     {
         throw new Exception("The Intensity is not valid");
     }
     myDal.UpdateReportFall(newReport);
 }
        public async void UpdateReportFall(ReportFall newReport)
        {
            using (var db = new ProjectContext())
            {
                var result = db.Reports.SingleOrDefault(r1 => r1.DateRep == newReport.DateRep && r1.NameReporter == newReport.NameReporter);

                if (result == null)
                {
                    throw new Exception("Report Fall doesnt exist");
                }
                else
                {
                    result = newReport;
                    await db.SaveChangesAsync();
                }
            }
        }
Exemple #8
0
        public void AddReportFall(ReportFall newReportFall)
        {
            if (newReportFall.DateRep > DateTime.Now)
            {
                throw new Exception("future date is not valid");
            }
            if (newReportFall.BoomsN <= 0)
            {
                throw new Exception("The number is not valid");
            }
            var x = newReportFall.Intensity;

            if (newReportFall.Intensity < 1 || newReportFall.Intensity > 10)
            {
                throw new Exception("The Intensity is not valid");
            }
            //צריך להכניס את הנקודות ציון
            myDal.AddReportFall(newReportFall);
        }
Exemple #9
0
        public void AddReportFall(ReportFall newReportFall)
        {
            if (newReportFall.DateRep > DateTime.Now)
            {
                throw new Exception("The date is not valid");
            }
            if (newReportFall.BoomsN <= 0)
            {
                throw new Exception("The number is not valid");
            }
            var x = newReportFall.Intensity;

            if (newReportFall.Intensity < 1 || newReportFall.Intensity > 10)
            {
                throw new Exception("The Intensity is not valid");
            }
            //צריך להכניס את הנקודות ציון
            Coordinate tmp = new Geocoder().Geocode(newReportFall.Address, newReportFall.City);

            newReportFall.CoordinateR = new Coordinate(tmp.Latitude, tmp.Longitude);
            myDal.AddReportFall(newReportFall);
        }
Exemple #10
0
 public void DelReportFall(ReportFall newReport)
 {
     throw new NotImplementedException();
 }
 public ReportModel()
 {
     CurRepFall = new ReportFall();
     Bl         = BL.FactoryBL.GetBL();
 }