Exemple #1
0
        public List <Card> RetrieveUserCardsByTerminal(Card card)
        {
            List <Card> ListCards    = CrudFactory.RetrieveUserCardsByTerminal <Card>(card);
            var         User         = new User();
            var         cardType     = new CardType();
            var         Terminal     = new Terminal();
            var         location     = new Location();
            var         LocationCrud = new LocationCrud();

            foreach (Card c in ListCards)
            {
                CrudFactory.UpdateStatus(c);
                User.IdUser         = c.User.IdUser;
                cardType.IdCardType = c.CrType.IdCardType;
                Terminal.IdTerminal = c.Terminal.IdTerminal;
                c.User              = UCrud.Retrieve <User>(User);
                c.CrType            = CtCrud.RetrieveById <CardType>(cardType);
                c.Terminal          = TerminalCrud.Retrieve <Terminal>(Terminal);
                location.IdLocation = c.Terminal.Location.IdLocation;
                c.Terminal.Location = LocationCrud.Retrieve <Location>(location);
                StatusToStatusString(c);
            }
            checkSentEmail(ListCards);
            return(ListCards);
        }
Exemple #2
0
 public RouteManager()
 {
     CrudFactory = new RouteCrud();
     CCrud       = new CompanyCrud();
     TCrud       = new TerminalCrud();
     LCrud       = new LocationCrud();
     SPCrud      = new SystemParamCrud();
 }
Exemple #3
0
        public List <Card> RetrieveAll()
        {
            List <Card> ListCards    = CrudFactory.RetrieveAll <Card>();
            var         user         = new User();
            var         cardType     = new CardType();
            var         Terminal     = new Terminal();
            var         location     = new Location();
            var         LocationCrud = new LocationCrud();

            foreach (Card c in ListCards)
            {
                BuildObjects(c);
            }

            return(ListCards);
        }
Exemple #4
0
        public List <Card> RetrieveByTerminal(Card card)
        {
            List <Card> ListCards    = CrudFactory.RetrieveCardsByTerminal <Card>(card);
            var         user         = new User();
            var         cardType     = new CardType();
            var         Terminal     = new Terminal();
            var         location     = new Location();
            var         LocationCrud = new LocationCrud();

            foreach (Card c in ListCards)
            {
                BuildObjects(c);
            }

            checkSentEmail(ListCards);
            return(ListCards);
        }
Exemple #5
0
        public List <Card> RetrieveStudiant(Card card)
        {
            List <Card> ListCards    = CrudFactory.RetrieveStudiant <Card>(card);
            var         User         = new User();
            var         cardType     = new CardType();
            var         Terminal     = new Terminal();
            var         location     = new Location();
            var         LocationCrud = new LocationCrud();

            foreach (Card c in ListCards)
            {
                User.IdUser         = c.User.IdUser;
                cardType.IdCardType = c.CrType.IdCardType;
                Terminal.IdTerminal = c.Terminal.IdTerminal;
                c.User              = UCrud.Retrieve <User>(User);
                c.CrType            = CtCrud.RetrieveById <CardType>(cardType);
                c.Terminal          = TerminalCrud.Retrieve <Terminal>(Terminal);
                location.IdLocation = c.Terminal.Location.IdLocation;
                c.Terminal.Location = LocationCrud.Retrieve <Location>(location);
            }
            return(ListCards);
        }
Exemple #6
0
        public void Create(Route route)
        {
            try
            {
                ValidateIsNotExistingRoute(route);
                GetRouteDistanceAndDuration(route);
                CalculateRoutePrice(route);
                Route NewRoute = CrudFactory.CreateRoute(route);
                new LocationCrud().AddLocationToRoute(new Location {
                    IdLocation = route.BusStops[0].IdLocation
                }, NewRoute);

                for (var i = 1; i < route.BusStops.Count; i++)
                {
                    Location NewLocation = new LocationCrud().CreateLocation(route.BusStops[i]);
                    new LocationCrud().AddLocationToRoute(NewLocation, NewRoute);
                }
            }
            catch (Exception bex)
            {
                ExceptionManager.GetInstance().Process(bex);
            }
        }
Exemple #7
0
        public void Update(Route route)
        {
            try
            {
                GetRouteDistanceAndDuration(route);
                CalculateRoutePrice(route);
                CrudFactory.Update(route);
                CrudFactory.DeleteLocationByRoute(route);
                new LocationCrud().AddLocationToRoute(new Location {
                    IdLocation = route.BusStops[0].IdLocation
                }, route);

                for (var i = 1; i < route.BusStops.Count; i++)
                {
                    Location NewLocation = new LocationCrud().CreateLocation(route.BusStops[i]);
                    new LocationCrud().AddLocationToRoute(NewLocation, route);
                }
            }
            catch (Exception bex)
            {
                ExceptionManager.GetInstance().Process(bex);
            }
        }
 public LocationManager()
 {
     CrudFactory = new LocationCrud();
     VLCrud      = new ValueListCrud();
 }