private string GetSenderName(AirWaybillEditData awb)
		{
			if(awb.SenderUserId == null) return null;

			var senderId = _senders.GetByUserId(awb.SenderUserId.Value);

			return senderId != null ? _senders.Get(senderId.Value).Name : null;
		}
Esempio n. 2
0
		public static AwbBrokerModel GetBrokerModel(AirWaybillEditData data)
		{
			return new AwbBrokerModel
			{
				GTD = data.GTD,
				BrokerCost = data.BrokerCost,
				CustomCost = data.CustomCost				
			};
		}
Esempio n. 3
0
		public static AwbSenderModel GetSenderModel(AirWaybillEditData data)
		{
			var currentCulture = CultureProvider.GetCultureInfo();

			return new AwbSenderModel
			{
				ArrivalAirport = data.ArrivalAirport,
				Bill = data.Bill,
				DateOfArrivalLocalString = LocalizationHelper.GetDate(data.DateOfArrival, currentCulture),
				DateOfDepartureLocalString = LocalizationHelper.GetDate(data.DateOfDeparture, currentCulture),
				DepartureAirport = data.DepartureAirport,
				FlightCost = data.FlightCost,
				TotalCostOfSenderForWeight = data.TotalCostOfSenderForWeight				
			};
		}
Esempio n. 4
0
		public static AwbAdminModel GetAdminModel(AirWaybillEditData data)
		{
			var cultureInfo = CultureProvider.GetCultureInfo();

			return new AwbAdminModel
			{
				ArrivalAirport = data.ArrivalAirport,
				Bill = data.Bill,
				DateOfArrivalLocalString = LocalizationHelper.GetDate(data.DateOfArrival, cultureInfo),
				DateOfDepartureLocalString = LocalizationHelper.GetDate(data.DateOfDeparture, cultureInfo),
				DepartureAirport = data.DepartureAirport,
				GTD = data.GTD,
				BrokerId = data.BrokerId,
				AdditionalCost = data.AdditionalCost,
				BrokerCost = data.BrokerCost,
				CustomCost = data.CustomCost,
				FlightCost = data.FlightCost,
				TotalCostOfSenderForWeight = data.TotalCostOfSenderForWeight,
				SenderUserId = data.SenderUserId
			};
		}
Esempio n. 5
0
		public long Create(long? applicationId, AirWaybillEditData data, long creatorUserId)
		{
			if(data.GTD != null)
			{
				throw new InvalidLogicException("GTD data should be defined by update");
			}

			var id = _awbs.Add(data, _stateConfig.CargoIsFlewStateId, creatorUserId);

			if(applicationId.HasValue)
			{
				_applicationAwbManager.SetAwb(applicationId.Value, id);
			}

			if(data.BrokerId.HasValue)
			{
				_events.Add(id, EventType.SetBroker, EventState.Emailing);
			}

			_events.Add(id, EventType.AwbCreated, EventState.Emailing, data);

			return id;
		}
Esempio n. 6
0
		public static void Map(AwbAdminModel from, AirWaybillEditData to)
		{
			to.ArrivalAirport = from.ArrivalAirport;
			to.Bill = from.Bill;
			to.DepartureAirport = from.DepartureAirport;
			to.GTD = from.GTD;
			to.BrokerId = from.BrokerId;
			to.DateOfArrival = DateTimeOffset.Parse(from.DateOfArrivalLocalString);
			to.DateOfDeparture = DateTimeOffset.Parse(from.DateOfDepartureLocalString);
			to.AdditionalCost = from.AdditionalCost;
			to.BrokerCost = from.BrokerCost;
			to.CustomCost = from.CustomCost;
			to.FlightCost = from.FlightCost;
			to.TotalCostOfSenderForWeight = from.TotalCostOfSenderForWeight;
			to.SenderUserId = from.SenderUserId;
		}
Esempio n. 7
0
		public static void Map(AwbBrokerModel from, AirWaybillEditData to)
		{
			to.GTD = from.GTD;
			to.BrokerCost = from.BrokerCost;
			to.CustomCost = from.CustomCost;
		}
Esempio n. 8
0
		public static void Map(AwbSenderModel from, AirWaybillEditData to)
		{
			to.Bill = from.Bill;
			to.ArrivalAirport = from.ArrivalAirport;
			to.DepartureAirport = from.DepartureAirport;
			to.DateOfArrival = DateTimeOffset.Parse(from.DateOfArrivalLocalString);
			to.DateOfDeparture = DateTimeOffset.Parse(from.DateOfDepartureLocalString);
			to.FlightCost = from.FlightCost;
			to.TotalCostOfSenderForWeight = from.TotalCostOfSenderForWeight;
		}