BaseUpload.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Collections;
  7. using System.Data;
  8. using WdtUtils;
  9. namespace TempDbToWang
  10. {
  11. /// <summary>
  12. /// 中间库上传旺店通基类
  13. /// </summary>
  14. public abstract class BaseUpload : IUploadToWang
  15. {
  16. #region 变量定义
  17. protected DataTable _data = new DataTable();
  18. #endregion
  19. /// <summary>
  20. /// 上传数据至旺店通
  21. /// </summary>
  22. /// <param name="args"></param>
  23. public void UploadToWang(Hashtable args)
  24. {
  25. _PrepareData(args);
  26. foreach (DataRow item in _data.Rows)
  27. {
  28. _WriteLog(_Upload(item),item);
  29. }
  30. }
  31. /// <summary>
  32. /// 数据准备
  33. /// </summary>
  34. /// <param name="args"></param>
  35. protected abstract void _PrepareData(Hashtable args);
  36. /// <summary>
  37. /// 导入单据
  38. /// </summary>
  39. /// <param name="dr"></param>
  40. /// <returns></returns>
  41. protected abstract AddResult _Upload(DataRow dr);
  42. /// <summary>
  43. /// 写日志
  44. /// </summary>
  45. /// <param name="flag"></param>
  46. /// <param name="dr"></param>
  47. protected abstract void _WriteLog(AddResult result,DataRow dr);
  48. protected abstract string _GetData(DataRow dr);
  49. }
  50. }