using System; using System.Collections.Generic; using Library; using System.Linq; using System.Data; using MySystem.ReadModels; namespace MySystem { public class UserDataDbconn { public readonly static UserDataDbconn Instance = new UserDataDbconn(); #region 广电卡存量查询 public int GetSimActTradeAmt(int UserId, string Month, string Kind = "Self") { int ActCount = 0; string PreMonth = DateTime.Parse(Month.Substring(0, 4) + "-" + Month.Substring(4, 2) + "-01 00:00:00").AddMonths(-1).ToString("yyyyMM"); DataTable dt = CustomerSqlConn.dtable("select SimValidAct" + Kind + "Count from KxsStatServer.SimValidAct" + PreMonth + " where UserId=" + UserId, MysqlConn.ReadSqlConnStr); if(dt.Rows.Count > 0) { ActCount = int.Parse(function.CheckInt(dt.Rows[0]["SimValidAct" + Kind + "Count"].ToString())); } return ActCount; } #endregion #region WIFI存量查询 public int GetWifiActTradeAmt(int UserId, string Month, string Kind = "Self") { int ActCount = 0; string PreMonth = DateTime.Parse(Month.Substring(0, 4) + "-" + Month.Substring(4, 2) + "-01 00:00:00").AddMonths(-1).ToString("yyyyMM"); DataTable dt = CustomerSqlConn.dtable("select sum(WifiAct" + Kind + "Count) WifiAct" + Kind + "Count from KxsStatServer.WifiValidAct" + PreMonth + " where UserId=" + UserId, MysqlConn.ReadSqlConnStr); if(dt.Rows.Count > 0) { ActCount = int.Parse(function.CheckInt(dt.Rows[0]["WifiAct" + Kind + "Count"].ToString())); } return ActCount; } #endregion } }