public bool GetTrips() { SchedulingGenerateFuelOrdersCollection schedulingImportsCollection = new SchedulingGenerateFuelOrdersCollection(); schedulingImportsCollection.LoadAll(SchedulingPlatform, AdminClientID, CustClientID); AircraftsCollection aircrafts = new AircraftsCollection(); aircrafts.LoadByAdminAndCustClientID(AdminClientID, CustClientID); foreach (SchedulingGenerateFuelOrders schedulingImport in schedulingImportsCollection) { if (aircrafts.GetTailNumber(schedulingImport.TailNumber) != null) { FuelOrders fuelOrder = new FuelOrders(); fuelOrder.ICAO = schedulingImport.ICAO; fuelOrder.FBO = schedulingImport.FBO; fuelOrder.AdminClientID = schedulingImport.AdminClientID; fuelOrder.CustClientID = schedulingImport.CustClientID; fuelOrder.TailNumber = schedulingImport.TailNumber; fuelOrder.AircraftID = aircrafts.GetTailNumber(fuelOrder.TailNumber).Id; fuelOrder.FuelingDateTime = schedulingImport.Arrival; fuelOrder.QuotedVolume = 1; fuelOrder.DateRequested = DateTime.Now; //aircraftid relationship in databases aren't matching fuelOrder.OrderedByUserID = Users.CurrentUser.Id; FuelOrderPricingsCollection prices = GetQuote(AdminClientID, CustClientID, fuelOrder.ICAO, fuelOrder.TailNumber); if (prices.Count > 0) { fuelOrder.QuotedPPG = prices[0].Price; fuelOrder.Vendor = prices[0].Vendor; fuelOrder.SupplierID = prices[0].SupplierID; fuelOrder.Product = prices[0].Product; } fuelOrder.Update(); //FuelOrderDispatchRequestForRelease fuelOrderDispatchConfirmation = new FuelOrderDispatchRequestForRelease(); //fuelOrderDispatchConfirmation.SendFuelRequestForRelease(fuelOrder); } } return(true); }
public HttpResponseMessage CreateFuelOrder(PartnerServiceIntegrationAddFuelOrderRequest model) { if (!CheckAccount(model)) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, badResponse)); } AircraftsCollection aircrafts = new AircraftsCollection(); aircrafts.LoadByAdminAndCustClientID(model.AdminClientID, model.CustClientID); Aircrafts aircraft = aircrafts.GetTailNumber(model.TailNumber); if (aircraft != null) { model.AircraftID = aircraft.Id; } model.IsFromFuelerLinx = true; ItemResponse <int> response = new ItemResponse <int>(); response.Item = FuelOrdersService.UpdateFuelOrder(model); return(Request.CreateResponse(response)); }