Açıklama Yok

DockingSystem.cs 8.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Data;
  6. using XYFDRQ.DBUtility;
  7. namespace XYFDRQ.DAL
  8. {
  9. /// <summary>
  10. /// 数据访问类:DockingSystem
  11. /// </summary>
  12. public partial class DockingSystem
  13. {
  14. public DockingSystem()
  15. { }
  16. #region 基本代码段
  17. #region 客户信息
  18. /// <summary>
  19. /// 获取客户信息
  20. /// </summary>
  21. /// <returns></returns>
  22. public DataTable GetUserInfo(string strWhere)
  23. {
  24. try
  25. {
  26. string sql = "select * FROM V_CallCenter_CusInfos where 1=1 " + strWhere;
  27. return DbHelperSQLIGMS.Query(sql).Tables[0];
  28. }
  29. catch (Exception)
  30. {
  31. throw;
  32. }
  33. }
  34. #endregion
  35. #region 小区信息
  36. /// <summary>
  37. /// 根据小区id获取小区信息
  38. /// </summary>
  39. /// <param name="lvId"></param>
  40. /// <returns></returns>
  41. public DataTable GetLvInfo(string lvId)
  42. {
  43. try
  44. {
  45. string sql = "select * from Lv where lvId=" + lvId;
  46. return DbHelperSQLIGMS.Query(sql).Tables[0];
  47. }
  48. catch (Exception)
  49. {
  50. throw;
  51. }
  52. }
  53. /// <summary>
  54. /// 根据小区编号或名称获取小区信息
  55. /// </summary>
  56. /// <param name="code"></param>
  57. /// <returns></returns>
  58. public DataTable GetLvInfos(string code)
  59. {
  60. try
  61. {
  62. string sql = "select top 10 * from Lv where Code like '" + code + "%' or Text like '%"+code+"%'";
  63. return DbHelperSQLIGMS.Query(sql).Tables[0];
  64. }
  65. catch (Exception)
  66. {
  67. throw;
  68. }
  69. }
  70. /// <summary>
  71. /// 获取小区信息列表
  72. /// </summary>
  73. /// <param name="code"></param>
  74. /// <returns></returns>
  75. public DataTable GetLvInfos()
  76. {
  77. try
  78. {
  79. string sql = "select * from Lv";
  80. return DbHelperSQLIGMS.Query(sql).Tables[0];
  81. }
  82. catch (Exception)
  83. {
  84. throw;
  85. }
  86. }
  87. #endregion
  88. #region 区域信息
  89. /// <summary>
  90. /// 获取区域id获取区域信息
  91. /// </summary>
  92. /// <param name="regionId"></param>
  93. /// <returns></returns>
  94. public DataTable GetRegionInfo(string regionId)
  95. {
  96. try
  97. {
  98. string sql = "select * from Region where regionId=" + regionId;
  99. return DbHelperSQLIGMS.Query(sql).Tables[0];
  100. }
  101. catch (Exception)
  102. {
  103. throw;
  104. }
  105. }
  106. #endregion
  107. #region 用气类型
  108. /// <summary>
  109. /// 获取用气类型信息
  110. /// </summary>
  111. /// <returns></returns>
  112. public DataTable GetPrice(string GasPriceId)
  113. {
  114. try
  115. {
  116. string sql = "select * from GasPrice where GasPriceId=" + GasPriceId;
  117. return DbHelperSQLIGMS.Query(sql).Tables[0];
  118. }
  119. catch (Exception ex)
  120. {
  121. throw;
  122. }
  123. }
  124. #endregion
  125. #region 表具信息
  126. /// <summary>
  127. /// 获取表具信息
  128. /// </summary>
  129. /// <returns></returns>
  130. public DataTable GetDevice(string AddressId)
  131. {
  132. try
  133. {
  134. string sql = "select * from Device where AddressId=" + AddressId;
  135. return DbHelperSQLIGMS.Query(sql).Tables[0];
  136. }
  137. catch (Exception ex)
  138. {
  139. throw;
  140. }
  141. }
  142. #endregion
  143. #region IC卡信息
  144. /// <summary>
  145. /// 获取IC卡信息
  146. /// </summary>
  147. /// <param name="DeviceId"></param>
  148. /// <returns></returns>
  149. public DataTable GetICCard(string DeviceId)
  150. {
  151. try
  152. {
  153. string sql = " select * from ICCard where DeviceId=" + DeviceId;
  154. return DbHelperSQLIGMS.Query(sql).Tables[0];
  155. }
  156. catch (Exception ex)
  157. {
  158. throw;
  159. }
  160. }
  161. #endregion
  162. #region 抄表记录表
  163. /// <summary>
  164. /// 获取最后一次读表信息
  165. /// </summary>
  166. /// <param name="AddressId"></param>
  167. /// <param name="GasUserId"></param>
  168. /// <returns></returns>
  169. public DataTable GetLastReadMeterRecord(string AddressId, string GasUserId)
  170. {
  171. try
  172. {
  173. string sql = "select top 1 * from ReadMeterRecord where GasUserId=" + GasUserId + " and AddressId=" + AddressId + " order by ReadMeterRecordId desc";
  174. return DbHelperSQLIGMS.Query(sql).Tables[0];
  175. }
  176. catch (Exception ex)
  177. {
  178. throw;
  179. }
  180. }
  181. /// <summary>
  182. /// 获取读表信息
  183. /// </summary>
  184. /// <param name="AddressId"></param>
  185. /// <param name="GasUserId"></param>
  186. /// <returns></returns>
  187. public DataTable GetReadMeterRecord(string AddressId, string GasUserId)
  188. {
  189. try
  190. {
  191. string sql = "select * from ReadMeterRecord where GasUserId=" + GasUserId + " and AddressId=" + AddressId + " order by ReadMeterRecordId desc";
  192. return DbHelperSQLIGMS.Query(sql).Tables[0];
  193. }
  194. catch (Exception ex)
  195. {
  196. throw;
  197. }
  198. }
  199. #endregion
  200. #region 包装记录
  201. /// <summary>
  202. /// 获取报装记录信息
  203. /// </summary>
  204. /// <param name="AddressId"></param>
  205. /// <returns></returns>
  206. public DataTable GetAddressProjectInfo(string AddressId)
  207. {
  208. try
  209. {
  210. string sql = "select * from AddressProjectInfo where AddressId=" + AddressId;
  211. return DbHelperSQLIGMS.Query(sql).Tables[0];
  212. }
  213. catch (Exception ex)
  214. {
  215. throw;
  216. }
  217. }
  218. #endregion
  219. #region 产品类型
  220. /// <summary>
  221. /// 获取产品类型信息
  222. /// </summary>
  223. /// <param name="ProductId"></param>
  224. /// <returns></returns>
  225. public DataTable GetProduct(string ProductId)
  226. {
  227. try
  228. {
  229. string sql = "select * from Product where ProductId=" + ProductId;
  230. return DbHelperSQLIGMS.Query(sql).Tables[0];
  231. }
  232. catch (Exception ex)
  233. {
  234. throw;
  235. }
  236. }
  237. #endregion
  238. #region 根据客户编号获取客户的欠费金额
  239. /// <summary>
  240. /// 根据客户编号获取客户的欠费金额
  241. /// </summary>
  242. /// <param name="cusCode"></param>
  243. /// <returns></returns>
  244. public DataTable GetQFMoneyByCusCode(string cusCode)
  245. {
  246. try
  247. {
  248. string sql = "select top 1 [Month],TotalCount,ActualReceivableMoney from V_CallCenter_Income where AddressId=(select top 1 AddressId from V_CallCenter_CusInfos where AddressNumber='" + cusCode + "') and State=-1 order by [date] desc";
  249. return DbHelperSQLIGMS.Query(sql).Tables[0];
  250. }
  251. catch (Exception ex)
  252. {
  253. throw;
  254. }
  255. }
  256. #endregion
  257. #region 根据客户编号获取客户所有的欠费金额
  258. /// <summary>
  259. /// 根据客户编号获取客户所有的欠费金额
  260. /// </summary>
  261. /// <param name="cusCode"></param>
  262. /// <returns></returns>
  263. public DataTable GetALLQFMoneyByCusCode(string cusCode)
  264. {
  265. try
  266. {
  267. string sql = "select isnull(SUM(TotalCount),0) as TotalCount,isnull(SUM(ActualReceivableMoney),0) as ActualReceivableMoney from V_CallCenter_Income where AddressId=(select top 1 AddressId from V_CallCenter_CusInfos where AddressNumber='" + cusCode + "') and State=-1";
  268. return DbHelperSQLIGMS.Query(sql).Tables[0];
  269. }
  270. catch (Exception ex)
  271. {
  272. throw;
  273. }
  274. }
  275. #endregion
  276. #endregion
  277. }
  278. }