public List <fire> GetFireList() { List <fire> lc = new List <fire>(); string sql = "select srcUid,count(id) as b from t_user where srcUid > 0 and date(addOn) > '2017-05-01' group by srcUid order by b desc"; using (DataTable dt = helper.GetDataTable(sql)) { if (dt != null && dt.Rows.Count > 0) { foreach (DataRow r in dt.Rows) { fire o = new fire() { nickName = "", photoUrl = "", uId = Convert.ToInt32(r["srcUid"]), fireNum = Convert.ToInt16(r["b"]) }; user u = new _User().GetUser("", "", o.uId); if (u != null) { o.nickName = u.nickName; o.contact = u.contact; o.photoUrl = u.photoUrl; } lc.Add(o); } } } return(lc); }
public List <CountSrcUid> GetCountSrcForYG(DateTime sDate, DateTime eDate) { List <CountSrcUid> lc = new List <CountSrcUid>(); string sql = "SELECT srcUid,count(id) as t from t_user where date(addOn) >='" + sDate.ToString("yyyy-MM-dd") + "' and date(addOn) <='" + eDate.ToString("yyyy-MM-dd") + "' and srcUid in(select id from t_user where bid = 100) GROUP BY srcUid order by t desc"; using (DataTable dt = helper.GetDataTable(sql)) { if (dt != null && dt.Rows.Count > 0) { Dictionary <int, string> Dic = new _User().GetUIDSourceDicForYG(); foreach (DataRow r in dt.Rows) { CountSrcUid b = new CountSrcUid { uId = Convert.ToInt32(r["srcUid"].ToString()), uNum = Convert.ToInt16(r["t"].ToString()), nickName = "" }; if (Dic.ContainsKey(b.uId)) { b.nickName = Dic[b.uId]; } lc.Add(b); } } } return(lc); }
public List <custom> GetCustomList(string keyWord, int page, int perPage, out int UCount) { List <custom> lc = new List <custom>(); string sql = "select * from t_user where 1=1 " + keyWord + " order by addOn desc"; Dictionary <int, user> Dic = new Dictionary <int, user>(); try { using (DataTable dt = helper.GetDataTable(sql)) { if (dt != null && dt.Rows.Count > 0) { foreach (DataRow r in dt.Rows) { user u = new user() { addOn = Convert.ToDateTime(r["addOn"]), area = r["area"].ToString(), contact = r["contact"].ToString(), sex = Convert.ToInt16(r["sex"]), photoUrl = r["photoUrl"].ToString(), nickName = r["nickName"].ToString(), mobile = r["mobile"].ToString(), openId = r["openid"].ToString(), id = Convert.ToInt32(r["id"]), source = r["source"].ToString() }; if (!Dic.ContainsKey(u.id)) { Dic.Add(u.id, u); } } } } } catch { } int Count = 0; try { Count = Convert.ToInt32(helper.GetOne("select count(distinct userId) as t from t_order where userId in(select id from t_user where 1=1 " + keyWord + ") and isPay = 1 and state < 9")); } catch { Count = 0; } UCount = Count; //统计数据 sql = "select userId,count(*) as t,sum(allPrice) as p from t_order where userId in(select id from t_user where 1=1 " + keyWord + ") and isPay = 1 and state < 9 group by userId order by t desc limit " + (page - 1) * perPage + "," + perPage; try { using (DataTable dt = helper.GetDataTable(sql)) { if (dt != null && dt.Rows.Count > 0) { user u = null; foreach (DataRow r in dt.Rows) { u = null; if (Dic.ContainsKey(Convert.ToInt16(r["userId"]))) { u = (user)Dic[Convert.ToInt16(r["userId"])]; } if (u != null) { custom c = new custom() { addOn = u.addOn, area = u.area, contact = u.contact, sex = u.sex, photoUrl = u.photoUrl, nickName = u.nickName, mobile = u.mobile, openId = u.openId, id = u.id, source = u.source, sourceName = "" }; c.orderNum = Convert.ToInt16(r["t"]); c.orderAll = Convert.ToDouble(r["p"]); try { if (Convert.ToInt16(c.source) > 0) { user us = new _User().GetUser("", "", Convert.ToInt16(c.source)); if (us != null) { c.sourceName = us.nickName; } } } catch { } lc.Add(c); } } } } } catch { } return(lc); }
public List <syslog> GetLogList(string sql, string sql_c, out int Count) { List <syslog> ls = new List <syslog>(); int LogCount = 1; try { LogCount = Convert.ToInt32(helper.GetOne(sql_c)); } catch { LogCount = 1; } Count = LogCount; using (DataTable dt = helper.GetDataTable(sql)) { if (dt != null && dt.Rows.Count > 0) { try { foreach (DataRow r in dt.Rows) { syslog s = new syslog { orderNo = r["orderNo"].ToString(), addOn = Convert.ToDateTime(r["addOn"]), uid = Convert.ToInt32(r["uid"]), workNo = r["workNo"].ToString(), adminName = r["adminName"].ToString(), content = r["content"].ToString(), lType = Convert.ToInt16(r["lType"]), lt = Convert.ToInt16(r["lt"]), uName = "--" }; if (s.uid > 0) { user u = new _User().GetUser("", "", s.uid); if (u != null) { s.uName = u.contact; if (s.uName.Length == 0) { s.uName = u.nickName; } } } else { if (s.lType == 5) { s.adminName = "[" + s.workNo + "]" + s.adminName; } } ls.Add(s); } } catch (Exception ex) { } } } return(ls); }