internal void SendMessage(int roomNum, int time, DateTime now) { string[] sql = { "select t1.no,t2.name,t1.seat_no,t1.time_end,t2.wechat from tb_seat_student as t1,tb_student as t2 where t1.room=@room and t1.time_end<@nw and t1.isoutdate=0 and t1.issend_" + time + "_message=0 and t1.no=t2.no", "update tb_seat_student set issend_" + time + "_message=1 where room=@room and time_end<@nw and isoutdate=0 and issend_" + time + "_message=0" }; SqlParameter[] sp1 = { new SqlParameter("@room", roomNum), new SqlParameter("@nw", now.AddMinutes(time)) }; DataTable dt = SqlServerHelper.ExecuteDataTable(sql[0], sp1); string access_token = GetAccessToken(); //发送消息 foreach (DataRow item in dt.Rows) { Send(access_token, item[0].ToString(), roomNum.ToString(), seat_no2tableseat(MyConvert.toInt(item[2])), time.ToString(), MyConvert.toString(item[3])); } //发送消息结束。 SqlParameter[] sp2 = { new SqlParameter("@room", roomNum), new SqlParameter("@nw", now.AddMinutes(time)) }; SqlServerHelper.ExecuteNonQuery(sql[1], sp2); }
public string FindNo(string str) { string sql = "select no from tb_student where card='" + str + "'"; return(MyConvert.toString(SqlServerHelper.ExecuteSclar(sql))); }
public string FindOpenId(string str) { string sql = "select wechat from tb_student where no='" + str + "'"; return(MyConvert.toString(SqlServerHelper.ExecuteSclar(sql))); }
public string FindRoomName(int roomNum) { string sql = "select name from tb_room where no=" + roomNum; return(MyConvert.toString(SqlServerHelper.ExecuteSclar(sql))); }