| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Data;
- using XYFDRQ.DBUtility;
- namespace XYFDRQ.DAL
- {
- /// <summary>
- /// 数据访问类:DockingSystem
- /// </summary>
- public partial class DockingSystem
- {
- public DockingSystem()
- { }
- #region 基本代码段
- #region 客户信息
- /// <summary>
- /// 获取客户信息
- /// </summary>
- /// <returns></returns>
- public DataTable GetUserInfo(string strWhere)
- {
- try
- {
- string sql = "select * FROM V_CallCenter_CusInfos where 1=1 " + strWhere;
- return DbHelperSQLIGMS.Query(sql).Tables[0];
- }
- catch (Exception)
- {
- throw;
- }
- }
- #endregion
- #region 小区信息
- /// <summary>
- /// 根据小区id获取小区信息
- /// </summary>
- /// <param name="lvId"></param>
- /// <returns></returns>
- public DataTable GetLvInfo(string lvId)
- {
- try
- {
- string sql = "select * from Lv where lvId=" + lvId;
- return DbHelperSQLIGMS.Query(sql).Tables[0];
- }
- catch (Exception)
- {
- throw;
- }
- }
- /// <summary>
- /// 根据小区编号或名称获取小区信息
- /// </summary>
- /// <param name="code"></param>
- /// <returns></returns>
- public DataTable GetLvInfos(string code)
- {
- try
- {
- string sql = "select top 10 * from Lv where Code like '" + code + "%' or Text like '%"+code+"%'";
- return DbHelperSQLIGMS.Query(sql).Tables[0];
- }
- catch (Exception)
- {
- throw;
- }
- }
- /// <summary>
- /// 获取小区信息列表
- /// </summary>
- /// <param name="code"></param>
- /// <returns></returns>
- public DataTable GetLvInfos()
- {
- try
- {
- string sql = "select * from Lv";
- return DbHelperSQLIGMS.Query(sql).Tables[0];
- }
- catch (Exception)
- {
- throw;
- }
- }
- #endregion
- #region 区域信息
- /// <summary>
- /// 获取区域id获取区域信息
- /// </summary>
- /// <param name="regionId"></param>
- /// <returns></returns>
- public DataTable GetRegionInfo(string regionId)
- {
- try
- {
- string sql = "select * from Region where regionId=" + regionId;
- return DbHelperSQLIGMS.Query(sql).Tables[0];
- }
- catch (Exception)
- {
- throw;
- }
- }
- #endregion
- #region 用气类型
- /// <summary>
- /// 获取用气类型信息
- /// </summary>
- /// <returns></returns>
- public DataTable GetPrice(string GasPriceId)
- {
- try
- {
- string sql = "select * from GasPrice where GasPriceId=" + GasPriceId;
- return DbHelperSQLIGMS.Query(sql).Tables[0];
- }
- catch (Exception ex)
- {
- throw;
- }
- }
- #endregion
- #region 表具信息
- /// <summary>
- /// 获取表具信息
- /// </summary>
- /// <returns></returns>
- public DataTable GetDevice(string AddressId)
- {
- try
- {
- string sql = "select * from Device where AddressId=" + AddressId;
- return DbHelperSQLIGMS.Query(sql).Tables[0];
- }
- catch (Exception ex)
- {
- throw;
- }
- }
- #endregion
- #region IC卡信息
- /// <summary>
- /// 获取IC卡信息
- /// </summary>
- /// <param name="DeviceId"></param>
- /// <returns></returns>
- public DataTable GetICCard(string DeviceId)
- {
- try
- {
- string sql = " select * from ICCard where DeviceId=" + DeviceId;
- return DbHelperSQLIGMS.Query(sql).Tables[0];
- }
- catch (Exception ex)
- {
- throw;
- }
- }
- #endregion
- #region 抄表记录表
- /// <summary>
- /// 获取最后一次读表信息
- /// </summary>
- /// <param name="AddressId"></param>
- /// <param name="GasUserId"></param>
- /// <returns></returns>
- public DataTable GetLastReadMeterRecord(string AddressId, string GasUserId)
- {
- try
- {
- string sql = "select top 1 * from ReadMeterRecord where GasUserId=" + GasUserId + " and AddressId=" + AddressId + " order by ReadMeterRecordId desc";
- return DbHelperSQLIGMS.Query(sql).Tables[0];
- }
- catch (Exception ex)
- {
- throw;
- }
- }
- /// <summary>
- /// 获取读表信息
- /// </summary>
- /// <param name="AddressId"></param>
- /// <param name="GasUserId"></param>
- /// <returns></returns>
- public DataTable GetReadMeterRecord(string AddressId, string GasUserId)
- {
- try
- {
- string sql = "select * from ReadMeterRecord where GasUserId=" + GasUserId + " and AddressId=" + AddressId + " order by ReadMeterRecordId desc";
- return DbHelperSQLIGMS.Query(sql).Tables[0];
- }
- catch (Exception ex)
- {
- throw;
- }
- }
-
- #endregion
- #region 包装记录
- /// <summary>
- /// 获取报装记录信息
- /// </summary>
- /// <param name="AddressId"></param>
- /// <returns></returns>
- public DataTable GetAddressProjectInfo(string AddressId)
- {
- try
- {
- string sql = "select * from AddressProjectInfo where AddressId=" + AddressId;
- return DbHelperSQLIGMS.Query(sql).Tables[0];
- }
- catch (Exception ex)
- {
- throw;
- }
- }
- #endregion
- #region 产品类型
- /// <summary>
- /// 获取产品类型信息
- /// </summary>
- /// <param name="ProductId"></param>
- /// <returns></returns>
- public DataTable GetProduct(string ProductId)
- {
- try
- {
- string sql = "select * from Product where ProductId=" + ProductId;
- return DbHelperSQLIGMS.Query(sql).Tables[0];
- }
- catch (Exception ex)
- {
- throw;
- }
- }
- #endregion
- #region 根据客户编号获取客户的欠费金额
- /// <summary>
- /// 根据客户编号获取客户的欠费金额
- /// </summary>
- /// <param name="cusCode"></param>
- /// <returns></returns>
- public DataTable GetQFMoneyByCusCode(string cusCode)
- {
- try
- {
- 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";
- return DbHelperSQLIGMS.Query(sql).Tables[0];
- }
- catch (Exception ex)
- {
- throw;
- }
- }
- #endregion
- #region 根据客户编号获取客户所有的欠费金额
- /// <summary>
- /// 根据客户编号获取客户所有的欠费金额
- /// </summary>
- /// <param name="cusCode"></param>
- /// <returns></returns>
- public DataTable GetALLQFMoneyByCusCode(string cusCode)
- {
- try
- {
- 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";
- return DbHelperSQLIGMS.Query(sql).Tables[0];
- }
- catch (Exception ex)
- {
- throw;
- }
- }
- #endregion
- #endregion
- }
- }
|