public static bool ArePreviousStopsInZone(this ManifestLegs manifestLegs, int startIndex, bool allStopsInZoneRequired, bool failIfNoPreviousStops) { var result = !failIfNoPreviousStops; for (int i = startIndex; i >= 0; i--) { var leg = manifestLegs.AllLegs[i]; var isInZone = ValidValues.IsValidZipCode(leg.CompanyZipInt); if (!allStopsInZoneRequired && isInZone) { return(true); } if (allStopsInZoneRequired && !isInZone) { return(false); } if (isInZone) { result = true; } } return(result); }
public static bool ContainsSequenceNumberAndName(this ManifestLegs manifestLegs, int sequenceNumber, IList <string> namesToContain) { return(manifestLegs .GetSequenceNumber(sequenceNumber) .CompanyNameContains(namesToContain)); }
public static int AllLegsGetNextStopInZone(this ManifestLegs manifestLegs, int startIndex = 0) { for (int i = startIndex; i < manifestLegs.AllLegs.Count; i++) { if (ValidValues.IsValidZipCode(manifestLegs.AllLegs[i].CompanyZipInt)) { return(i); } } return(-1); }
public static int GetCustomerCountBeforeMiamiRail(this ManifestLegs manifestLegs) { int count = 0; var railIndex = manifestLegs.GetLegsIndexOfMiamiRail(); if (railIndex > -1) { count += manifestLegs.FilteredLegs.Where((leg, i) => leg.CustomerNumber != "0" && leg.CustomerNumber != "3272" && i < railIndex).Count(); } return(count); }
public static int GetAllLegsIndexOfMiamiRail(this ManifestLegs manifestLegs) { for (int i = 0; i < manifestLegs.AllLegs.Count; i++) { var leg = manifestLegs.AllLegs[i]; if (leg.CompanyNameContains(new List <string>() { "FEC", "MIAMI" })) { return(i); } } return(-1); }
public static ImportedLeg GetMiamiRailLegAfterCustomers(this ManifestLegs manifestLegs) { bool foundCustomer = false; foreach (var leg in manifestLegs.AllLegs) { if (!leg.IsRail() && ValidValues.IsValidZipCode(leg.CompanyZipInt)) { foundCustomer = true; continue; } if (foundCustomer && leg.IsMiamiRail()) { return(leg); } } return(null); }
public static ImportedLeg GetMiamiRailLegBeforeCustomers(this ManifestLegs manifestLegs) { bool foundCustomer = false; for (int i = manifestLegs.AllLegs.Count - 1; i >= 0; i--) { var leg = manifestLegs.AllLegs[i]; if (!leg.IsRail() && ValidValues.IsValidZipCode(leg.CompanyZipInt)) { foundCustomer = true; continue; } if (foundCustomer && leg.IsMiamiRail()) { return(leg); } } return(null); }
public static bool ContainsSequenceNumber(this ManifestLegs manifestLegs, int sequenceNumber) { return(manifestLegs.GetSequenceNumber(sequenceNumber) != null); }
public static ImportedLeg GetSequenceNumber(this ManifestLegs manifestLegs, int sequenceNumber) { return(manifestLegs.AllLegs.FirstOrDefault(p => p.SequenceNumber == sequenceNumber)); }
public static int GetCustomerStopCount(this ManifestLegs manifestLegs) { return(manifestLegs.FilteredLegs.Count(leg => leg.CustomerNumber != "0" && leg.CustomerNumber != "3272")); }
public static bool IsCustomersBeforeMiamiRail(this ManifestLegs manifestLegs) { return(manifestLegs.GetCustomerCountBeforeMiamiRail() > 0); }