protected void Page_Load(object sender, EventArgs e) { DeleteNoFace(); UserFaceTime condition = new UserFaceTime(); UserFaceTime value = new UserFaceTime(); condition.AddConditon("and DateDiff(dd,AddTime,getdate())=0"); m_tableManageList = TableOperate <UserFaceTime> .SelectByPage(value, condition, "order by LastTime desc", PageSize, PageIndex, ref Count); DataBind(); }
protected void UpTime(int ID, int Aid, double quality, string headpic, string file) { try { UserFaceTime condition = new UserFaceTime(); UserFaceTime value = new UserFaceTime(); condition.UserID = ID; condition.ZQID = Aid; List <UserFaceTime> list = TableOperate <UserFaceTime> .Select(value, condition, 0, "order by LastTime desc"); condition.LastTime = DateTime.Now; if (list.Count > 0) { TimeSpan t3 = DateTime.Now - list[0].LastTime; double time = t3.TotalMinutes; if (time > 2) { condition.Quality = quality; condition.HeadPic = headpic; condition.AddTime = DateTime.Now; TableOperate <UserFaceTime> .InsertReturnID(condition); } else { string oldfile = Request.MapPath("/" + list[0].HeadPic); if (quality < list[0].Quality) { condition.Quality = quality; condition.HeadPic = headpic; // DeleteFace(oldfile); } condition.ID = list[0].ID; TableOperate <UserFaceTime> .Update(condition); AddTime(Aid, time); } } else { condition.Quality = quality; condition.HeadPic = headpic; condition.AddTime = DateTime.Now; TableOperate <UserFaceTime> .InsertReturnID(condition); } } catch (Exception ex) { Log("错误!" + ex.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { try { string act = Convert.ToString(Request["act"]); int uid = Convert.ToInt32(Request["uid"]); if (act == "get") { UserFaceTime condition = new UserFaceTime(); UserFaceTime vlaue = new UserFaceTime(); condition.AddConditon("and DateDiff(dd,AddTime,getdate())=0"); condition.UserID = uid; List <int> ZQlist = new List <int>(); // condition.ZQID = zqid; List <UserFaceTime> list = TableOperate <UserFaceTime> .Select(vlaue, condition, 0, "order by LastTime desc"); for (int i = 0; i < list.Count; i++) { list[i].Time = (list[i].LastTime - list[i].AddTime).TotalSeconds; } List <UserFaceTime> listtemp = new List <UserFaceTime>(); for (int i = 0; i < list.Count; i++) { bool find = false; for (int j = 0; j < listtemp.Count; j++) { if (list[i].ZQID == listtemp[j].ZQID) { if (listtemp[j].Time < 10) { listtemp[j] = list[i]; } find = true; } } if (!find) { listtemp.Add(list[i]); } } list = listtemp; list = list.OrderByDescending(s => s.LastTime).ToList <UserFaceTime>(); msg = "{\"list\":["; for (int i = 0; i < list.Count; i++) { //int ZQID = list[i].ZQID; //if (!ZQlist.Contains(ZQID)) //{ TimeSpan t3 = list[i].LastTime - list[i].AddTime; double time = t3.TotalSeconds; msg += "{\"ID\":" + list[i].ID + ", \"UserID\":\"" + list[i].UserID + "\", \"AddTime\":\"" + list[i].AddTime + "\", \"LastTime\":\"" + list[i].LastTime + "\", \"Time\":\"" + time + "\", \"Zqid\":\"" + list[i].ZQID + "\", \"HeadImg\":\"" + list[i].HeadPic + "\"},"; // ZQlist.Add(ZQID); // } } msg = msg.Trim(','); msg += "]}"; } else if (act == "user") { Userinfo condition = new Userinfo(); Userinfo value = new Userinfo(); //condition.AddConditon("and DateDiff(dd,LastModifyTime,getdate())=0"); List <Userinfo> list = TableOperate <Userinfo> .Select(value, condition, 0, "order by LastModifyTime desc"); msg = "{\"list\":["; for (int i = 0; i < list.Count; i++) { msg += "{\"ID\":" + list[i].ID + ", \"HeadImg\":\"" + list[i].HeadImage + "\"},"; } msg = msg.Trim(','); msg += "]}"; } else if (act == "zq") { msg = "{\"state\":\"true\", \"Area\":" + GetZQ() + ", \"msg\":\"请求成功\"}"; } else { msg = "{\"state\":\"false\", \"msg\":\"查询失败\"}"; } } catch (Exception ex) { msg = "{\"state\":\"false\", \"msg\":\"查询失败\"}"; } Response.Write(msg); }