123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 |
- using System;
- using System.Collections.Generic;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace LYFZ.Software.MainBusiness.OAShopManagement
- {
- public class frmMicroLetterAutoReply : LYFZ.Software.UI.OAShopManagement.frmMicroLetterAutoReply
- {
- public frmMicroLetterAutoReply() {
- this.btnAddKeyword.Click += btnAddKeyword_Click;
- this.btnTxt.Click += btnTxt_Click;
- this.btnPicTxt.Click += btnPicTxt_Click;
- this.Load += frmMicroLetterAutoReply_Load;
- this.trwRuleReplyList.NodeMouseDoubleClick += trwRuleReplyList_NodeMouseDoubleClick;
- this.trwRuleReplyList.NodeMouseClick += trwRuleReplyList_NodeMouseClick;
- this.btnAdd.Click += btnAdd_Click;
- this.btnDel.Click += btnDel_Click;
- this.btnSave.Click += btnSave_Click;
- }
- void btnSave_Click(object sender, EventArgs e)
- {
-
- }
- void btnDel_Click(object sender, EventArgs e)
- {
- if (this.trwRuleReplyList.SelectedNode != null)
- {
- if (this.trwRuleReplyList.SelectedNode.Name.StartsWith("TND_"))
- {
- MessageBoxCustom.Show(this.trwRuleReplyList.SelectedNode.Text+" 规则不能删除!");
- }
- else
- {
- if (MessageBoxCustom.Show("您确定要删除选择规则吗?") == System.Windows.Forms.DialogResult.OK)
- {
- bool isDelOK = false;
- if (this.trwRuleReplyList.SelectedNode.Tag != null)
- {
- LYFZ.Model.Model_WeixinMessageRule cDelModel = (LYFZ.Model.Model_WeixinMessageRule)this.trwRuleReplyList.SelectedNode.Tag;
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, System.ComponentModel.BackgroundWorker backgroundWorker)
- {
- try
- {
- backgroundWorker.ReportProgress(0, "正在删除数据...");
- isDelOK = wMRBll.Delete(cDelModel);
- wMLListBll.Delete("Wrl_RuleID='" + cDelModel.Wrm_RuleID + "'");
- }
- catch (Exception ex){
- MessageBoxCustom.Show("删除失败,原因:"+ex.Message,backgroundWorker:backgroundWorker);
- }
- });
- }
- else {
- isDelOK = true;
- }
- if (isDelOK)
- {
- this.trwRuleReplyList.SelectedNode.Remove();
- btnAdd_Click(null, null);
- }
- else {
- MessageBoxCustom.Show("删除失败,请稍后重试");
- }
- }
- }
- }
- else {
- MessageBoxCustom.Show("请选择您要删除的规则");
- }
- }
- void btnAdd_Click(object sender, EventArgs e)
- {
- this.txtname.Text = "";
- this.dgvKeywordList.Rows.Clear();
- this.dgvTextList.Rows.Clear();
- this.txtname.ReadOnly = false;
- this.btnAddKeyword.Enabled = true;
- }
- void trwRuleReplyList_NodeMouseClick(object sender, System.Windows.Forms.TreeNodeMouseClickEventArgs e)
- {
-
- }
- void trwRuleReplyList_NodeMouseDoubleClick(object sender, System.Windows.Forms.TreeNodeMouseClickEventArgs e)
- {
- if (e.Node != null)
- {
- if (e.Node.Name.StartsWith("TND_"))
- {
- this.txtname.ReadOnly = true;
- this.btnAddKeyword.Enabled = false;
- }
- else
- {
- this.txtname.ReadOnly = false;
- this.btnAddKeyword.Enabled = true;
- }
- this.txtname.Text = e.Node.Text.Trim();
- if (e.Node.Tag != null)
- {
- int cModelID = (int)e.Node.Tag;
- LYFZ.Model.Model_WeixinMessageRule weixinModel = null;
- List<LYFZ.Model.Model_WeixinMessageList> WeixinNewsList = new List<Model.Model_WeixinMessageList>();
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, System.ComponentModel.BackgroundWorker backgroundWorker)
- {
- try
- {
- backgroundWorker.ReportProgress(0, "正在加载数据...");
- weixinModel = wMRBll.GetModel(cModelID);
- if (weixinModel != null && weixinModel.ID > 0)
- {
- WeixinNewsList = wMLListBll.GetModelList("Wrl_RuleID='" + weixinModel.Wrm_RuleID + "'");
- }
- }
- catch (Exception ex)
- {
- MessageBoxCustom.Show("加载数据失败,原因:" + ex.Message, backgroundWorker: backgroundWorker);
- }
- });
- BindKeywordsList(weixinModel);
- BindNewsList(WeixinNewsList);
- }
- }
- }
- /// <summary>
- /// 邦定关键字
- /// </summary>
- /// <param name="weixinModel"></param>
- void BindKeywordsList(LYFZ.Model.Model_WeixinMessageRule weixinModel)
- {
- if (weixinModel != null && weixinModel.ID > 0)
- {
- }
- }
- /// <summary>
- /// 邦定回复消息
- /// </summary>
- /// <param name="WeixinNewsList"></param>
- void BindNewsList(List<LYFZ.Model.Model_WeixinMessageList> WeixinNewsList)
- {
-
- }
- LYFZ.BLL.BLL_WeixinMessageRule wMRBll = new BLL.BLL_WeixinMessageRule();
- LYFZ.BLL.BLL_WeixinMessageList wMLListBll = new BLL.BLL_WeixinMessageList();
- List<LYFZ.Model.Model_WeixinMessageRule> WeixinMessageRuleList = new List<Model.Model_WeixinMessageRule>();
- void frmMicroLetterAutoReply_Load(object sender, EventArgs e)
- {
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, System.ComponentModel.BackgroundWorker backgroundWorker)
- {
-
- backgroundWorker.ReportProgress(0, "正在加载数据...");
- WeixinMessageRuleList= wMRBll.GetModelList("1=1");
- });
- BidRuleReplyList();
- }
- void BidRuleReplyList()
- {
- this.trwRuleReplyList.Nodes.Clear();
- if (WeixinMessageRuleList.Count > 0)
- {
- foreach (LYFZ.Model.Model_WeixinMessageRule model in WeixinMessageRuleList)
- {
- TreeNode new_node = new TreeNode();
- new_node.Name = model.Wrm_RuleID.Trim();
- new_node.Text = model.Wmr_RuleName.Trim();
- if (new_node.Name.StartsWith("TND_"))
- {
- new_node.ForeColor = Color.Green;
- }
- new_node.Tag = model.ID;
- }
- }
- else
- {
- TreeNode node_GZ = new TreeNode();
- node_GZ.ForeColor = Color.Green;
- node_GZ.Name = "TND_GZ";
- node_GZ.Text = "粉丝关注公众号回复";
-
- TreeNode node_QXGZ = new TreeNode();
- node_QXGZ.ForeColor = Color.Green;
- node_QXGZ.Name = "TND_QXGZ";
- node_QXGZ.Text = "粉丝取消关注时回复";
- TreeNode node_NOMatchy = new TreeNode();
- node_NOMatchy.ForeColor = Color.Green;
- node_NOMatchy.Name = "TND_NOMatchy";
- node_NOMatchy.Text = "未匹配关键字时回复";
- this.trwRuleReplyList.Nodes.Add(node_GZ);
- this.trwRuleReplyList.Nodes.Add(node_QXGZ);
- this.trwRuleReplyList.Nodes.Add(node_NOMatchy);
- }
- }
- void btnPicTxt_Click(object sender, EventArgs e)
- {
- frmAddTeletextNews addNews= new frmAddTeletextNews();
- addNews.Text = "添加图文消息";
- if (addNews.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- }
- }
- void btnTxt_Click(object sender, EventArgs e)
- {
- frmKeywordAndText addtext = new frmKeywordAndText();
- addtext.Text = "添加回复文字";
- addtext.lbTitle.Text = "最多可以输入300个字符";
- addtext.txtValue.WaterText = "最多可以输入300个字符";
- if (addtext.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- }
- }
- void btnAddKeyword_Click(object sender, EventArgs e)
- {
- frmKeywordAndText addtext = new frmKeywordAndText();
- addtext.Text = "添加关键字";
- addtext.lbTitle.Text = "按回车可添加多个关键字,每个关键字少于30个字符";
- addtext.txtValue.WaterText = "按回车可添加多个关键字,每个关键字少于30个字符";
- if (addtext.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
-
- }
- }
- }
- }
|