// Entry Point. public void GetTrackingResult(string trackingNo) { shippingResult = new ShippingResult(); string shippingResultInString = string.Empty; if (!string.IsNullOrEmpty(trackingNo)) { CarrierName carrier = getCarrierName(trackingNo); CredentialValidation(carrier); switch (carrier) { case CarrierName.UPS: trackingFacility = new UPSTracking(); break; case CarrierName.USPS: trackingFacility = new USPSTracking(); break; case CarrierName.FedEx: trackingFacility = new FedExTracking(); break; default: trackingFacility = new USPSTracking(); break; } shippingResult = trackingFacility.GetTrackingResult(trackingNo); } }
private void CredentialValidation(CarrierName carrier) { if (!HasUPSCredentialSetup()) { throw new Exception("Please setup UPS credential first, before tracking UPS package."); } }
public virtual int _GetUniqueIdentifier() { var hashCode = 399326290; hashCode = hashCode * -1521134295 + (Id?.GetHashCode() ?? 0); hashCode = hashCode * -1521134295 + (CarrierName?.GetHashCode() ?? 0); return(hashCode); }
private CarrierName getCarrierName(string trackingNo) { CarrierName carrierName = CarrierName.USPS; if (IsUPSTracking(trackingNo)) { carrierName = CarrierName.UPS; } return(carrierName); }
private CarrierName GetCarrierName(string trackingNo) { CarrierName carrierName = CarrierName.USPS; if (IsUPSTracking(trackingNo)) { carrierName = CarrierName.UPS; } else if (IsUSPSTracking(trackingNo)) { carrierName = CarrierName.USPS; } else { carrierName = CarrierName.FedEx; } return(carrierName); }
public override int GetHashCode() { int hashcode = 157; unchecked { if (__isset.deviceName) { hashcode = (hashcode * 397) + DeviceName.GetHashCode(); } if (__isset.systemName) { hashcode = (hashcode * 397) + SystemName.GetHashCode(); } if (__isset.systemVersion) { hashcode = (hashcode * 397) + SystemVersion.GetHashCode(); } if (__isset.model) { hashcode = (hashcode * 397) + Model.GetHashCode(); } if (__isset.carrierCode) { hashcode = (hashcode * 397) + CarrierCode.GetHashCode(); } if (__isset.carrierName) { hashcode = (hashcode * 397) + CarrierName.GetHashCode(); } if (__isset.applicationType) { hashcode = (hashcode * 397) + ApplicationType.GetHashCode(); } } return(hashcode); }
private void CredentialValidation(CarrierName carrier) { if (carrier == CarrierName.FedEx) { if (!HasFedExCredentialSetup()) { throw new Exception("Please setup fedex credential first, before tracking fedex package."); } } else if (carrier == CarrierName.USPS) { if (!HasUSPSCredentialSetup()) { throw new Exception("Please setup USPS credential first, before tracking USPS package."); } } else { if (!HasUPSCredentialSetup()) { throw new Exception("Please setup UPS credential first, before tracking UPS package."); } } }
// Entry Point. public void GetTrackingResult(string trackingNo) { shippingResult = new ShippingResult(); string strShippingResult = string.Empty; try { if (!string.IsNullOrEmpty(trackingNo)) { CarrierName carrier = getCarrierName(trackingNo); CredentialValidation(carrier); trackingFacility = new UPSTracking(trackingNo); shippingResult = trackingFacility.GetTrackingResult(); } } catch (Exception e) { Console.WriteLine(e); } }
public override string ToString() { var sb = new StringBuilder("DeviceInfo("); bool __first = true; if (DeviceName != null && __isset.deviceName) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("DeviceName: "); DeviceName.ToString(sb); } if (SystemName != null && __isset.systemName) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("SystemName: "); SystemName.ToString(sb); } if (SystemVersion != null && __isset.systemVersion) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("SystemVersion: "); SystemVersion.ToString(sb); } if (Model != null && __isset.model) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("Model: "); Model.ToString(sb); } if (__isset.carrierCode) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("CarrierCode: "); CarrierCode.ToString(sb); } if (CarrierName != null && __isset.carrierName) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("CarrierName: "); CarrierName.ToString(sb); } if (__isset.applicationType) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("ApplicationType: "); ApplicationType.ToString(sb); } sb.Append(")"); return(sb.ToString()); }