コード例 #1
0
        public static Guid CreateChatRoom(string roomName, string password,
                                          bool isLock, int maxUserNumber, bool needPassword)
        {
            SessionDBDataContext db   = new SessionDBDataContext();
            tblChatRoom          room = new tblChatRoom();

            room.ChatRoomID       = Guid.NewGuid();
            room.ChatRoomName     = roomName;
            room.ChatRoomPassword = password;
            room.IsLock           = isLock;
            room.MaxUserNumber    = maxUserNumber;
            room.NeedPassword     = needPassword;
            db.tblChatRooms.InsertOnSubmit(room);
            db.SubmitChanges();
            return(room.ChatRoomID);
        }
コード例 #2
0
        public static List <tblMessagePool> RecieveMessage(tblChatRoom room)
        {
            SessionDBDataContext db = new SessionDBDataContext();

            if (db.tblMessagePools.Count(
                    msg => room.tblTalkers.Contains(msg.tblTalker)) > 0)
            {
                return((from messages in db.tblMessagePools
                        where messages.tblTalker.ChatRoomID == room.ChatRoomID
                        select messages).ToList());
            }
            else
            {
                return(null);
            }
        }