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.

100 lines
3.9 KiB

2 years ago
  1. using System;
  2. using System.Configuration;
  3. using EasyBL.WebApi.Message;
  4. using Newtonsoft.Json.Linq;
  5. using System.Collections.Generic;
  6. using TestAP.Helper;
  7. using System.Linq;
  8. namespace TestAP
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14. ResponseMessage rm = null;
  15. string sMsg = null;
  16. Dictionary<string, int> dicSucceccCount = new Dictionary<string, int>();
  17. try
  18. {
  19. do
  20. {
  21. string sStartDate = ConfigurationManager.AppSettings["StartDate"];
  22. string sEndDate = ConfigurationManager.AppSettings["EndDate"];
  23. string sExport = ConfigurationManager.AppSettings["Export"];
  24. string sExportReturn = ConfigurationManager.AppSettings["ExportReturn"];
  25. string sImport = ConfigurationManager.AppSettings["Import"];
  26. string sImportReturn = ConfigurationManager.AppSettings["ImportReturn"];
  27. string sOther = ConfigurationManager.AppSettings["Other"];
  28. string sOtherTG = ConfigurationManager.AppSettings["OtherTG"];
  29. string sExhibtion = ConfigurationManager.AppSettings["Exhibtion"];
  30. string sCustomer = ConfigurationManager.AppSettings["Customer"];
  31. string sBillsNo = ConfigurationManager.AppSettings["BillsNo"];
  32. string sExhibtionsNo = ConfigurationManager.AppSettings["ExhibtionsNo"];
  33. string sCustomersNo = ConfigurationManager.AppSettings["CustomersNo"];
  34. List<string> BillsNo = string.IsNullOrEmpty(sBillsNo) ? new List<string>() : sBillsNo.Split(',').ToList();
  35. List<string> ExhibtionsNo = string.IsNullOrEmpty(sExhibtionsNo) ? new List<string>() : sExhibtionsNo.Split(',').ToList();
  36. List<string> CustomersNo = string.IsNullOrEmpty(sCustomersNo) ? new List<string>() : sCustomersNo.Split(',').ToList();
  37. ConvertData cv = new ConvertData();
  38. cv.StartDate = sStartDate;
  39. cv.EndDate = sEndDate;
  40. cv.ExcExport = cv.StringConvertBool(sExport);
  41. cv.ExcExportReturn = cv.StringConvertBool(sExportReturn);
  42. cv.ExcImport = cv.StringConvertBool(sImport);
  43. cv.ExcImportReturn = cv.StringConvertBool(sImportReturn);
  44. cv.ExcOther = cv.StringConvertBool(sOther);
  45. cv.ExcOtherTG = cv.StringConvertBool(sOtherTG);
  46. cv.ExcExhibtion = cv.StringConvertBool(sExhibtion);
  47. cv.ExcCustomer = cv.StringConvertBool(sCustomer);
  48. cv.BillsNo = BillsNo;
  49. cv.ExhibtionsNo = ExhibtionsNo;
  50. cv.CustomersNo = CustomersNo;
  51. dicSucceccCount = cv.StartConvert(out sMsg);
  52. if (sMsg != null)
  53. {
  54. break;
  55. }
  56. Console.WriteLine("完成");
  57. }
  58. while (false);
  59. }
  60. catch (Exception ex)
  61. {
  62. sMsg = ex.Message;
  63. }
  64. if (sMsg != null)
  65. {
  66. Console.WriteLine(sMsg);
  67. }
  68. else
  69. {
  70. foreach (var item in dicSucceccCount)
  71. {
  72. Console.WriteLine($"{ item.Key }:共新增 { item.Value } 筆");
  73. }
  74. }
  75. Console.ReadLine();
  76. }
  77. static string GetObjectValue(JObject i_oJObject, string i_sColumn)
  78. {
  79. string sReturnValue = string.Empty;
  80. if (i_oJObject[i_sColumn] != null)
  81. {
  82. sReturnValue = i_oJObject[i_sColumn].ToString();
  83. }
  84. return sReturnValue;
  85. }
  86. }
  87. }