Beispiel #1
0
    public static List <ChatMessage> ChatInit()
    {
        try
        {
            LinqGameDataContext dc = new LinqGameDataContext();

            List <LinqGameChat> lList = (from c in dc.LinqGameChats
                                         where c.PostedAt > DateTime.Now.Subtract(new TimeSpan(0, 5, 0))
                                         select c).ToList <LinqGameChat>();

            List <ChatMessage> cmList = new List <ChatMessage>();

            if (lList.Count > 0)
            {
                foreach (LinqGameChat lgc in lList)
                {
                    cmList.Add(new ChatMessage(lgc));
                }
            }
            else
            {
                LinqGameChat lgc = (from c in dc.LinqGameChats
                                    orderby c.ChatLineID descending
                                    select c).First <LinqGameChat>();

                cmList.Add(new ChatMessage(lgc));
            }

            return(cmList);
        }
        catch
        {
            return(new List <ChatMessage>());
        }
    }
Beispiel #2
0
 public ChatMessage(LinqGameChat gc)
 {
     lineId       = gc.ChatLineID;
     dt           = gc.PostedAt;
     voice        = gc.User.Nickname;
     isExCathedra = gc.IsExCathedra.GetValueOrDefault(false);
     message      = gc.ChatText;
 }
Beispiel #3
0
    public static bool PostChat(string email, string message)
    {
        try
        {
            LinqGameDataContext dc = new LinqGameDataContext();

            LinqGameChat lgc = new LinqGameChat();
            lgc.IsExCathedra = false;
            lgc.PostedAt     = DateTime.Now;
            lgc.GameID       = 1; // Lobby - for testing
            lgc.UserID       = GetUser(email).UserID;
            lgc.ChatText     = message;

            dc.LinqGameChats.InsertOnSubmit(lgc);
            dc.SubmitChanges();

            return(true);
        }
        catch
        {
            return(false);
        }
    }
Beispiel #4
0
	private void detach_LinqGameChats(LinqGameChat entity)
	{
		this.SendPropertyChanging();
		entity.User = null;
	}
Beispiel #5
0
	private void attach_LinqGameChats(LinqGameChat entity)
	{
		this.SendPropertyChanging();
		entity.User = this;
	}
Beispiel #6
0
 partial void DeleteLinqGameChat(LinqGameChat instance);
Beispiel #7
0
 partial void UpdateLinqGameChat(LinqGameChat instance);
Beispiel #8
0
 partial void InsertLinqGameChat(LinqGameChat instance);
Beispiel #9
0
    public static bool PostChat(string email, string message)
    {
        try
        {
            LinqGameDataContext dc = new LinqGameDataContext();

            LinqGameChat lgc = new LinqGameChat();
            lgc.IsExCathedra = false;
            lgc.PostedAt = DateTime.Now;
            lgc.GameID = 1; // Lobby - for testing
            lgc.UserID = GetUser(email).UserID;
            lgc.ChatText = message;

            dc.LinqGameChats.InsertOnSubmit(lgc);
            dc.SubmitChanges();

            return true;
        }
        catch
        {
            return false;
        }
    }