public void AcceptTravel(ITravel travel) { if (!IsBusy) { _travels.Add(travel); } }
public bool CanAcceptTravelExpenses(ITravel travel) { var factory = new ExpenseFactory(); var calculator = factory.GetFor(travel); return(calculator.Calculate()); }
public void Execute() { DAOFactory factory = DAOFactory.GetFactory(DAOFactory.Type.Postgres); ITravel traveldao = factory.GetTravelDAO(); int i = traveldao.Deletetravel(id); }
public void GenerateSmallPoints(ITravel travel) { ClearSmallPoints(); smallPointsObjects = new List <GameObject>(10000); foreach (var point in travel) { smallPointsObjects.Add(Instantiate(smallPointPrefab, new Vector3(point.x * ratio, 0, point.y * ratio), Quaternion.identity, transform)); } }
public TravelControler(ITravel travel, ITapDeserializer tapDeserializer, IJourneySerializer journeySerializer, IPrinter printer) { _travel = travel; _tapDeserializer = tapDeserializer; _journeySerializer = journeySerializer; _printer = printer; }
public void CopyProperties(ITravel other) { other.CheckArgument(nameof(other)); Id = other.Id; Designation = other.Designation; Description = other.Description; Currency = other.Currency; Friends = other.Friends; Category = other.Category; }
public IExpenseCalculator GetFor(ITravel travel) { if (travel.Person.IsManager) { return(new ManagerCalculator(travel)); } if (WorksOverAYear(travel)) { return(new OldEmplyeeCalculator(travel)); } return(new NullCalculator()); }
public void StartButtonOnClick() { string[] pointsX = pointsInputs[0].text.Split(new string[] { "\n", Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); string[] pointsY = pointsInputs[1].text.Split(new string[] { "\n", Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); Vector2[] points = new Vector2[pointsX.Length]; for (int i = 0; i < pointsX.Length; ++i) { points[i] = new Vector2(float.Parse(pointsX[i], Culture), float.Parse(pointsY[i], Culture)); } float step = float.Parse(stepInput.text, Culture); ITravel travel = null; switch (travelType) { case TravelType.Points: travel = new PointsTravel(points); break; case TravelType.Curve: travel = new CurveTravel(funcCodeInput.text, float.Parse(startXInput.text, Culture), float.Parse(endXInput.text, Culture), step); break; case TravelType.Lagrange: travel = new LagrangeTravel(points, step); break; case TravelType.Spline: travel = new SplineTravel(points, step); break; } chartControlScript.ClearAllPoints(); if (travelType != TravelType.Curve) { chartControlScript.GeneratePoints(points); } if (travelType != TravelType.Points) { chartControlScript.GenerateSmallPoints(travel); } robotMoveScript.moveSpeed = float.Parse(robotSpeedInput.text, Culture); robotMoveScript.travel = travel; robotMoveScript.StartMovement(); stopResumeButtonText.text = "Остановить"; ToggleMenu(); }
public ActionResult <IEnumerable <Location> > GetLocationsByTravel(int travelId) {/*esta funcion se encarga de llamar al metodo GetLocationsByTravel de la clase DAO factory */ List <Location> locationsByTravel = new List <Location>(); DAOFactory factory = DAOFactory.GetFactory(DAOFactory.Type.Postgres); ITravel traveldao = factory.GetTravelDAO(); try{ locationsByTravel = traveldao.GetLocationsByTravel(travelId); return(Ok(locationsByTravel)); }catch (WithoutTravelLocationsException ex) { return(StatusCode(404, ex.Message)); }catch (InternalServerErrorException ex) { return(StatusCode(500, ex.Message)); }catch (Exception) { return(StatusCode(400)); } }
public IActionResult AddTravel([FromBody] Travel travel) { /*esta funcion se encarga de llamar al metodo addtravel de la clase DAO factory*/ try{ DAOFactory factory = DAOFactory.GetFactory(DAOFactory.Type.Postgres); ITravel traveldao = factory.GetTravelDAO(); int id = traveldao.addtravel(travel); return(Ok(travel)); }catch (RequiredAttributeException ex) { return(StatusCode(400, ex.Message)); }catch (UserNotFoundException ex) { return(StatusCode(404, ex.Message)); }catch (InternalServerErrorException ex) { return(StatusCode(500, ex.Message)); }catch (Exception) { return(StatusCode(400)); } }
public IActionResult AddLocationsToTravel(int travelId, [FromBody] List <Location> locations) {/*esta funcion se encarga de llamar al metodo AddLocationsToTravel de la clase DAO factory */ Boolean saved = false; try{ DAOFactory factory = DAOFactory.GetFactory(DAOFactory.Type.Postgres); ITravel traveldao = factory.GetTravelDAO(); saved = traveldao.AddLocationsToTravel(travelId, locations); if (saved) { return(Ok("Las ciudades fueron agregadas satisfactoriamente")); } return(Ok(saved)); }catch (InternalServerErrorException ex) { return(StatusCode(500, ex.Message)); }catch (Exception) { return(StatusCode(400)); } }
public IActionResult AddReservationToTravel(int travelId, [FromQuery] int res, string type) {/*esta funcion se encarga de llamar al metodo AddReservationToTravel de la clase DAO factory */ try{ DAOFactory factory = DAOFactory.GetFactory(DAOFactory.Type.Postgres); ITravel traveldao = factory.GetTravelDAO(); if (traveldao.AddReservationToTravel(travelId, res, type)) { return(Ok("La reserva fue agregada satisfactoriamente")); } else { return(StatusCode(400, "No se pudo añadir la reserva al viaje")); } }catch (InternalServerErrorException ex) { return(StatusCode(500, ex.Message)); }catch (Exception) { return(StatusCode(400)); } }
public ActionResult <IEnumerable <Travel> > GetTravels(int userId) {/*----------------------------------------------------------- */ Console.WriteLine(userId); List <Travel> travels = new List <Travel>(); DAOFactory factory = DAOFactory.GetFactory(DAOFactory.Type.Postgres); ITravel traveldao = factory.GetTravelDAO(); try{ travels = traveldao.Gettravel(userId); return(Ok(travels)); }catch (WithoutExistenceOfTravelsException ex) { return(StatusCode(404, ex.Message)); }catch (UserNotFoundException ex) { return(StatusCode(400, ex.Message)); }catch (InternalServerErrorException ex) { return(StatusCode(500, ex.Message)); }catch (Exception) { return(StatusCode(400)); } }
public IActionResult UpdateTravel([FromBody] Travel travel) { /*esta funcion se encarga de llamar al metodo updatetravel de la clase DAO factory */ try{ DAOFactory factory = DAOFactory.GetFactory(DAOFactory.Type.Postgres); ITravel traveldao = factory.GetTravelDAO(); if (traveldao.Updatetravel(travel)) { return(Ok("Las modificaciones fueron realizadas exitosamente")); } else { return(StatusCode(400)); } }catch (InternalServerErrorException ex) { return(StatusCode(500, ex.Message)); }catch (Exception) { return(StatusCode(400)); } }
public IActionResult DeleteTravel(int id) {/*/*esta funcion se encarga de llamar al metodo deletetravel de la clase DAO factory */ Console.WriteLine(id); DAOFactory factory = DAOFactory.GetFactory(DAOFactory.Type.Postgres); ITravel traveldao = factory.GetTravelDAO(); int i = 0; try{ i = traveldao.Deletetravel(id); if (i == 0) { return(Ok("no se elminno ")); } return(Ok("se elimino")); }catch (WithoutExistenceOfTravelsException ex) { return(StatusCode(404, ex.Message)); }catch (UserNotFoundException) { return(Ok("se elimino")); }catch (InternalServerErrorException ex) { return(StatusCode(500, ex.Message)); }catch (Exception) { return(Ok("se elimino")); } }
public bool CanAcceptTravelExpenses(ITravel travel) { var strategy = factory.GetStrategy(travel.Person); return(strategy.Calculate(travel.Expenses)); }
public HomeController(ITravel travel, IStringLocalizer <HomeController> localizer) { _localizer = localizer; _travel = travel; }
public void Add(ITravel travel) => _travels.Add(travel);
public ConversationController(ITravel travel) { this.travel = travel; }
public void Delete(ITravel travel) => _travels.Remove(travel);
private static bool WorksOverAYear(ITravel travel) { return(DateTime.Now.Subtract(travel.Person.Hired).TotalDays >= 365); }
public ManagerCalculator(ITravel travel) { _travel = travel; }
public OldEmplyeeCalculator(ITravel travel) { _travel = travel; }
public AlexaController(ITravel travel) { this.travel = travel; }