ScanProductInfo.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace LYFZ.CloudServerData.DAL
  6. {
  7. public class ScanProductInfo : BaseDataOperate<LYFZ.CloudServerData.Model.ScanProductInfo>
  8. {
  9. public ScanProductInfo(LYFZ.CloudServerData.Model.DBConnection dbConn)
  10. {
  11. base.DBConn = dbConn;
  12. }
  13. /// <summary>
  14. /// 获取扫一扫商品数据
  15. /// </summary>
  16. /// <param name="proNumber">商品编号</param>
  17. /// <param name="proType">商品类型</param>
  18. /// <returns></returns>
  19. public LYFZ.CloudServerData.Model.ScanProductInfo GetScanProductInfo(string EnterpriseID, string proType, string proNumber, string proName)
  20. {
  21. if (!String.IsNullOrEmpty(proNumber) && !string.IsNullOrEmpty(proType))
  22. {
  23. string strWhere = "";
  24. if (!string.IsNullOrEmpty(EnterpriseID))
  25. {
  26. if(!string.IsNullOrEmpty(strWhere))
  27. {
  28. strWhere += " and ";
  29. }
  30. strWhere += " EnterpriseID = '" + EnterpriseID + "' ";
  31. }
  32. if (!string.IsNullOrEmpty(proType))
  33. {
  34. if (!string.IsNullOrEmpty(strWhere))
  35. {
  36. strWhere += " and ";
  37. }
  38. strWhere += " ProType = '" + proType + "' ";
  39. }
  40. if (!string.IsNullOrEmpty(proNumber))
  41. {
  42. if (!string.IsNullOrEmpty(strWhere))
  43. {
  44. strWhere += " and ";
  45. }
  46. strWhere += " ProNumber = '" + proNumber + "' ";
  47. }
  48. if (!string.IsNullOrEmpty(proName))
  49. {
  50. if (!string.IsNullOrEmpty(strWhere))
  51. {
  52. strWhere += " and ";
  53. }
  54. strWhere += " ProName = '" + proName + "' ";
  55. }
  56. return this.GetModel(strWhere);
  57. }
  58. else
  59. {
  60. return null;
  61. }
  62. }
  63. /// <summary>
  64. /// 获取扫一扫商品数据
  65. /// </summary>
  66. /// <param name="ID"></param>
  67. /// <returns></returns>
  68. public LYFZ.CloudServerData.Model.ScanProductInfo GetScanProductInfo(string ID)
  69. {
  70. if (!String.IsNullOrEmpty(ID))
  71. {
  72. return this.GetModel("ID", ID);
  73. }
  74. else
  75. {
  76. return new Model.ScanProductInfo();
  77. }
  78. }
  79. /// <summary>
  80. /// 添加商品信息
  81. /// </summary>
  82. /// <param name="EnterpriseID">企业编号</param>
  83. /// <param name="ProType">商品类型</param>
  84. /// <param name="ProTypeList">所属分类</param>
  85. /// <param name="ProNumber">商品编号</param>
  86. /// <param name="ProName">商品名称</param>
  87. /// <param name="ProInfo">商品描述</param>
  88. /// <param name="CreateName">创建人名称</param>
  89. /// <returns></returns>
  90. public bool AddScanProductInfo(string EnterpriseID, string ProType, string ProTypeList, string ProNumber, string ProName, string ProInfo, string CreateName, string ImgUrl, decimal SellValue, decimal PQuantity)
  91. {
  92. Model.ScanProductInfo model = new Model.ScanProductInfo()
  93. {
  94. CreateName = CreateName,
  95. ProTypeList = ProTypeList,
  96. ProType = ProType,
  97. EnterpriseID = EnterpriseID,
  98. ProNumber = ProNumber,
  99. ProName = ProName,
  100. ProInfo = ProInfo,
  101. CreateTime = DateTime.Now,
  102. ImgUrl = ImgUrl,
  103. PQuantity = PQuantity,
  104. SellValue = SellValue
  105. };
  106. return this.Add(model);
  107. }
  108. public bool UpdateScanProductInfo(int ID, string EnterpriseID, string ProType, string ProTypeList, string ProNumber, string ProName, string ProInfo, string CreateName, string ImgUrl, decimal SellValue, decimal PQuantity)
  109. {
  110. Model.ScanProductInfo model = new Model.ScanProductInfo()
  111. {
  112. ID = ID,
  113. UpdateName = CreateName,
  114. ProTypeList = ProTypeList,
  115. ProType = ProType,
  116. EnterpriseID = EnterpriseID,
  117. ProNumber = ProNumber,
  118. ProName = ProName,
  119. ProInfo = ProInfo,
  120. UpdateTime = DateTime.Now,
  121. ImgUrl = ImgUrl,
  122. PQuantity = PQuantity,
  123. SellValue = SellValue
  124. };
  125. return this.Update(model);
  126. }
  127. public bool DeleteByBatchId(string _BatchId)
  128. {
  129. bool b = this.DeleteList(_BatchId);
  130. return b;
  131. }
  132. }
  133. }