static public string getMessageList(string type, string name, string top) { string data = ""; string command = ""; if (type == "onlyNew") { command = $"select top {Convert.ToInt32(top)} * from message where receiver = '{name}' order by addTime desc"; } else { command = $"select * from message where receiver = '{name}'"; } SqlDataReader read = SQL.getReader(command); while (read.Read()) { data += read["sender"] + "=" + read["content"] + "=" + read["addTime"] + ";"; } Coach.initZero(name, "unread"); SQL.Dispose(); return(data); }
static public string getStudentList(string type, string account, string top) { string data = ""; string command = ""; if (type == "onlyNew") { command = $"select top {Convert.ToInt32(top)} * from student order by addTime desc"; } else { command = "select * from student"; } SqlDataReader read = SQL.getReader(command); while (read.Read()) { data += read["account"] + "=" + read["name"] + "=" + read["address"] + "=" + read["description"] + "=" + read["addTime"] + ";"; } Coach.initZero(account, "newstudent"); SQL.Dispose(); return(data); }