示例#1
0
 public Flight(string icaoCode, string flightNumber, string callsing, string eet, string eobt, string departure, string arrival, DateTime std, string aircraftType)
 {
     IcaoCode     = icaoCode;
     FlightNumber = flightNumber;
     Callsing     = callsing;
     Eet          = ConvertTimes.EetToMinutes(eet);
     Eobt         = eobt;
     Departure    = departure;
     Arrival      = arrival;
     Std          = std;
     Sta          = this.Std.AddMinutes(this.Eet);
     AircraftType = aircraftType;
 }
示例#2
0
 public void DadoUmEetHHMMComHoraEMinutoAConversaoDeveEstarCorretaParaMinutos()
 {
     Assert.AreEqual(ConvertTimes.EetToMinutes("0401"), 241);
 }
示例#3
0
        public ICommandResult Handle(UpdateFlightCommand command)
        {
            command.Validate();
            if (command.Invalid)
            {
                return(new GenericCommandResult(false, "Ops, this flight is wrong!", command.Notifications));
            }

            var flight = new Flight(command.IcaoCode, command.FlightNumber, command.IcaoCode + command.FlightNumber, command.Eet, command.Eobt, command.Departure, command.Arrival, ConvertTimes.EobtToDateTime(command.Eobt, DateTime.Now.AddDays(1)), command.AircraftType);

            _repository.Update(flight);
            return(new GenericCommandResult(true, "Flight updated!", flight));
        }
示例#4
0
 public void DadoUmEetHHMMComApenasHorasAConversaoDeveEstarCorretaParaMinutos()
 {
     Assert.AreEqual(ConvertTimes.EetToMinutes("0300"), 180);
 }
示例#5
0
        public ICommandResult Handle(CreateFlightFromMachCommand command)
        {
            command.Validate();
            if (command.Invalid)
            {
                return(new GenericCommandResult(false, "Ops, this flight is wrong!", command.Notifications));
            }
            var flight = new Flight(command.company, command.callsign.Substring(3), command.callsign, command.eet, command.eobt, command.departure, command.arrival, ConvertTimes.EobtToDateTime(command.eobt, DateTime.Now.AddDays(1)), command.aircraft);

            _repository.Create(flight);
            return(new GenericCommandResult(true, "Flight save!", flight));
        }