How auto-add products using a C# filter formula

Auto-add C# formulas allow for complex conditions for when a product should auto-add to an Order.

Auto-add C# formulas are added by the FBO One support team only. Contact support@amsterdamsoftware.com for guidance.

In this article, we discuss how to define a formula to control when the product is automatically added to an Order.

Contents:

Step-by-step guide

  1. Go to Menu > Administration > Products > Auto-add Products

  2. Define the ‘Filter formula’ in the Auto-add product section

Filter formula inputs

The formulas are written in the C# language.

In the formula, the following input values are available:

  1. input.GetCustomValue("NameOfCustomProperty"). This retrieves the value of a custom property that is set in the order, or on a related entity such as the debtor or aircraft registration.

  2. input.GetOrderField("NameOfTheField") (such as DebtorShortName). The GetOrderField method provides access to all values listed on the orders query manual page.

Additional order fields can be found here

Note: in June 2014, a breaking change was made to the syntax for accessing order fields. The previous syntax was "input.OrderFields.NameOfTheField". This will cause an exception to be thrown in newer releases of FBO One. Only use the current syntax: input.GetOrderField("NameOfTheField")

Filter formula examples

Aircraft

The below examples use the order’s Aircraft data for auto-adding.

Auto-add based on aircraft type short name e.g "GLEX" (case sensitive)
1 input.GetOrderField("AircraftTypeShortName").ToString()=="GLEX"
Auto-add for Multiple A/C Type (Shortnames)
1 2 3 4 5 6 7 ((Func<bool>)(() => { var acTypeShortNames = new string[] { "EMB190", "EMB190LR" "ERJ1000BJ"}; var aircraftTypeShortName = input.GetOrderField("AircraftTypeShortName").ToString(); var isFound = acTypeShortNames.Any(a => a == aircraftTypeShortName); return isFound; }))();
Auto-add if the seat count is >=18 or if MTOW Kgs is above 48,000
1 2 3 4 5 6 ((Func<bool>)(() => { var seatCount = (int?)input.GetOrderField("NumberOfSeats"); var mtowKg = (int?)input.GetOrderField("MtowKg"); return !seatCount.HasValue || (seatCount >= 18 || mtowKg >= 48000); }))();
Auto-add when A/C length is >39 Metres
1 input != null && input.GetOrderField("LengthInMeter") != null && (decimal?)input.GetOrderField("LengthInMeter") >= 39
Auto-add based on MTOW Kg e.g equals to or above "40000" kgs
1 input != null && input.GetOrderField("MtowKg") != null && (int)input.GetOrderField("MtowKg") >= 40000
Auto-add based on MTOW range e.g between 65,000Kgs and 70,000Kgs
1 2 3 4 5 ((Func<bool>)(() => { var mtowKg = (int?)input.GetOrderField("MtowKg"); return !mtowKg.HasValue || (mtowKg >= 65000 && mtowKg <= 70000); }))();
Auto-add based in MTOW Kg and outbound flight type e.g MTOW Kg equal or over 1000Kgs and flight type is not "Private"
1 2 input != null && input.GetOrderField("MtowKg") != null && (int)input.GetOrderField("MtowKg") >= 10000 && (input.GetOrderField("FlightTypeOut") == null || input.GetOrderField("FlightTypeOut").ToString().ToLower() != "private")
Auto-add based on the aircraft registration prefix e.g CU- and EP-
1 2 3 4 5 6 7 8 9 10 ((Func<bool>)(() => { var registrationPrefix = new List<string> {"EP-", "CU-"}; var currentRegistration = (string)input.GetOrderField("AircraftRegistrationCodeWithDash") ?? ""; var autoAdd = registrationPrefix.Any(regPrefix => currentRegistration.StartsWith(regPrefix)); return autoAdd; }))();
Auto-add based on A/C Reg Prefix & to exclude HS Registered A/C
1 2 3 4 5 6 ((Func<bool>)(() => { var registrationPrefix = new List<string> {"HS"}; var currentRegistration = (string)input.GetOrderField("AircraftRegistrationCodeWithDash") ?? ""; var autoAdd = ! registrationPrefix.Any(regPrefix => currentRegistration.StartsWith(regPrefix)); return autoAdd; }))();
Auto-add if aircraft type ICAO code is ZZZZ
1 2 3 4 5 6 7 8 9 10 11 ((Func<bool>)(() => { bool autoAdd = false; var ACIcaoInclude = new [] { "zzzz" }; string currentACTypeIcao = ""; if (input.GetOrderField("AircraftTypeShortName") != null) currentACTypeIcao = input.GetOrderField("AircraftTypeShortName").ToString().ToLower(); return autoAdd = ACIcaoInclude.Contains(currentACTypeIcao); }))();
Auto-add if aircraft type dimensions are missing (length and wingspan)
1 2 3 4 5 6 7 8 9 10 11 ((Func<bool>)(() => { bool autoAdd = false; var acLength = (decimal?)input.GetOrderField("WingSpanInMeter"); var acWingspan = (decimal?)input.GetOrderField("LengthInMeter"); autoAdd = acLength ==null || acWingspan ==null; return autoAdd; }))();
Auto-add if aircraft type is not E55P and pax count is greater than 0 for departure
1 2 3 4 5 6 7 8 9 10 11 12 ((Func<bool>)(() => { var acTypeIcaoCode = input.GetOrderField("AircraftTypeICAO")?.ToString() ?? ""; if (acTypeIcaoCode == "E55P") return false; // this a/c have their own on board facilities var paxCountOut = (int?)input.GetOrderField("PaxCountOut"); return !paxCountOut.HasValue || paxCountOut > 0; }))();

Contact

The below examples use the order’s Contact data for auto-adding.

Auto-add which should Exclude a particular Debtor
1 input.GetOrderField("DebtorShortName") != null && input.GetOrderField("DebtorShortName").ToString()!="NETJETS EU"
Auto-add which should Exclude particular Debtors
1 input.GetOrderField("DebtorShortName") != null && input.GetOrderField("DebtorShortName").ToString().ToUpper() != "NETJETS EU" && input.GetOrderField("DebtorShortName").ToString().ToUpper() != "WINDROSE"
Auto-add based on order number prefix and debtor name e.g "AMS-" and if the "DebtorShortName" is "NetJets"
1 2 input.GetOrderField("OrderKey").ToString().StartsWith("AMS-")  && input.GetOrderField("DebtorShortName").ToString() == "NetJets"
Auto-add based on Operator and Outbound Pax count above 0
1 2 3 4 5 6 7 8 9 ((Func<bool>)(() => { var operatorShortName = input.GetOrderField("OperatorShortName").ToString().ToUpper(); var operatorShortNames = new List<string> { "NETJETS EU"}; var paxOut = (int?)input.GetOrderField("PaxCountOut"); return (operatorShortNames.Contains(operatorShortName)) && (!paxOut.HasValue || (paxOut.HasValue && paxOut.Value > 0)); }))();
Auto-add if the form of payment is not correct for the debtor (has no credit terms)

Change ‘formOfPaymentToInclude’ list with on account FOPs.

1 2 3 4 5 6 7 8 9 10 11 12 13 ((Func<bool>)(() => { var formOfPaymentToInclude = new [] {"bill gbp", "direct debit gbp"}; string currentFormOfPayment = ""; if (input.GetOrderField("Fop") != null) currentFormOfPayment = input.GetOrderField("Fop").ToString().ToLower(); var matchesFormOfPayment = formOfPaymentToInclude.Contains(currentFormOfPayment); var hasCredit = (int?) input.GetOrderField("DebtorCredit") > 0; var autoAdd = matchesFormOfPayment & !hasCredit ; return autoAdd; }))();
Auto-add if the debtor is missing for an order
1 input.GetOrderField("DebtorName") == null

Flight type

The below examples use the order’s flight type data for auto-adding.

Auto-add based on Flight Type and Pax Count In above 0
1 2 3 4 5 6 7 8 9 ((Func<bool>)(() => { var flightsToInclude = new[] { "1 - commercial ga flight / n", "5 - private ga flight / d", "7 - helicopter flight / none"}; string currentFlightType = ""; if (input.GetOrderField("FlightTypeIn") != null) currentFlightType = input.GetOrderField("FlightTypeIn").ToString().ToLower(); return flightsToInclude.Contains(currentFlightType) && input.GetOrderField("PaxCountIn") != null && ((int?)input.GetOrderField("PaxCountIn")).Value > 0; }))();
Auto-add based on arrival and departure flight type e.g "Air Ambulance" (case sensitive)
1 2 input.GetOrderField("FlightTypeIn").ToString()=="Air Ambulance"  || input.GetOrderField("FlightTypeOut").ToString()=="Air Ambulance"
Auto-add for specific flight type(s), MTOW and Pax Count

The below formula will auto-adds based on the following criteria: Flight Type - 'Charter (UK) 'with MTOW >10000kgs & Pax count >0 as well as Flight Type - 'Private (UK) 'with MTOW >45,000kgs & Pax count >0 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ((Func<bool>)(() => { var mtowKg = (int?)input.GetOrderField("MtowKg"); var paxOut = (int?)input.GetOrderField("PaxCountOut"); var flightTypeOut = (string)input.GetOrderField("FlightTypeOut"); var matchesPaxOut = (!paxOut.HasValue || paxOut.Value > 0); var matchesCharter = (mtowKg.HasValue && mtowKg.Value >= 10000) && (string.IsNullOrEmpty(flightTypeOut) || flightTypeOut.ToLower() == "charter (uk)") && matchesPaxOut; var matchesPrivateUk = (mtowKg.HasValue && mtowKg.Value >= 45000) && (string.IsNullOrEmpty(flightTypeOut) || flightTypeOut.ToLower() == "private (uk)") && matchesPaxOut; return matchesCharter || matchesPrivateUk; }))();
Auto-add for all inbound flight types, except the 2 listed & auto-add for 'Positioning' flight type only if arr/dep are within 6-hours of one another
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ((Func<bool>)(() => { bool autoAdd = true; var inputFlightTypeIn = (string)input.GetOrderField("FlightTypeIn") ?? ""; if (inputFlightTypeIn == "4 - Technical Stop / X" || inputFlightTypeIn == "9 - RAF + IRL Training") { autoAdd = false; } else if (inputFlightTypeIn == "2 - Postion Flight / P") { DateTime? arrival = (DateTime?)input.GetOrderField("MostActualArrivalDateTime"); DateTime? departure = (DateTime?)input.GetOrderField("MostActualDepartureDateTime"); if (arrival.HasValue && departure.HasValue) { var durationInMinutes = (departure.Value - arrival.Value).Duration().TotalMinutes; autoAdd = durationInMinutes >= 360; } } return autoAdd; }))();
Auto-add based on operator and debtor country e.g Iran or Cuba
1 2 3 4 5 6 7 8 9 10 11 12 13 ((Func<bool>)(() => { var countriesGroup = new List<string> {"Cuba (CU)","Iran, Islamic Republic of (IR)"}; var operatorCountry = (string)input.GetOrderField("OperatorCountry") ?? ""; var debtorCountry = (string)input.GetOrderField("DebtorCountry") ?? ""; var autoAdd = countriesGroup.Any(country => country == operatorCountry || country == debtorCountry); return autoAdd; }))();
Auto-Add based on departure flight types and MTOW Kg e,g either flight types "private", "ferry", "Medical" and MTOW is equal to or above "10000"Kgs
1 2 3 4 5 6 7 8 9 ((Func<bool>)(() => { var flightsToExclude = new[] { "private", "ferry", "medical",}; string currentFlightType = ""; if (input.GetOrderField("FlightTypeOut") != null) currentFlightType = input.GetOrderField("FlightTypeOut").ToString().ToLower(); return !flightsToExclude.Contains(currentFlightType) && input.GetOrderField("MtowKg") != null && (int)input.GetOrderField("MtowKg") >= 10000; }))();
Auto-add based on if Pax inbound, from non-UK and flight type is ‘Medical’ or ‘Medical (Private)’
1 2 3 4 5 6 7 8 9 10 11 12 13 ((Func<bool>)(() => { var countriesGroup = new string[] { "United Kingdom", "Jersey, Channel Islands", "Ireland", "Guernsey" }; var fromCountry = (input.GetOrderField("FromStationCountry") as string) ?? ""; var isUkCountry = countriesGroup.Any(c => c == fromCountry); var flightsToInclude = new[] {"medical", "medical (private)"}; string currentFlightType = ""; if (input.GetOrderField("FlightTypeIn") != null) currentFlightType = input.GetOrderField("FlightTypeIn").ToString().ToLower(); var matchesFlightType = flightsToInclude.Contains(currentFlightType); var hasPax = input.GetOrderField("PaxCountIn") != null && ((int?)input.GetOrderField("PaxCountIn")).Value > 0; var autoAdd = !isUkCountry && hasPax && matchesFlightType; return autoAdd; }))();
Auto-add if arrival or departure flight type is ‘Military’, ‘Royal' or 'Governmental’
1 2 3 4 5 6 input.GetOrderField("FlightTypeIn").ToString()=="Military" || input.GetOrderField("FlightTypeOut").ToString()=="Military" || input.GetOrderField("FlightTypeIn").ToString()=="Royal" || input.GetOrderField("FlightTypeOut").ToString()=="Royal" || input.GetOrderField("FlightTypeIn").ToString()=="Governmental" || input.GetOrderField("FlightTypeOut").ToString()=="Governmental"

Arrival / Departure time

The below examples use the order’s arrival or departure time data for auto-adding.

Auto-add based on arrival/departure time of day and specific flight type(s) e.g If commercial between 22:55 and 06:30 and if private between 21:45 and 06:30
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 ((Func<bool>)(() => { bool autoAdd = false; var privateFlightTypes = new List<string> { "private", "" }; var commercialFlightTypes = new List<string> { "commercial" }; var mostActualArrival = input.GetOrderField("MostActualArrivalDateTimeLT") as DateTime?; var mostActualDeparture = input.GetOrderField("MostActualDepartureDateTimeLT") as DateTime?; var flightTypeIn = (string)input.GetOrderField("FlightTypeIn") ?? ""; var flightTypeOut = (string)input.GetOrderField("FlightTypeOut") ?? ""; var isPrivate = privateFlightTypes.Any(f => f.ToLower() == flightTypeIn.ToLower() || f.ToLower() == flightTypeOut.ToLower()); var isCommercial = commercialFlightTypes.Any(f => f.ToLower() == flightTypeIn.ToLower() || f.ToLower() == flightTypeOut.ToLower()); var from = new TimeSpan(); var until = new TimeSpan(); var matchesFlightTypes = isPrivate || isCommercial; if (isPrivate) { from = TimeSpan.Parse("21:45"); until = TimeSpan.Parse("06:30"); } else if (isCommercial) { from = TimeSpan.Parse("22:55"); until = TimeSpan.Parse("06:30"); } var night_2359 = TimeSpan.Parse("23:59"); var night_0000 = TimeSpan.Parse("00:00"); if (matchesFlightTypes) { if (mostActualArrival.HasValue) { var arrivalTime = mostActualArrival.Value.TimeOfDay; autoAdd = (arrivalTime >= from && arrivalTime <= night_2359); autoAdd = autoAdd ||(arrivalTime >= night_0000 && arrivalTime <= until); } if (mostActualDeparture.HasValue) { var departureTime = mostActualDeparture.Value.TimeOfDay; autoAdd = autoAdd || (departureTime >= from && departureTime <= night_2359); autoAdd = autoAdd || (departureTime >= night_0000 && departureTime <= until); } } return autoAdd; }))();
Auto-Add based on if arrival time LT is between 19:30-04:30
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ((Func<bool>)(() => { DateTime? arrival = (DateTime?)input.GetOrderField("MostActualArrivalDateTimeLT"); if (arrival.HasValue) { TimeSpan start = new TimeSpan(04, 30, 0); TimeSpan end = new TimeSpan(19, 30, 0); TimeSpan now = arrival.Value.TimeOfDay; return now <= start || now >= end; } return false; }))();
Auto-Add based on if arrival or departure time is between 22:00-06:00
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ((Func<bool>)(() => { bool autoAdd = false; DateTime? arrival = (DateTime?)input.GetOrderField("MostActualArrivalDateTime"); DateTime? departure = (DateTime?)input.GetOrderField("MostActualDepartureDateTime"); TimeSpan end = new TimeSpan(22, 00, 0); TimeSpan start = new TimeSpan(06, 00, 0); if (arrival.HasValue) { TimeSpan now = arrival.Value.TimeOfDay; autoAdd = now <= start || now >= end; } if (!autoAdd && departure.HasValue) { TimeSpan now = departure.Value.TimeOfDay; autoAdd = now <= start || now >= end; } return autoAdd; }))();
Auto-Add based on departure time and ground time below 90Mins
1 2 3 4 5 6 7 8 9 10 11 12 13 14 ((Func<bool>)(() => { bool autoAdd = false; DateTime? arrival = (DateTime?)input.GetOrderField("MostActualArrivalDateTime"); DateTime? departure = (DateTime?)input.GetOrderField("MostActualDepartureDateTime"); if (arrival.HasValue && departure.HasValue) { var durationInMinutes = (departure.Value - arrival.Value).Duration().TotalMinutes; autoAdd = durationInMinutes <= 90; } TimeSpan start = new TimeSpan(08, 00, 0); TimeSpan end = new TimeSpan(22, 00, 0); TimeSpan now = departure.Value.TimeOfDay; return autoAdd && start <= now && now >= end; }))();
Auto-Add based on aircraft turn-around time e.g equal to or inferior to 90 Mins
1 2 3 4 5 6 7 8 9 10 11 12 13 ((Func<bool>)(() => { bool autoAdd = false; DateTime? arrival = (DateTime?)input.GetOrderField("MostActualArrivalDateTime"); DateTime? departure = (DateTime?)input.GetOrderField("MostActualDepartureDateTime"); if (arrival.HasValue && departure.HasValue) { var durationInMinutes = (departure.Value - arrival.Value).Duration().TotalMinutes; autoAdd = durationInMinutes <= 90; } return autoAdd; }))();
Auto-Add based on aircraft ground time e.g between 181 and 360 mins
1 2 3 4 5 6 7 8 9 10 11 12 13 ((Func<bool>)(() => { bool autoAdd = false; DateTime? arrival = (DateTime?)input.GetOrderField("MostActualArrivalDateTime"); DateTime? departure = (DateTime?)input.GetOrderField("MostActualDepartureDateTime"); if (arrival.HasValue && departure.HasValue) { var durationInMinutes = (departure.Value - arrival.Value).Duration().TotalMinutes; autoAdd = durationInMinutes >=181 && durationInMinutes <= 360; } return autoAdd; }))();
Auto-add based on time until actual arrival - auto-delete on actual arrival.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ((Func<bool>)(() => { bool autoAdd = false; //auto-add if arrival is within 30 minutes, auto-delete when ATA is added. DateTime? arrival = (DateTime?)input.GetOrderField("MostActualArrivalDateTime"); var Atavalue = (DateTime?)input.GetOrderField("AtaDateTime"); if (arrival.HasValue && Atavalue==null) { var durationInMinutes = (arrival.Value - DateTime.Now).Duration().TotalMinutes; autoAdd = durationInMinutes <= 30; //change durationInMinutes to edit time before actual } return autoAdd; }))();
Auto-Add based on the departure day of the week and pax count e.g Weekday and pax count superior to 0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ((Func<bool>)(() => { // auto add the service if the flight has pax and departure is between Monday and Friday bool autoAdd = false; var mostActualDeparture = input.GetOrderField("MostActualDepartureDateTimeLT") as DateTime?; if (mostActualDeparture.HasValue) { var dayOfWeek = mostActualDeparture.Value.DayOfWeek; var isNotWeekend = dayOfWeek != DayOfWeek.Saturday && dayOfWeek != DayOfWeek.Sunday; var hasPax = input.GetOrderField("PaxCountOut") != null && ((int?)input.GetOrderField("PaxCountOut")).Value > 0; autoAdd = isNotWeekend && hasPax; } return autoAdd; }))();
Auto-add based on Arrival or Departure Time between a specific timeframe

This formula will auto-add the given product (Example: Late Ops fee) to an order when the Arrival time is after 19:30LT and before 04:30LT

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ((Func<bool>)(() => { bool autoAdd = false; DateTime? arrival = (DateTime?)input.GetOrderField("MostActualArrivalDateTimeLT"); if (arrival.HasValue) { TimeSpan start = new TimeSpan(04, 30, 0); TimeSpan end = new TimeSpan(19, 30, 0); TimeSpan now = arrival.Value.TimeOfDay; return now <= start || now>= end; } return autoAdd; }))();
Auto-add if arrival is complete and aircraft is staying overnight
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ((Func<bool>)(() => { bool autoAdd = false; DateTime? arrival = (DateTime?)input.GetOrderField("MostActualArrivalDateTimeLT"); DateTime? departure = (DateTime?)input.GetOrderField("MostActualDepartureDateTimeLT"); var StateToInclude = new List<string> { "confirmed", "requested", "arrived", }; string currentStateType = ""; if (input.GetOrderField("OrderState") != null) currentStateType = input.GetOrderField("OrderState").ToString().ToLower(); var matchesStateType = StateToInclude.Contains(currentStateType); //only add if order is in these current states 'full name' only if (arrival.HasValue && departure.HasValue) { var durationInDays = (departure.Value.Date - arrival.Value.Date).Duration().TotalDays; autoAdd = durationInDays >= 1 && !matchesStateType; } //adds if overnight (greater than 1 day) and arrival leg is still active return autoAdd; }))();
Auto-add if the aircraft is arriving and departing on the same date, but not within 2 hours
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 ((Func<bool>)(() => { bool autoAdd = false; DateTime? arrival = (DateTime?)input.GetOrderField("MostActualArrivalDateTimeLT"); DateTime? departure = (DateTime?)input.GetOrderField("MostActualDepartureDateTimeLT"); var StateToExclude = new List<string> { "departed" }; string currentStateType = ""; if (input.GetOrderField("OrderState") != null) currentStateType = input.GetOrderField("OrderState").ToString().ToLower(); var matchesStateType = StateToExclude.Contains(currentStateType); if (arrival.HasValue && departure.HasValue) { var durationInDays = (departure.Value.Date - arrival.Value.Date).Duration().TotalDays; var quickturn = (departure.Value - arrival.Value).Duration().TotalHours; autoAdd = (durationInDays < 1 && quickturn > 2) && !matchesStateType; } return autoAdd; }))();
Auto-add if the aircraft is arriving and departing within 2 hours - disappears when aircraft is in departed order state
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ((Func<bool>)(() => { bool autoAdd = false; DateTime? arrival = (DateTime?)input.GetOrderField("MostActualArrivalDateTime"); DateTime? departure = (DateTime?)input.GetOrderField("MostActualDepartureDateTime"); var StateToExclude = new List<string> { "departed" }; string currentStateType = ""; if (input.GetOrderField("OrderState") != null) currentStateType = input.GetOrderField("OrderState").ToString().ToLower(); var matchesStateType = StateToExclude.Contains(currentStateType); if (arrival.HasValue && departure.HasValue) { var durationInMinutes = (departure.Value - arrival.Value).Duration().TotalMinutes; autoAdd = durationInMinutes <= 120 && !matchesStateType; } return autoAdd; }))();
Auto-add if parking position has not been set after arrival
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ((Func<bool>)(() => { bool autoAdd = false; var statesToIgnore = new List<string> { "requested", "confirmed", "cancelled", "to be cancelled" }; string currentState = input.GetOrderField("OrderState")?.ToString().ToLower(); var matchesStatesToIgnore = statesToIgnore.Contains(currentState); var parkingPosition = input.GetOrderField("ParkingPosition")?.ToString() ?? ""; var isParkingSet = parkingPosition != ""; autoAdd = !matchesStatesToIgnore && !isParkingSet; return autoAdd; }))();
Auto-add if aircraft turn-around is within 240 minutes of arrival and parking is set to certain locations
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 // This expression allows for a Product to be auto-added if the Aircraft is making a quick turnaround within 240-Mins of its Arrival ((Func<bool>)(() => { bool autoAdd = false; DateTime? arrival = (DateTime?)input.GetOrderField(""MostActualArrivalDateTime""); DateTime? departure = (DateTime?)input.GetOrderField(""MostActualDepartureDateTime""); if (arrival.HasValue && departure.HasValue) { var durationInMinutes = (departure.Value - arrival.Value).Duration().TotalMinutes; autoAdd = durationInMinutes <= 240; var parkingPositionForQuickTurn = new [] {""R10"",""R11"", ""R12""}; var orderParkingPosition = (string)input.GetOrderField(""ParkingPosition""); autoAdd = autoAdd && parkingPositionForQuickTurn.Contains(orderParkingPosition); } return autoAdd; }))();
Auto-add based if current position includes certain characters
1 2 3 4 5 6 7 8 9 10 11 12 13 ((Func<bool>)(() => { var parkingPosToInclude = new [] {"a", "b","c","d","e","p1","p2","p3","p4","r","s","t","u","v","w","x","y","z"}; string currentParkingPos = ""; if (input.GetOrderField("ParkingPosition") != null) currentParkingPos = input.GetOrderField("ParkingPosition").ToString().ToLower(); var matchesParking = parkingPosToInclude.Contains(currentParkingPos); var autoAdd = matchesParking; return autoAdd; }))();

Origin / Destination

The below examples use the order’s origin or destination data for auto-adding.

Auto-add based on the Country from which an A/C is Arriving
1 2 3 4 5 6 7 8 9 10 ((Func<bool>)(() => { // HealthGD countries var countriesGroup = new string[] { "China", "Japan", }; var fromCountry = (input.GetOrderField("FromStationCountry") as string) ?? ""; var isHealthGD = countriesGroup.Any(c => c == fromCountry); bool autoAdd = isHealthGD; return autoAdd; }))()
Auto-add when Arrival From ICAO is not listed
1 2 3 4 5 6 7 8 9 10 11 ((Func<bool>)(() => { var icaos = new string[] { "LATI", "UDYZ", "LOWW", "UBBB", "OBBI", "UMMS", "EBBR", "EBLG", "LBBG", "LBWN", "LBSF", "CYYZ", "CYUL", "VHHH", "ZBAA", "ZSPD", "LDDU", "LDZA", "LDSP", "LCLK", "LCPH", "LKPR", "LKMT", "EKCH", "HAAB", "EFHK", "LFPO", "LFPG", "LFMN", "LFPB", "UGTB", "UGSB", "EDSB", "EDDB", "EDDW", "EDDL", "EDDH", "EDDM", "EDDF", "EDDK", "EDDS", "LGKO", "LGKR", "LGSA", "LGZA", "LGAV", "LGSR", "LGIR", "LGMK", "LGRP", "LGTS", "BIKF", "BIRK", "VIDP", "LIPE", "LIME", "LIPX", "LIPQ", "LIMC", "LICC", "LIRF", "LIRA", "OJAM", "OJAI", "OJAQ", "EVRA", "EYKA", "EYVI", "LWOH", "LMML", "GMMN", "LUKK", "LYPG", "LYTV", "EHAM", "ENGM", "EPWA", "EPWR", "EPPO", "EPKT", "EPKK", "EPZR", "LPPT", "LROP", "LRCK", "LRCL", "LRCV", "UWUU", "UWOO", "URMM", "USSS", "UUDD", "UUWW", "UUEE", "UWWW", "ULLI", "URKK", "URRR", "URSS", "LYBE", "LZIB", "LZKZ", "LJLJ", "RKSI", "LEPA", "LEBL", "LEMD", "LEMG", "ESSA", "LFSB", "LSGG", "LSZH", "LTFM", "LTBA", "LTFJ", "LTAI", "LTBS", "LTFE", "LTBJ", "UKOO", "UKDD", "UKBB", "UKKK", "UKDE", "UKWW", "UKHH", "UKLL", "OMAA", "OMDB", "EGKK", "EGLL", "EGGW", "EGCC", "KDFW", "KMIA", "KEWR", "KSFO", "KJFK", "KIAD", "UTTT", "EINN", "OMDW", "EGLF" }; var fromIcao = (string)input.GetOrderField("FromIcao"); if(string.IsNullOrEmpty(fromIcao)) return false; else return !icaos.Any(c => c == fromIcao.ToUpper()); }))();
Auto-add on IsGenDecRequiredIn station group (as defined in the FBO Location settings)
1 input.GetOrderField("IsGenDecRequiredIn") != null && (bool)input.GetOrderField("IsGenDecRequiredIn")
Auto-add based on arrival station group and pax count e.g IsGenDecRequiredIn station group and arrival pax count is equals to or inferior to 15
1 input.GetOrderField("IsGenDecRequiredIn") != null && (bool)input.GetOrderField("IsGenDecRequiredIn") && input.GetOrderField("PaxCountIn") != null && ((int?)input.GetOrderField("PaxCountIn")).Value <= 15
Auto-add based on if the arrival or departure is from/to a given list of countries e.g United Kingdom, Italy, Spain, or France
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 //This syntax would auto-add the product based on arrival or departure countries   ((Func<bool>)(() => { // always use this type of declaration bool autoAdd = false; // always set a default return value var countriesGroup = new string[] {"United Kingdom","Italy","Spain","France"}; string fromCountry = ""; if (input.GetOrderField("FromStationCountry") != null) fromCountry = input.GetOrderField("FromStationCountry").ToString(); string toCountry = ""; if (input.GetOrderField("ToStationCountry") != null) toCountry = input.GetOrderField("ToStationCountry").ToString(); for (int index= 0; index < countriesGroup.Length; index++) { if (countriesGroup[index] == fromCountry || countriesGroup[index] == toCountry) autoAdd = true; } return autoAdd; }))(); // always end the formula like this
Auto-Add based on arrival and departure countries group e.g Schengen
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 ((Func<bool>)(() => { bool isSchengenCountry = false; // Schengen countries var countriesGroup = new string[] { "Austria","Belgium","Czech Republic","Denmark","Estonia","Finland", "France","Germany","Greece","Hungary","Iceland","Italy","Latvia","Lithuania","Luxembourg","Malta","Netherlands","Norway","Poland","Portugal","Portugal | Acores","Slovakia","Slovenia","Spain","Sweden","Switzerland", }; string fromCountry = ""; if (input.GetOrderField("FromStationCountry") != null) fromCountry = input.GetOrderField("FromStationCountry").ToString(); string toCountry = ""; if (input.GetOrderField("ToStationCountry") != null) toCountry = input.GetOrderField("ToStationCountry").ToString(); for (int index = 0; index < countriesGroup.Length; index++) { if (countriesGroup[index] == fromCountry && countriesGroup[index] == toCountry) { isSchengenCountry = true; break; } } bool autoAdd = !isSchengenCountry; return autoAdd; }))();
Auto-add based on arrival station being outside of a given list of countries e.g Schengen area
1 2 3 4 5 6 7 8 9 10 ((Func<bool>)(() => { // Schengen countries var countriesGroup = new string[] { "Austria", "Belgium", "Czech Republic", "Denmark", "Estonia", "Finland", "France", "Germany", "Greece", "Hungary", "Iceland", "Italy", "Latvia", "Lithuania", "Luxembourg", "Malta", "Netherlands", "Norway", "Poland", "Portugal", "Portugal | Acores", "Slovakia", "Slovenia", "Spain", "Sweden", "Switzerland", }; var fromCountry = (input.GetOrderField("FromStationCountry") as string) ?? ""; var isSchengenCountry = countriesGroup.Any(c => c == fromCountry); bool autoAdd = !isSchengenCountry; return autoAdd; }))();
Auto-add based on departure station being outside of a given list of countries e.g Schengen area
1 2 3 4 5 6 7 8 9 10 ((Func<bool>)(() => { // Schengen countries var countriesGroup = new string[] { "Austria", "Belgium", "Czech Republic", "Denmark", "Estonia", "Finland", "France", "Germany", "Greece", "Hungary", "Iceland", "Italy", "Latvia", "Lithuania", "Luxembourg", "Malta", "Netherlands", "Norway", "Poland", "Portugal", "Portugal | Acores", "Slovakia", "Slovenia", "Spain", "Sweden", "Switzerland", }; var toCountry = (input.GetOrderField("ToStationCountry") as string) ?? ""; var isSchengenCountry = countriesGroup.Any(c => c == toCountry); bool autoAdd = !isSchengenCountry; return autoAdd; }))();
Auto-Add based on if not from any of the listed countries or stations
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ((Func<bool>)(() => { // Schengen countries var countriesGroup = new string[] { "Belgium", "Bulgaria", "Czech Republic", "Denmark", "Estonia", "Germany", "France", "Germany", "Greece", "Ireland", "Spain", "France", "Croatia", "Italy", "Cyprus", "Lithuania", "Latvia", "Luxembourg", "Hungary", "Malta", "Netherlands", "Austria", "Poland", "Portugal", "Romania", "Slovenia", "Finland", "Sweden", "Slovenia" }; var stationsGroup = new string[] { "EGAA", "EGAB", "EGAC", "EGAD", "EGAE", "EGAL" }; var fromStation = (input.GetOrderField("FromIcao") as string) ?? ""; var isSchengenStation = stationsGroup.Any(c => c == fromStation); var fromCountry = (input.GetOrderField("FromStationCountry") as string) ?? ""; var isSchengenCountry = countriesGroup.Any(c => c == fromCountry); bool autoAdd = !(isSchengenCountry || isSchengenStation); return autoAdd; }))();
Auto-Add based on if NOT from any of the listed countries or stations
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ((Func<bool>)(() => { bool autoAdd = true; var inputFlightTypeIn = (string)input.GetOrderField("FlightTypeIn") ?? ""; if (inputFlightTypeIn == "4 - Technical Stop / X" || inputFlightTypeIn == "9 - RAF + IRL Training") { autoAdd = false; } else if (inputFlightTypeIn == "2 - Postion Flight / P") { DateTime? arrival = (DateTime?)input.GetOrderField("MostActualArrivalDateTime"); DateTime? departure = (DateTime?)input.GetOrderField("MostActualDepartureDateTime"); if (arrival.HasValue && departure.HasValue) { var durationInMinutes = (departure.Value - arrival.Value).Duration().TotalMinutes; autoAdd = durationInMinutes >= 360; } } return autoAdd; }))();
Auto-add based on aircraft arrival ICAO code e.g "LFMN" (case sensitive)
1 input.GetOrderField("FromIcao") != null && input.GetOrderField("FromIcao").ToString()=="LFMN"

Crew / Pax

The below examples use the order’s crew or pax data for auto-adding.

Auto-Add based on outbound pax count e.g superior to 0
1 input.GetOrderField("PaxCountOut") == null || ((int?)input.GetOrderField("PaxCountOut")).Value > 0
Auto-Add based on the total amount of pax (inbound and outbound) e.g superior to 15
1 2 3 4 5 6 7 ((Func<bool>)(() => { var outboundPax = (int?)input.GetOrderField("PaxCountOut"); var inboundPax = (int?)input.GetOrderField("PaxCountIn"); var inAndOut = (outboundPax ?? 0) + (inboundPax ?? 0); return inAndOut > 15; }))();
Auto-Add based on inbound pax count between 10 and 20
1 2 3 4 5 ((Func<bool>)(() => { var paxIn = ((int?)input.GetOrderField("PaxCountIn")) ?? 0; var autoAdd = paxIn >= 10 && paxIn <= 20; return autoAdd; }))();
Auto-Add to exclude a particular debtor and if total pax count is zero
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ((Func<bool>)(() => {{ var eligibleForNoHandlingFeeDebtors = new [] {"Fly Aviation", "another debtor"}; var debtorShortName = input.GetOrderField("DebtorShortName")?.ToString() ?? ""; if (eligibleForNoHandlingFeeDebtors .Any(d => d == debtorShortName)) { var paxCountIn = (int?)input.GetOrderField("PaxCountIn") ?? 0; var paxCountOut = (int?)input.GetOrderField("PaxCountOut") ?? 0; var totalPax = paxCountIn + paxCountOut; if (totalPax == 0) return false; // don't charge handling fee } return true; }}))();
Auto-add based on outbound pax count and aircraft type
1 2 3 4 5 6 ((Func<bool>)(() => { var paxCountOut = (int?)input.GetOrderField("PaxCountOut"); var acTypeIcaoCode = input.GetOrderField("AircraftTypeICAO")?.ToString() ?? ""; return !paxCountOut.HasValue || (paxCountOut > 0 && acTypeIcaoCode == "E55P"); }))();
Add if Inbound Pax Count is between 1 & 20, Flight Type is not 'Technical', and STA is within the Next 72-Hours
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ((Func<bool>)(() => { var autoAdd = false; var flightTypeIn = ((string)input.GetOrderField("FlightTypeIn")) ?? ""; var excludeForFlight = "4 - technical stop / x"; if (flightTypeIn.ToLower() == excludeForFlight.ToLower()) return false; // don't autoadd var paxIn = ((int?)input.GetOrderField("PaxCountIn")) ?? 0; var paxPresent = paxIn >= 1 && paxIn <= 20; if (!paxPresent) return false; var scheduledArrivalTime = input.GetOrderField("MostActualArrivalDateTime") as DateTime?; if (scheduledArrivalTime.HasValue) { var hours = (scheduledArrivalTime - DateTime.UtcNow).Value.TotalHours; autoAdd = hours >= 0 && hours <= 72; } return autoAdd; }))();
Auto-add if crew count is unknown for an arrival leg
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 ((Func<bool>)(() => { var paxCountIn = (int?)input.GetOrderField("PaxCountIn"); var crewCountIn = (int?)input.GetOrderField("CrewCountIn"); var StateToExclude = new List<string> { "cancelled", "requested", "to be cancelled", "deleted"}; string currentStateType = ""; if (input.GetOrderField("OrderState") != null) currentStateType = input.GetOrderField("OrderState").ToString().ToLower(); var matchesStateType = StateToExclude.Contains(currentStateType); var paxZeroIn = paxCountIn ==0 ; var crewZeroIn = crewCountIn ==0 ; var crewUnknownIn = crewCountIn ==null; var paxUnknownIn = paxCountIn ==null; //crew/pax missing on inbound var crewPaxMissing = crewUnknownIn || paxUnknownIn; //crew count zero in var crewZero = crewZeroIn; var autoAdd = (crewPaxMissing || crewZero) && !matchesStateType; return autoAdd; }))();
Auto-add if crew or pax count is missing on the departure leg - does not add if departure leg is missing
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 ((Func<bool>)(() => { var paxCountOut = (int?)input.GetOrderField("PaxCountOut"); var crewCountOut = (int?)input.GetOrderField("CrewCountOut"); var StateToExclude = new List<string> { "cancelled", "requested", "to be cancelled", "deleted"}; string currentStateType = ""; if (input.GetOrderField("OrderState") != null) currentStateType = input.GetOrderField("OrderState").ToString().ToLower(); var matchesStateType = StateToExclude.Contains(currentStateType); var paxZeroOut = paxCountOut ==0; var crewZeroOut = crewCountOut ==0; var crewUnknownOut = crewCountOut ==null; var paxUnknownOut = paxCountOut ==null; var noDepDateTimeDep = input.GetOrderField("MostActualDepartureDateTime") == null; var crewPaxMissing = crewUnknownOut || paxUnknownOut; var crewZero = crewZeroOut; var autoAdd = !matchesStateType && (!noDepDateTimeDep && (crewPaxMissing || crewZero)); return autoAdd; }))();
Auto-add an early crew show warning for early departures - will add 12 hours before departure only.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 ((Func<bool>)(() => { bool autoAdd = false; var departure = input.GetOrderField("MostActualDepartureDateTimeLT") as DateTime?; var from = TimeSpan.Parse("04:00"); var until = TimeSpan.Parse("07:59"); if (departure.HasValue) { var departureTime = departure.Value.TimeOfDay; var earlyCrew = (departureTime >= from && departureTime <= until); var durationInMin = (departure.Value.Date - DateTime.Now).Duration().TotalMinutes; var atdHappened = input.GetOrderField("AtdDateTime") == null; autoAdd = earlyCrew && durationInMin <=720 && atdHappened; } return autoAdd; }))();
Auto-add if MTOW is above 10000kg, pax count is between 11-30, and flight type is commercial. Or if pax count is 11-30 and MTOW is equal to or above 45500kg
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ((Func<bool>)(() => { var mtowKg = (int?)input.GetOrderField("MtowKg"); if (mtowKg.HasValue && mtowKg.Value < 10000) return false; // no screening var paxOut = (int?)input.GetOrderField("PaxCountOut"); var flightTypeOut = (string)input.GetOrderField("FlightTypeOut"); var matchesPaxOut = (paxOut.HasValue && (paxOut.Value > 10 && paxOut.Value <= 30)); var matchesCommercial = (mtowKg.HasValue && mtowKg.Value >= 10000) && (string.IsNullOrEmpty(flightTypeOut) || flightTypeOut.ToLower() == "commercial") && matchesPaxOut; var isAbove45Tons = (mtowKg.HasValue && mtowKg.Value >= 45500) && matchesPaxOut; var autoAdd = matchesCommercial || isAbove45Tons; return autoAdd; }))();
Auto-add if MTOW is below or equal to 10000Kgs, Departure Flight Type is 'Qualifying Flight', and Departing Pax Count is equal to 11 or below 31
1 2 3 4 input != null && (input.GetOrderField("MtowKg") != null && ((int)input.GetOrderField("MtowKg") >= 10000)) && (input.GetOrderField("FlightTypeOut") == null || (input.GetOrderField("FlightTypeOut").ToString().ToLower() == "qualifying flight")) && (input.GetOrderField("PaxOut") == null || (((int?)input.GetOrderField("PaxOut")).Value >= 11 && ((int?)input.GetOrderField("PaxOut")).Value < 31))

Custom value

The below examples use the order’s custom value data for auto-adding.

Auto-add based if a Custom value is not set
1 input.GetCustomValue("EBBR E-FACTOR") == null
Auto-add based on an Order Calculated Custom value returning 'Yes' or 'No' (Exclude for Yes)
1 input.GetCustomValue("Is EEA based Operator") != null && input.GetCustomValue("Is EEA based Operator").ToString()!= "Yes"
Auto-add based on order custom values e.g "Language" is set to "French" and the "Is Arrival" is set to "Yes"
1 input.GetCustomValue("Language") == "French" && input.GetCustomValue("Is Arrival") == "Yes"
Auto-add based on an Order Calculated Custom Value, Operator, and Pax Count
1 2 3 4 5 6 7 8 9 10 ((Func<bool>)(() => { var screenCode = input.GetCustomValue("Screening Code"); var operatorShortName = input.GetOrderField("OperatorShortName").ToString().ToUpper(); var operatorShortNames = new List<string> { "QATAR AMIRI", "ROYAL FLIGHT OMAN", "QATAR EXECUTIVE FLIGHT"}; var paxOut = (int?)input.GetOrderField("PaxCountOut"); return (screenCode == "TCP" || operatorShortNames.Contains(operatorShortName)) && (!paxOut.HasValue || (paxOut.HasValue && paxOut.Value < 11)); }))();
Auto-add based on a set of Custom Values and Pax Count >0
1 2 3 4 5 6 7 ((Func<bool>)(() => { var fattalLoungePaxArr = input.GetCustomValue("Fattal Terminal PAX - (Arr)") ?? ""; var list = new List<string> {"Lounge Hall", "Private Room"}; var paxIn = ((int?)input.GetOrderField("PaxCountIn")) ?? 0M; return list.Contains(fattalLoungePaxArr) && paxIn > 0; }))();
Auto-add based on a list of order custom values or if blank
1 2 3 4 5 ((Func<bool>)(() => { var terminalDetails = input.GetCustomValue("Terminal Details") ?? ""; var list = new List<string> { "", "PAT / PAT", "RYL > POS > PAT"}; return list.Contains(terminalDetails); }))();
Auto-Add based on the quantity of an order custom value e.g above 0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 The below formula shows an 'invalid input' error if the input is blank or not numeric. This is is the safest way to prevent silent data entry errors. ((Func<bool>)(() => { var transferCustomValue = input.GetCustomValue("PFC Transfer")?? ""; if (transferCustomValue == "") return true; var transferAsNumber = int.Parse(transferCustomValue); if (transferAsNumber > 0) return true; return false; }))(); This below formula never crashes on invalid input. It silently accepts invalid input like '1X', which will be seen as 0 ((Func<bool>)(() => { var petsCount = 0; if (input != null) { var stringValue = input.GetCustomValue("SkyPet Flight"); // Invalid stringValue will be converted to 0 without error int.TryParse(stringValue, out petsCount); } return petsCount > 0; }))(); Alternative is to accept at least a blank string as 0, and otherwise display an error, as follows ((Func<bool>)(() => { var petsCount = 0; if (input != null) { var stringValue = input.GetCustomValue("SkyPet Flight"); if (!string.IsNullOrWhiteSpace(stringValue)) // throw an error if user entered non numeric text petsCount = int.Parse(stringValue); } return petsCount > 0; }))();
Auto-Add based on custom values - In this example the auto-add is to add to orders except those with custom value "KHOU" or "EGGW"
1 input.GetCustomValue("Client Base") != "KHOU" && input.GetCustomValue("Client Base") != "EGGW"
Auto-add based on Custom Value for Prior Orders Count

This formula allows a specific product to be added when the Custom Value 'Prior Orders Count' is '0' - See Also 'How to show Prior Visits Count on an Order (per Registration)'

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ((Func<bool>)(() => { bool autoAdd = false; var priorVisits = input.GetPriorActualHandlingCountByRegistration("StartDate=2013-01-01") == 0; var StateToExclude = new List<string> { "to be cancelled" }; string currentStateType = ""; if (input.GetOrderField("OrderState") != null) currentStateType = input.GetOrderField("OrderState").ToString().ToLower(); var matchesStateType = StateToExclude.Contains(currentStateType); autoAdd = priorVisits && !matchesStateType; return autoAdd; }))();
Auto-add based on the value of 2 custom values combined
1 2 3 4 5 6 7 8 9 ((Func<bool>)(() => { int outboundPax = 0; int inboundPax = 0; int.TryParse(input.GetCustomValue("Lounge DEP"), out outboundPax); int.TryParse(input.GetCustomValue("Lounge ARR"), out inboundPax); var inAndOut = outboundPax + inboundPax; return inAndOut < 1; }))();
Auto-add based on 2 custom values either of which has a value above 0 but not if both values are above 0
1 2 3 4 5 6 7 8 ((Func<bool>)(() => { int outboundPax = 0; int inboundPax = 0; int.TryParse(input.GetCustomValue("Lounge DEP"), out outboundPax); int.TryParse(input.GetCustomValue("Lounge ARR"), out inboundPax); return (outboundPax > 0 && inboundPax == 0) || (outboundPax == 0 && inboundPax > 0); }))();
Auto-add based on 2 custom values both with a value above 0
1 2 3 4 5 6 7 8 ((Func<bool>)(() => { int outboundPax = 0; int inboundPax = 0; int.TryParse(input.GetCustomValue("Lounge DEP"), out outboundPax); int.TryParse(input.GetCustomValue("Lounge ARR"), out inboundPax); return outboundPax > 0 && inboundPax > 0; }))();
Auto-add for Custom Value Above 0 - E.g for Pets on Board (will not auto-add if value is blank)
1 input != null && input.GetCustomValue("Pets On Board") != null && input.GetCustomValue("Pets On-board ").ToString().Trim() != "" && int.Parse(input.GetCustomValue("Pets On-board ").ToString()) >= 1
1 input.GetCustomValue("Screening Code") == "TCP" || new List<string>{ "QATAR AMIRI", "ROYAL FLIGHT OMAN", "QATAR EXECUTIVE FLIGHT"}.Contains(input.GetOrderField("OperatorShortName").ToString().ToUpper())
Auto-add if registration has ‘Zollerlaubnisschein’ custom value set, is below 12001kg, and is arrival or departure flight type ‘Commercial', 'Medical’ or not specified
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ((Func<bool>)(() => { bool autoAdd = false; //Registration has permanent var hasZoller = input.GetCustomValue("ZOLLERLAUBNISSCHEIN") == "Permanent"; //mtow must be below 12001KG int mtowKg = 0; if (input.GetOrderField("MtowKg") != null) mtowKg = (int)input.GetOrderField("MtowKg"); //includes commercial flight type for arrival or departure var flightsToInclude = new[] {"commercial","medical"}; string currentFlightTypeIn = ""; if (input.GetOrderField("FlightTypeIn") != null) currentFlightTypeIn = input.GetOrderField("FlightTypeIn").ToString().ToLower(); var matchesFlightTypeIn = flightsToInclude.Contains(currentFlightTypeIn); string currentFlightTypeOut = ""; if (input.GetOrderField("FlightTypeOut") != null) currentFlightTypeOut = input.GetOrderField("FlightTypeOut").ToString().ToLower(); var matchesFlightTypeOut = flightsToInclude.Contains(currentFlightTypeOut); //includes if flight type has not been set var blankFlightTypeIn = input.GetOrderField("FlightTypeIn").ToString()== ""; var blankFlightTypeOut = input.GetOrderField("FlightTypeOut").ToString()== ""; return autoAdd = (!hasZoller && mtowKg <=12000) && (matchesFlightTypeIn || matchesFlightTypeOut || blankFlightTypeIn || blankFlightTypeOut); }))();