コード例 #1
0
 public void removeClient(Client client)
 {
     try {
         CarpoolingDAL.Client cl = db.Clients.Single(o => o.idClient == client.Id);
         db.Clients.DeleteOnSubmit(cl);
         db.SubmitChanges();
     } catch (Exception) {
         //return false;
     }
     CarpoolingDAL.Route r = new CarpoolingDAL.Route();
     //return true;
 }
コード例 #2
0
 public bool existsRoute(int routeId)
 {
     CarpoolingDAL.Route oldOne = db.Routes.Single(o => o.idRoute == routeId);
     if (oldOne != null)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #3
0
 public void addPlace(Place place, Route route)
 {
     try {
         db.StartFinishes.InsertOnSubmit(RepositoryUtility.createDALStartFinishFromPlace(place, route));
         db.SubmitChanges();
     } catch (Exception) {
         //TODO saznaj koje su iznimke
         //iznimka se generira ako se narusi bilo koje pravilo vezano uz primary key ili foreign key. Znači, iznimka se
         //generira ako se pokuša dodati osoba koja ima JMBAG koji koristi neka druga osoba, zatim ako se pod osoba.sifUloga
         //stavi neki broj kojeg nema u tablici Uloga, itd..
         //return false;
     }
     //return true;
 }
コード例 #4
0
 public void addRoute(Route route)
 {
     try {
         PlaceRepository pr = PlaceRepository.getInstanca();
         db.Routes.InsertOnSubmit(RepositoryUtility.createDALRouteFromRoute(route));
         pr.addPlace(route.StartingPoint, route);
         pr.addPlace(route.Destination,route);
         db.SubmitChanges();
     } catch (Exception) {
         //TODO saznaj koje su iznimke
         //iznimka se generira ako se narusi bilo koje pravilo vezano uz primary key ili foreign key. Znači, iznimka se
         //generira ako se pokuša dodati osoba koja ima JMBAG koji koristi neka druga osoba, zatim ako se pod osoba.sifUloga
         //stavi neki broj kojeg nema u tablici Uloga, itd..
         //return false;
     }
     //return true;
 }
コード例 #5
0
 public void addFirmRoute(Route route, Client client)
 {
     try {
         CarpoolingDAL.FirmRoute fr = new FirmRoute();
         fr.idClient = client.Id;
         fr.idRoute = route.Id;
         db.FirmRoutes.InsertOnSubmit(fr);
         db.SubmitChanges();
     } catch (Exception) {
         //TODO saznaj koje su iznimke
         //iznimka se generira ako se narusi bilo koje pravilo vezano uz primary key ili foreign key. Znači, iznimka se
         //generira ako se pokuša dodati osoba koja ima JMBAG koji koristi neka druga osoba, zatim ako se pod osoba.sifUloga
         //stavi neki broj kojeg nema u tablici Uloga, itd..
         //return false;
     }
     //return true;
 }
コード例 #6
0
        public void removeRoute(Route route)
        {
            try {
                CarpoolingDAL.Route rt = db.Routes.Single(o => o.idRoute == route.Id);
                db.Routes.DeleteOnSubmit(rt);
                var places = db.StartFinishes.Where(s => s.idRoute == route.Id);

                foreach (CarpoolingDAL.StartFinish res in places)
                {
                    db.StartFinishes.DeleteOnSubmit(res);
                }
                db.SubmitChanges();
            } catch (Exception) {
                //return false;
            }

            //return true;
        }
コード例 #7
0
        public void updateRoute(Route route)
        {
            try {
                PlaceRepository     pr     = PlaceRepository.getInstanca();
                ResourceRepository  rer    = ResourceRepository.getInstanca();
                CarpoolingDAL.Route oldOne = db.Routes.Single(o => o.idRoute == route.Id);
                oldOne.name      = route.Name;
                oldOne.path      = route.Path.convertToBinary();
                oldOne.routeType = route.Type.Id;
                pr.updatePlace(route.StartingPoint, route);
                pr.updatePlace(route.Destination, route);
                db.SubmitChanges();
            } catch (Exception) {
                //return false;
            }

            //return true;
        }
コード例 #8
0
        public Route getRouteById(int idRoute)
        {
            PlaceRepository pr = PlaceRepository.getInstanca();

            CarpoolingDAL.Route rt = new CarpoolingDAL.Route();
            Route rrt = new Route();

            try {
                var query = db.Routes.Where(o => o.idRoute == idRoute).First();
                rt                = query as CarpoolingDAL.Route;
                rrt.Id            = rt.idRoute;
                rrt.Name          = rt.name;
                rrt.Path.PathDim  = rt.path.ToString();
                rrt.Type.Id       = rt.routeType;
                rrt.Type.Name     = ((db.RouteTypes.Where(o => o.idRouteType == rt.routeType).First()) as CarpoolingDAL.RouteType).name;
                rrt.Destination   = pr.getPlace(idRoute, Place.DESTINATION);
                rrt.StartingPoint = pr.getPlace(idRoute, Place.STARTING_POINT);
            } catch (Exception) {
                rrt = null;
            }

            return(rrt);
        }
コード例 #9
0
        public Route getRouteById(int idRoute)
        {
            PlaceRepository pr = PlaceRepository.getInstanca();
            CarpoolingDAL.Route rt = new CarpoolingDAL.Route();
            Route rrt = new Route();
            try {
                var query = db.Routes.Where(o => o.idRoute == idRoute).First();
                rt = query as CarpoolingDAL.Route;
                rrt.Id = rt.idRoute;
                rrt.Name = rt.name;
                rrt.Path.PathDim = rt.path.ToString();
                rrt.Type.Id = rt.routeType;
                rrt.Type.Name = ((db.RouteTypes.Where(o => o.idRouteType == rt.routeType).First()) as CarpoolingDAL.RouteType).name;
                rrt.Destination = pr.getPlace(idRoute, Place.DESTINATION);
                rrt.StartingPoint = pr.getPlace(idRoute, Place.STARTING_POINT);
            } catch (Exception) {
                rrt = null;
            }

            return rrt;
        }
コード例 #10
0
        public void updateRoute(Route route)
        {
            try {
                PlaceRepository pr = PlaceRepository.getInstanca();
                ResourceRepository rer = ResourceRepository.getInstanca();
                CarpoolingDAL.Route oldOne = db.Routes.Single(o => o.idRoute == route.Id);
                oldOne.name = route.Name;
                oldOne.path = route.Path.convertToBinary();
                oldOne.routeType = route.Type.Id;
                pr.updatePlace(route.StartingPoint, route);
                pr.updatePlace(route.Destination, route);
                db.SubmitChanges();
            } catch (Exception) {
                //return false;
            }

            //return true;
        }
コード例 #11
0
        public void removeRoute(Route route)
        {
            try {
                CarpoolingDAL.Route rt = db.Routes.Single(o => o.idRoute == route.Id);
                db.Routes.DeleteOnSubmit(rt);
                var places = db.StartFinishes.Where(s => s.idRoute == route.Id);

                foreach (CarpoolingDAL.StartFinish res in places) {
                    db.StartFinishes.DeleteOnSubmit(res);
                }
                db.SubmitChanges();
            } catch (Exception) {
                //return false;
            }

            //return true;
        }
コード例 #12
0
        public void removeFirmRoute(Route route, Client client)
        {
            try {
                CarpoolingDAL.FirmRoute frt = db.FirmRoutes.Single(o => o.idClient == client.Id && o.idRoute == route.Id);
                db.FirmRoutes.DeleteOnSubmit(frt);
                db.SubmitChanges();
            } catch (Exception) {
                //return false;
            }

            //return true;
        }
コード例 #13
0
        public List<Group> getGroupsByRoute(Route route)
        {
            List<Group> listRouGroup = new List<Group>();
            var groups = db.Groups.Where(s => s.route == route.Id);

            foreach (CarpoolingDAL.Group res in groups) {
                listRouGroup.Add(RepositoryUtility.createGroupFromDALGroup(res as CarpoolingDAL.Group));
            }
            return listRouGroup;
        }
コード例 #14
0
 partial void InsertRoute(Route instance);
コード例 #15
0
		private void detach_Routes(Route entity)
		{
			this.SendPropertyChanging();
			entity.RouteType1 = null;
		}
コード例 #16
0
		private void attach_Routes(Route entity)
		{
			this.SendPropertyChanging();
			entity.RouteType1 = this;
		}
コード例 #17
0
 public void removeClient(Client client)
 {
     try {
         CarpoolingDAL.Client cl = db.Clients.Single(o => o.idClient == client.Id);
         db.Clients.DeleteOnSubmit(cl);
         db.SubmitChanges();
     } catch (Exception) {
         //return false;
     }
     CarpoolingDAL.Route r = new CarpoolingDAL.Route();
     //return true;
 }
コード例 #18
0
        public void updatePlace(Place place, Route route)
        {
            try {
                RouteRepository rr = RouteRepository.getInstanca();
                ResourceRepository rer = ResourceRepository.getInstanca();
                CarpoolingDAL.StartFinish oldOne = db.StartFinishes.Single(o => o.idRoute == route.Id && o.direction == place.InOrOut);
                oldOne.address = place.Address;
                oldOne.idCity = place.City.Id;
                db.SubmitChanges();
            } catch (Exception) {
                //return false;
            }

            //return true;
        }
コード例 #19
0
 partial void UpdateRoute(Route instance);
コード例 #20
0
 partial void DeleteRoute(Route instance);