private void detach_tblTalkers(tblTalker entity) { this.SendPropertyChanging(); entity.tblSession = null; }
partial void UpdatetblTalker(tblTalker instance);
partial void DeletetblTalker(tblTalker instance);
private void attach_tblTalkers(tblTalker entity) { this.SendPropertyChanging(); entity.tblChatRoom = this; }
partial void InserttblTalker(tblTalker instance);
public static bool SendMessage(tblTalker talker, string message) { try { SessionDBDataContext db = new SessionDBDataContext(); tblMessagePool msgpool = new tblMessagePool(); msgpool.message = message; msgpool.SendTime = DateTime.Now; msgpool.talkerID = talker.TalkerID; db.tblMessagePools.InsertOnSubmit(msgpool); db.SubmitChanges(); return true; } catch { return false; } }
public static bool JoinChatRoom(Guid ChatRoomID, HttpContext context, string alias) { if (!ChatManager.IsRoomFull(ChatRoomID)) { SessionDBDataContext db = new SessionDBDataContext(); if (db.tblSessions.Count( s => s.SessionID == context.Session.SessionID) == 0) { ChatManager.CreateSession(context, alias); } var session = ChatManager.GetSession(context); if (db.tblTalkers.Count(t => t.ChatRoomID == ChatRoomID && t.SessionID == session.UID && t.CheckOutTime == null) > 0) { return false; } else { tblTalker talker = new tblTalker(); talker.ChatRoomID = ChatRoomID; talker.CheckInTime = DateTime.Now; talker.CheckOutTime = null; talker.SessionID = session.UID; db.tblTalkers.InsertOnSubmit(talker); db.SubmitChanges(); return true; } } else { return false; } }