VendorUpLoad.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. using cuidian.Sql;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using WdtUtils;
  8. using WdtUtils.Load;
  9. using WdtUtils.Proxy;
  10. namespace WangToTempDb
  11. {
  12. /// <summary>
  13. /// 旺店通供应商上传中间库
  14. /// </summary>
  15. public class VendorUpLoad : BaseUpLoad
  16. {
  17. private string __sql = "if not exists (select 1 from {14}..Vendor where cvencode = '{0}') insert into Vendor(cVenCode,cVenName,cVenPerson,cVenPhone,mobile,fax,cVenDefine11,email,cVenDefine4,cVenDefine5,[address],cVenDefine7,cmemo,cVenAbbName) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}')";
  18. protected override Result _LoadFirstPage()
  19. {
  20. VendorProxy tmp = new VendorProxy();
  21. Result rtn = _load.Load<VendorProxy>(_args, ref tmp);
  22. _proxy = tmp;
  23. return rtn;
  24. }
  25. protected override void _SetLoader()
  26. {
  27. _load = new VendorLoad();
  28. }
  29. protected override void _ImportData()
  30. {
  31. _operType = "插入供应商中间表数据";
  32. Provider_List[] entitys = ((VendorProxy)_proxy).provider_list;
  33. StringBuilder sb = new StringBuilder();
  34. foreach (Provider_List item in entitys)
  35. {
  36. sb.AppendLine(string.Format(__sql, new object[] { _ConvertStr(item.provider_no), _ConvertStr(item.provider_name), _ConvertStr(item.contact), _ConvertStr(item.telno), _ConvertStr(item.mobile), _ConvertStr(item.fax), _ConvertNotStr(item.zip), _ConvertStr(item.email), _ConvertStr(item.qq), _ConvertStr(item.wangwang), _ConvertStr(item.address), _ConvertStr(item.website), _ConvertStr(item.remark), _ConvertStr(item.provider_name),ConnectionUtils.Instance.GetConnection().Database }));
  37. _InsertIntoTempDb(sb.ToString(), item.provider_no);
  38. }
  39. }
  40. protected override void _DeleteDup()
  41. {
  42. _operType = "删除供应商中间表重复数据";
  43. string sql = "delete a from {0}..Vendor a,{1}..Vendor b where a.cVenCode = b.cVenCode";
  44. DbUtils.ExecuteNonQuery(string.Format(sql, _tempDb.Database, _targetDb.Database), _tempDb);
  45. }
  46. protected override void _LoadNextPage()
  47. {
  48. _proxy = _load.Load<VendorProxy>(_args);
  49. }
  50. }
  51. }