No Description

orders.cs 6.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. using System.Linq;
  5. using System.Reflection;
  6. using System.Text;
  7. namespace CallCenterApi.BLL
  8. {
  9. /// <summary>
  10. ///订单表
  11. /// </summary>
  12. public partial class orders
  13. {
  14. //private readonly Model.sysconfig sysConfig = new BLL.sysconfig().loadConfig();//获得系统配置信息
  15. private readonly CallCenterApi.DAL.orders dal;
  16. public orders()
  17. {
  18. dal = new CallCenterApi.DAL.orders();
  19. }
  20. #region 基本方法================================
  21. /// <summary>
  22. /// 是否存在该记录
  23. /// </summary>
  24. public bool Exists(int id)
  25. {
  26. return dal.Exists(id);
  27. }
  28. /// <summary>
  29. /// 增加一条数据
  30. /// </summary>
  31. public int Add(Model.orders model)
  32. {
  33. return dal.Add(model);
  34. }
  35. ///// <summary>
  36. ///// 更新一条数据
  37. ///// </summary>
  38. //public bool Update(Model.orders model)
  39. //{
  40. // //计算订单总金额:商品总金额+配送费用+支付手续费
  41. // model.order_amount = model.real_amount + model.express_fee + model.payment_fee + model.invoice_taxes;
  42. // return dal.Update(model);
  43. //}
  44. /// <summary>
  45. /// 删除一条数据
  46. /// </summary>
  47. public bool Delete(int id)
  48. {
  49. return dal.Delete(id);
  50. }
  51. /// <summary>
  52. /// 得到一个对象实体
  53. /// </summary>
  54. public Model.orders GetModel(int id)
  55. {
  56. return dal.GetModel(id);
  57. }
  58. /// <summary>
  59. /// 获得前几行数据
  60. /// </summary>
  61. public DataSet GetList(int Top, string strWhere, string filedOrder)
  62. {
  63. return dal.GetList(Top, strWhere, filedOrder);
  64. }
  65. ///// <summary>
  66. ///// 获得查询分页数据
  67. ///// </summary>
  68. //public DataSet GetList(int pageSize, int pageIndex, string strWhere, string filedOrder, out int recordCount)
  69. //{
  70. // return dal.GetList(pageSize, pageIndex, strWhere, filedOrder, out recordCount);
  71. //}
  72. #endregion
  73. #region 扩展方法================================
  74. /// <summary>
  75. /// 是否存在该记录
  76. /// </summary>
  77. public bool Exists(string order_no)
  78. {
  79. return dal.Exists(order_no);
  80. }
  81. /// <summary>
  82. /// 根据订单号返回一个实体
  83. /// </summary>
  84. public Model.orders GetModel(string order_no)
  85. {
  86. return dal.GetModel(order_no);
  87. }
  88. /// <summary>
  89. /// 根据订单号获取支付方式ID
  90. /// </summary>
  91. public int GetPaymentId(string order_no)
  92. {
  93. return dal.GetPaymentId(order_no);
  94. }
  95. /// <summary>
  96. /// 返回数据数
  97. /// </summary>
  98. public int GetCount(string strWhere)
  99. {
  100. return dal.GetCount(strWhere);
  101. }
  102. /// <summary>
  103. /// 修改一列数据
  104. /// </summary>
  105. public void UpdateField(int id, string strValue)
  106. {
  107. dal.UpdateField(id, strValue);
  108. }
  109. /// <summary>
  110. /// 修改一列数据
  111. /// </summary>
  112. public bool UpdateField(string order_no, string strValue)
  113. {
  114. return dal.UpdateField(order_no, strValue);
  115. }
  116. #endregion
  117. public List<Model.orders> DataTableToList(DataTable dt)
  118. {
  119. List<Model.orders> list = new List<Model.orders>();
  120. int rowsCount = dt.Rows.Count;
  121. if (rowsCount > 0)
  122. {
  123. CallCenterApi.Model.orders model;
  124. for (int n = 0; n < rowsCount; n++)
  125. {
  126. model = new CallCenterApi.Model.orders();
  127. if (dt.Rows[n]["id"] != null && dt.Rows[n]["id"].ToString() != "")
  128. {
  129. model.id = int.Parse(dt.Rows[n]["id"].ToString());
  130. }
  131. if (dt.Rows[n]["order_no"] != null && dt.Rows[n]["order_no"].ToString() != "")
  132. {
  133. model.order_no = dt.Rows[n]["order_no"].ToString();
  134. }
  135. if (dt.Rows[n]["user_id"] != DBNull.Value && dt.Rows[n]["user_id"].ToString() != "")
  136. {
  137. model.user_id = int.Parse(dt.Rows[n]["user_id"].ToString());
  138. }
  139. else
  140. {
  141. model.user_id = null;
  142. }
  143. if (dt.Rows[n]["user_name"] != null && dt.Rows[n]["user_name"].ToString() != "")
  144. {
  145. model.user_name = dt.Rows[n]["user_name"].ToString();
  146. }
  147. if (dt.Rows[n]["express_id"] != null && dt.Rows[n]["express_id"].ToString() != "")
  148. {
  149. model.express_id = int.Parse(dt.Rows[n]["express_id"].ToString());
  150. }
  151. if (dt.Rows[n]["express_no"] != null && dt.Rows[n]["express_no"].ToString() != "")
  152. {
  153. model.express_no = dt.Rows[n]["express_no"].ToString();
  154. }
  155. if (dt.Rows[n]["accept_name"] != null && dt.Rows[n]["accept_name"].ToString() != "")
  156. {
  157. model.accept_name = dt.Rows[n]["accept_name"].ToString();
  158. }
  159. if (dt.Rows[n]["post_code"] != null && dt.Rows[n]["post_code"].ToString() != "")
  160. {
  161. model.post_code = dt.Rows[n]["post_code"].ToString();
  162. }
  163. if (dt.Rows[n]["telphone"] != null && dt.Rows[n]["telphone"].ToString() != "")
  164. {
  165. model.telphone = dt.Rows[n]["telphone"].ToString();
  166. }
  167. if (dt.Rows[n]["mobile"] != null && dt.Rows[n]["mobile"].ToString() != "")
  168. {
  169. model.mobile = dt.Rows[n]["mobile"].ToString();
  170. }
  171. if (dt.Rows[n]["address"] != null && dt.Rows[n]["address"].ToString() != "")
  172. {
  173. model.address = dt.Rows[n]["address"].ToString();
  174. }
  175. if (dt.Rows[n]["remark"] != null && dt.Rows[n]["remark"].ToString() != "")
  176. {
  177. model.remark = dt.Rows[n]["remark"].ToString();
  178. }
  179. list.Add(model);
  180. }
  181. }
  182. return list;
  183. }
  184. }
  185. }