示例#1
0
		private void attach_Clans(Clan entity)
		{
			this.SendPropertyChanging();
			entity.Gateway = this;
		}
示例#2
0
		private void detach_Clans(Clan entity)
		{
			this.SendPropertyChanging();
			entity.Gateway = null;
		}
示例#3
0
 partial void DeleteClan(Clan instance);
示例#4
0
 partial void UpdateClan(Clan instance);
示例#5
0
 partial void InsertClan(Clan instance);
示例#6
0
        private void NoteTag(string tag, ChatUser chatUser, string currentChannel, ChatEventType action)
        {
            if (string.IsNullOrEmpty(tag))
                return;

            string act = "joining the channel";
            switch (action)
            {
                case ChatEventType.UserInChannel:
                    act = "being seen in the channel";
                    break;
                case ChatEventType.UserFlagsChanged:
                    act = "having flags updated in the channel";
                    break;
                case ChatEventType.UserLeftChannel:
                    act = "leaving the channel";
                    break;
                case ChatEventType.UserJoinedChannel:
                    act = "joining the channel";
                    break;
            }
            using (ClansDataContext dc = ClansDataContext.Create(m_dbPath))
            {
                if (dc.Clans.Where(c => c.Tag.ToUpper() == tag.ToUpper()).Count() == 0)
                {
                    Clan c = new Clan
                    {
                        GatewayID = m_gatewayID,
                        Tag = tag,
                        DiscoverySource = string.Format("{0}, a Warcraft 3 user in {1}, {2}.", chatUser.Username, currentChannel, act)
                    };
                    dc.Clans.InsertOnSubmit(c);

                    try
                    {
                        dc.SubmitChanges();
                        m_client.MainWindow.AddChat(new ChatNode[] {
                            new ChatNode("JinxBot Clan Gnome added ", Color.DarkRed),
                            new ChatNode(c.DiscoverySource, Color.Yellow)
                        });
                    }
                    catch (Exception ex)
                    {
                        m_client.MainWindow.AddChat(new ChatNode[] {
                            new ChatNode("JinxBot Clan Gnome error ", Color.DarkRed),
                            new ChatNode("Error saving a new clan:", Color.Red),
                            ChatNode.NewLine,
                            new ChatNode(ex.ToString(), Color.OrangeRed)
                    });
                    }
                }
                else
                {
                    m_client.MainWindow.AddChat(new ChatNode[] {
                        new ChatNode("JinxBot Clan Gnome note: ", Color.DarkRed),
                        new ChatNode("Already noted clan ", Color.Yellow),
                        new ChatNode(tag, Color.Lime)
                    });
                }
            }
        }
示例#7
0
        private void NoteTag(string tag, string userName, string currentChannel, string action)
        {
            using (ClansDataContext dc = ClansDataContext.Create(m_dbPath))
            {
                if (dc.Clans.Where(c => c.Tag.ToUpper() == tag.ToUpper()).Count() == 0)
                {
                    Clan c = new Clan
                    {
                        GatewayID = m_gatewayID,
                        Tag = tag,
                        DiscoverySource = string.Format("{0}, a user in {1}, saying \"{2}\".", userName, currentChannel, action)
                    };
                    dc.Clans.InsertOnSubmit(c);

                    try
                    {
                        dc.SubmitChanges();
                        m_client.MainWindow.AddChat(new ChatNode[] {
                            new ChatNode("JinxBot Clan Gnome added ", Color.DarkRed),
                            new ChatNode(c.DiscoverySource, Color.Yellow)
                        });
                    }
                    catch (Exception ex)
                    {
                        m_client.MainWindow.AddChat(new ChatNode[] {
                            new ChatNode("JinxBot Clan Gnome error ", Color.DarkRed),
                            new ChatNode("Error saving a new clan:", Color.Red),
                            ChatNode.NewLine,
                            new ChatNode(ex.ToString(), Color.OrangeRed)
                        });
                    }
                }
                else
                {
                    m_client.MainWindow.AddChat(new ChatNode[] {
                        new ChatNode("JinxBot Clan Gnome note: ", Color.DarkRed),
                        new ChatNode("Already noted clan ", Color.Yellow),
                        new ChatNode(tag, Color.Lime)
                    });
                }
            }
        }