Exemplo n.º 1
0
        public static UserDescription GetUserDescription(MyMySql sql, string userid)
        {
            string  sqlstr = $@"
SELECT username, password, sex, contact
FROM users
WHERE userid = {userid}";
            DataRow row    = sql.executeQueryFirst(sqlstr);

            return(new UserDescription(row["username"].ToString(), row["password"].ToString(), int.Parse(row["sex"].ToString()), row["contact"].ToString()));
        }
Exemplo n.º 2
0
        public static SeatInfo GetSeatByUser(MyMySql sql_seats, string userid)
        {
            string  sqlstr = $@"
SELECT roomid, deskid, seatid
FROM seats
WHERE userid = {userid} AND backdatetime IS NULL";
            DataRow row    = sql_seats.executeQueryFirst(sqlstr);

            if (row != null)
            {
                return(new SeatInfo(row["roomid"].ToString(), row["deskid"].ToString(), row["seatid"].ToString()));
            }
            else
            {
                return(new SeatInfo(null, null, null));
            }
        }