internal void DbProcessMenuButton(MenuButtonMessage message) { W_WeChatInfoBLL weChatInfoBll = new W_WeChatInfoBLL(); W_WeChatInfo weChatInfo = weChatInfoBll.GetByWechatID(message.ToUserName); if (weChatInfo == null) { return; } W_ResourcesCataBLL resourcesCataBll = new W_ResourcesCataBLL(); List<W_ResourcesCata> resourcesCataList = resourcesCataBll.GetByWeChatInfo(weChatInfo); if (resourcesCataList.Count <= 0) { return; } W_KeyWordBLL keyWordBll = new W_KeyWordBLL(); foreach (W_ResourcesCata resourcesCata in resourcesCataList) { List<W_KeyWord> keyWordList = keyWordBll.GetByResourcesCata(resourcesCata); foreach (W_KeyWord keyWord in keyWordList) { if (message.EventKey == keyWord.WKey) { DoKeyWord(keyWord); return; } } } }
internal void DbProcessText(TextMessage message) { W_WeChatInfoBLL weChatInfoBll = new W_WeChatInfoBLL(); W_WeChatInfo weChatInfo = weChatInfoBll.GetByWechatID(message.ToUserName); if (weChatInfo == null) { return; } W_ResourcesCataBLL resourcesCataBll = new W_ResourcesCataBLL(); List<W_ResourcesCata> resourcesCataList = resourcesCataBll.GetByWeChatInfo(weChatInfo); if (resourcesCataList.Count <= 0) { return; } W_KeyWordBLL keyWordBll = new W_KeyWordBLL(); foreach (W_ResourcesCata resourcesCata in resourcesCataList) { List<W_KeyWord> keyWordList = keyWordBll.GetByResourcesCata(resourcesCata); foreach (W_KeyWord keyWord in keyWordList) { if (keyWord.WOption == "Equals" && keyWord.WContent == message.Content) { DoKeyWord(keyWord); return; } else if (keyWord.WOption == "EqualsIgnoreCase" && string.Equals(keyWord.WContent, message.Content, StringComparison.OrdinalIgnoreCase) == true) { DoKeyWord(keyWord); return; } else if (keyWord.WOption == "Contains" && string.IsNullOrEmpty(message.Content) == false && message.Content.Contains(keyWord.WContent) == true) { DoKeyWord(keyWord); return; } else if (keyWord.WOption == "ContainsIgnoreCase" && string.IsNullOrEmpty(message.Content) == false && message.Content.IndexOf(keyWord.WContent, StringComparison.OrdinalIgnoreCase) >= 0) { DoKeyWord(keyWord); return; } } } }