/// <summary> /// 控件绑定事件 /// </summary> /// <param name="source"></param> /// <param name="e"></param> protected void repInfo_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "del") { int id = Convert.ToInt32(e.CommandArgument); int num = KeyWordInfoService.Delete(id); if (num > 0) { ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('删除成功!');", true); } else { ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('删除失败,请重试!');", true); } sp.InitBindData(Repeater1, pager1, "KeyWordInfo", "id", "1=1"); } else if (e.CommandName == "mod") { int id = Convert.ToInt32(e.CommandArgument); KeyWordInfo item = KeyWordInfoService.GetModel(id); if (item != null) { txtPageName.Text = item.pageName; txtTitle.Text = item.title; txtKeyWord.Text = item.keyword; txtDesc.Text = item.description; txtURL.Text = item.pageNameValue; ViewState["modId"] = item.id; ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "overKeyWordDiv();", true); } } }
public void CodeCompletionUserVar(string strKeyWord, string strTextIn, int intStart, List <KeyWordInfo> list) { if (intStart == 0) { return; } string strText = strTextIn.Substring(0, intStart); string strLowerCaseKeyWord = strKeyWord.ToLower(); foreach (Match m in regex.Matches(strText)) { if (m.Groups.Count == 4) { string strType = m.Groups[1].ToString(); foreach (Capture cap in m.Groups[2].Captures) { string strName = cap.ToString(); if (strName.ToLower().StartsWith(strLowerCaseKeyWord)) { KeyWordInfo ki = new KeyWordInfo(KeyWordTypeEnum.Vars, strName, Color.Red); if (!list.Contains(ki)) { list.Add(ki); } } if (strType == "list" || strType == "vector" || strType == "rotation") { break; } } } } }
public void TestSetKeyWord() { var keywordList = new KeyWordInfo(); keywordList.ReplyId = "101E5AFA0D4E4CA9B738323A4B108357"; keywordList.KeyWord = "团购test"; keywordList.BeLinkedType = 2; keywordList.ApplicationId = "386D08D106C849A9ACAA6E493D23E853"; keywordList.ReplyType = 1; keywordList.DisplayIndex = 10; keywordList.Text = "xxxxx"; var rp = new SetKeyWordRP { }; rp.KeyWordList = keywordList; var request = new APIRequest <SetKeyWordRP> { CustomerID = CustomerId, Parameters = rp }; var rsp = APIClientProxy.CallAPI <SetKeyWordRP, SetKeyWordRD>(APITypes.Product, "WX.KeyWord.SetKeyWord", request); Console.WriteLine(rsp.ToJSON()); }
/// <summary> /// 添加信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button1_Click1(object sender, EventArgs e) { string name = this.txtPageName.Text.Trim(); string title = this.txtTitle.Text.Trim(); string keyword = this.txtKeyWord.Text.Trim(); string description = this.txtDesc.Text.Trim(); string url = this.txtURL.Text.Trim(); KeyWordInfo item = new KeyWordInfo(); item.pageName = name; item.title = title; item.keyword = keyword; item.description = description; item.pageNameValue = url; if (ViewState["modId"] != null) { item.id = Convert.ToInt32(ViewState["modId"]); int num = KeyWordInfoService.Update(item); if (num > 0) { ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('保存成功!');", true); txtPageName.Text = ""; txtTitle.Text = ""; txtKeyWord.Text = ""; txtDesc.Text = ""; txtURL.Text = ""; } ViewState["modId"] = null; } else { if (KeyWordInfoService.Exists(item.pageNameValue)) { ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('信息已存在!');", true); return; } int num = KeyWordInfoService.Add(item); if (num > 0) { ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('保存成功!');", true); txtPageName.Text = ""; txtTitle.Text = ""; txtKeyWord.Text = ""; txtDesc.Text = ""; txtURL.Text = ""; } } sp.InitBindData(Repeater1, pager1, "KeyWordInfo", "id", "1=1"); }
/// <summary> /// 页面标题、关键字和描述信息 /// </summary> private void KeyWordBind() { string url = Request.Url.ToString().Replace("aspx", "html"); KeyWordInfo km = KeyWordInfoService.GetModel(url); if (km != null) { ViewState["title"] = km.title; ViewState["keyword"] = km.keyword; ViewState["miaoshu"] = km.description; } else { ViewState["title"] = BaseConfigService.GetById(9); ViewState["keyword"] = BaseConfigService.GetById(23); ViewState["miaoshu"] = BaseConfigService.GetById(13); } }
public void TestSaveDefaultKeyWord() { var textidInfo = new List <MaterialTextIdInfo> { new MaterialTextIdInfo() { TestId = "009C41874D634C888547C9EA35F1ADCA" }, new MaterialTextIdInfo() { TestId = "08CCF3FF2C2E4884B3839EEC2AA4B2BC" } }; var keywordList = new KeyWordInfo { ReplyId = "265B1657733C4DF38C9DB567CBA1105B", KeyWord = "分享团购test", BeLinkedType = 2, ApplicationId = "386D08D106C849A9ACAA6E493D23E853", ReplyType = 3, DisplayIndex = 10, KeywordType = 2, MaterialTextIds = textidInfo.ToArray() }; var rp = new SetKeyWordRP { }; rp.KeyWordList = keywordList; var request = new APIRequest <SetKeyWordRP> { CustomerID = CustomerId, Parameters = rp }; var rsp = APIClientProxy.CallAPI <SetKeyWordRP, SetKeyWordRD>(APITypes.Product, "WX.KeyWord.SaveDefaultKeyWord", request); Console.WriteLine(rsp.ToJSON()); }
protected void Btn_Add_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(Tb_txt.Text.Trim())) { return; } KeyWordInfo info = new KeyWordInfo(); info.Nick = HttpUtility.UrlDecode(Request.Cookies["nick"].Value); info.KeyWord = Tb_txt.Text.Trim(); if (kyDal.GetKeyWord(info.Nick, info.KeyWord) > 0) { return; } info.KeyId = Guid.NewGuid(); kyDal.Insert(info); ViewState["page"] = "1"; Bind(info.Nick); }
public OutlineHelper(KeyWordInfo i, int l) { this.info = i; this.line = l; }