Conversie van de TransSmart solution van BizTalk 2013 naar 2016.
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

76 Zeilen
2.2KB

  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using TM.Shared.Components;
  8. namespace TM.TransSmart.Components
  9. {
  10. public class Helper
  11. {
  12. public string AdjustDeliveryDateTimeFrom(string loadingDate)
  13. {
  14. string result = GetAdjustedDeliveyDate(loadingDate);
  15. result += "T07:00:00";
  16. return result;
  17. }
  18. public string AdjustDeliveryDateTimeTo(string loadingDate)
  19. {
  20. string result = GetAdjustedDeliveyDate(loadingDate);
  21. result += "T16:00:00";
  22. return result;
  23. }
  24. private static string GetAdjustedDeliveyDate(string loadingDate)
  25. {
  26. var curdate = DateTime.Now.ToString("yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture);
  27. var dateCompareResult = String.Compare(curdate, loadingDate);
  28. string result;
  29. DateTime lDate = DateTime.ParseExact(loadingDate, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture);
  30. if (dateCompareResult <= 0)
  31. {
  32. result = lDate.AddDays(2).ToString("yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture);
  33. }
  34. else
  35. {
  36. result = DateTime.Now.ToString("yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture);
  37. }
  38. return result;
  39. }
  40. public string GetDelimitedValueByIndex(string input, string delimiter, string xsltIndex)
  41. {
  42. string result = "";
  43. try
  44. {
  45. int index = Convert.ToInt16(xsltIndex);
  46. if (input.EndsWith(delimiter))
  47. {
  48. input = input.Remove(input.Length - 1, 1);
  49. }
  50. ArrayList array_reference = new ArrayList(input.Split(Convert.ToChar(delimiter)));
  51. if (array_reference.Count - 1 >= index)
  52. {
  53. result = Convert.ToString(array_reference[index]);
  54. }
  55. }
  56. catch (Exception) { }
  57. return result;
  58. }
  59. }
  60. }