Conversie van de TransSmart solution van BizTalk 2013 naar 2016.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Helper.cs 2.2KB

4 viikkoa sitten
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. }