/// <summary> /// 查询新增用户(每小时) /// </summary> /// <param name="t_time">查询日期(2016-03-31)</param> /// <returns></returns> public DataSet GetListReportAddUser(string t_time) { StringBuilder strSql = new StringBuilder(); strSql.AppendFormat(@"select convert(nvarchar(13),t_time,120) times,count(1) counts from jmp_terminal where convert(nvarchar(10),t_time,120)='{0}' group by convert(nvarchar(13),t_time,120)", t_time); return(DbHelperSQLDEVICE.Query(strSql.ToString())); }
/// <summary> /// 获得数据列表 /// </summary> public DataSet GetList(string strWhere) { StringBuilder strSql = new StringBuilder(); strSql.Append("select * "); strSql.Append(" FROM jmp_liveteral "); if (strWhere.Trim() != "") { strSql.Append(" where " + strWhere); } return(DbHelperSQLDEVICE.Query(strSql.ToString())); }
/// <summary> /// 得到一个对象实体 /// </summary> public JMP.MDL.jmp_terminal GetModel(int t_id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select t_id, t_system, t_hardware, t_sdkver, t_time, t_screen, t_network, t_appid, t_key, t_mark, t_ip, t_province, t_imsi, t_nettype, t_brand "); strSql.Append(" from jmp_terminal "); strSql.Append(" where t_id=@t_id"); SqlParameter[] parameters = { new SqlParameter("@t_id", SqlDbType.Int, 4) }; parameters[0].Value = t_id; JMP.MDL.jmp_terminal model = new JMP.MDL.jmp_terminal(); DataSet ds = DbHelperSQLDEVICE.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["t_id"].ToString() != "") { model.t_id = int.Parse(ds.Tables[0].Rows[0]["t_id"].ToString()); } model.t_system = ds.Tables[0].Rows[0]["t_system"].ToString(); model.t_hardware = ds.Tables[0].Rows[0]["t_hardware"].ToString(); model.t_sdkver = ds.Tables[0].Rows[0]["t_sdkver"].ToString(); if (ds.Tables[0].Rows[0]["t_time"].ToString() != "") { model.t_time = DateTime.Parse(ds.Tables[0].Rows[0]["t_time"].ToString()); } model.t_screen = ds.Tables[0].Rows[0]["t_screen"].ToString(); model.t_network = ds.Tables[0].Rows[0]["t_network"].ToString(); if (ds.Tables[0].Rows[0]["t_appid"].ToString() != "") { model.t_appid = int.Parse(ds.Tables[0].Rows[0]["t_appid"].ToString()); } model.t_key = ds.Tables[0].Rows[0]["t_key"].ToString(); model.t_mark = ds.Tables[0].Rows[0]["t_mark"].ToString(); model.t_ip = ds.Tables[0].Rows[0]["t_ip"].ToString(); model.t_province = ds.Tables[0].Rows[0]["t_province"].ToString(); model.t_imsi = ds.Tables[0].Rows[0]["t_imsi"].ToString(); model.t_nettype = ds.Tables[0].Rows[0]["t_nettype"].ToString(); model.t_brand = ds.Tables[0].Rows[0]["t_brand"].ToString(); return(model); } else { return(null); } }
/// <summary> /// 查询新增用户(每小时) /// </summary> /// <param name="baseDbName">设备数据库名称</param> /// <param name="tTime">查询日期(2016-03-31)</param> /// <param name="merchantId">商务ID</param> /// <returns></returns> public DataSet GetMerchantListReportAddUser(string baseDbName, string tTime, int merchantId) { StringBuilder strSql = new StringBuilder(); strSql.AppendFormat(@"SELECT CONVERT(NVARCHAR(13),t_time,120) times,COUNT(1) counts FROM jmp_terminal AS JT LEFT JOIN {0}.dbo.jmp_app AS JA ON JA.a_id=JT.t_appid WHERE CONVERT(NVARCHAR(10),t_time,120)='{1}' AND EXISTS ( SELECT 1 FROM {0}.dbo.jmp_user AS JU WHERE JU.u_merchant_id={2} AND JU.u_id=JA.a_user_id ) GROUP BY CONVERT(NVARCHAR(13),t_time,120);", baseDbName, tTime, merchantId); return(DbHelperSQLDEVICE.Query(strSql.ToString())); }
/// <summary> /// 获得前几行数据 /// </summary> public DataSet GetList(int Top, string strWhere, string filedOrder) { StringBuilder strSql = new StringBuilder(); strSql.Append("select "); if (Top > 0) { strSql.Append(" top " + Top.ToString()); } strSql.Append(" * "); strSql.Append(" FROM jmp_liveteral "); if (strWhere.Trim() != "") { strSql.Append(" where " + strWhere); } strSql.Append(" order by " + filedOrder); return(DbHelperSQLDEVICE.Query(strSql.ToString())); }
/// <summary> /// 得到一个对象实体 /// </summary> public JMP.MDL.jmp_liveteral GetModel(int l_id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select l_id, l_teral_key, l_time,l_appid "); strSql.Append(" from jmp_liveteral "); strSql.Append(" where l_id=@l_id"); SqlParameter[] parameters = { new SqlParameter("@l_id", SqlDbType.Int, 4) }; parameters[0].Value = l_id; JMP.MDL.jmp_liveteral model = new JMP.MDL.jmp_liveteral(); DataSet ds = DbHelperSQLDEVICE.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["l_id"].ToString() != "") { model.l_id = int.Parse(ds.Tables[0].Rows[0]["l_id"].ToString()); } model.l_teral_key = ds.Tables[0].Rows[0]["l_teral_key"].ToString(); if (ds.Tables[0].Rows[0]["l_time"].ToString() != "") { model.l_time = DateTime.Parse(ds.Tables[0].Rows[0]["l_time"].ToString()); } if (ds.Tables[0].Rows[0]["l_appid"].ToString() != "") { model.l_appid = int.Parse(ds.Tables[0].Rows[0]["l_appid"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public JMP.MDL.jmp_aes GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select id, yw, mw, mwdx, bdx, time "); strSql.Append(" from jmp_aes "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = id; JMP.MDL.jmp_aes model = new JMP.MDL.jmp_aes(); DataSet ds = DbHelperSQLDEVICE.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["id"].ToString() != "") { model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString()); } model.yw = ds.Tables[0].Rows[0]["yw"].ToString(); model.mw = ds.Tables[0].Rows[0]["mw"].ToString(); model.mwdx = ds.Tables[0].Rows[0]["mwdx"].ToString(); model.bdx = ds.Tables[0].Rows[0]["bdx"].ToString(); model.time = DateTime.Parse(ds.Tables[0].Rows[0]["time"].ToString()); return(model); } else { return(null); } }