/// <summary> /// 模板 /// </summary> /// <param name="N"></param> /// <returns></returns> public string GetXML_MODEL(int N) { NewsMsgData CMsgData = new NewsMsgData(); for (int i = 0; i < N; i++) { NewsItem cN = new NewsItem(); cN.Title = "项目 " + i.ToString() + " 标题"; cN.Description = "项目 " + i.ToString() + " 具体内容描述"; cN.PicUrl = "http://xxxx.com/img/a.jpg "; cN.Url = "http://xxxx.com/img/a.aspx"; CMsgData.Items.Add(cN); } return CMsgData.Getdata(); }
protected void Button23_Click(object sender, EventArgs e) { for (int j = 0; j < 10000; j++) { string Name = "新图文消息" + j.ToString("D2"); bool IsOK=true ; string PathFile = System.IO.Path.Combine(Server.MapPath("~"), "USER_DIR\\SYSUSER\\NEWS\\page"+j.ToString()+".htm" ); if (System.IO.File.Exists(PathFile) == true) { IsOK = false; } else { for (int i = 0; i < TreeView1.Nodes.Count; i++) { //节点名称 已经存在 或者 文件名已经存在 if (TreeView1.Nodes[i].Text == Name) { IsOK = false; break; } } } if (IsOK == true) { string filename ="page"+ j.ToString() + ".htm"; //自动生产一个文件名 TreeView1.Nodes.Add(new TreeNode(Name)); Label2.Text = Name; TextBoxTitle.Text =Name; txt0.Text =""; TextBoxUrl.Text = filename; TextBoxEDIT.Text = "内容描述"; NewsItem myItem = new NewsItem(); myItem.Title = Name; myItem.PicUrl =""; myItem.Url = filename; myItem.Description = "内容描述"; NewsMsgData CMsgData = new NewsMsgData(); CMsgData.LoadSet(WeTextBoxOne.Text); CMsgData.Items.Add(myItem); WeTextBoxOne.Text = CMsgData.Getdata(); return; } } }
protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack) return; //读取的时候 HttpCookie cookie2 = Request.Cookies["weiweixing"]; if (cookie2 == null) { Response.Redirect("login.aspx"); return; } string name = cookie2.Values["name"]; if (name == null) { Response.Redirect("login.aspx"); return; } string md5 = cookie2.Values["md5"]; if (md5 == null) { Response.Redirect("login.aspx"); return; } string PathFile = System.IO.Path.Combine(Server.MapPath("~"), "USER_DIR\\SYSUSER\\NEWS\\news.dll"); //图文 关键词回复目录); TreeView1.Nodes.Clear(); NewsMsgData CMsgData = new NewsMsgData(); CMsgData.LoadFile(PathFile); for (int i = 0; i < CMsgData.Items.Count; i++) { TreeView1.Nodes.Add(new TreeNode(CMsgData.Items[i].Title)); } WeTextBoxOne.Text = CMsgData.Getdata(); TextBoxTitle.Text = ""; txt0.Text = ""; TextBoxUrl.Text = ""; TextBoxEDIT.Text = ""; Label2.Text = ""; }
protected void FileManager1_ExecuteCommand(object sender, ExecuteCommandEventArgs e) { if (Page.IsCallback) { e.ClientScript = "alert('Use ExecuteCommand event to handle your custom command.\\nCommandName=" + e.CommandName + "\\nItem=" + e.Items[0].VirtualPath + "')"; } else { if (e.CommandName == "EditText") { if (e.Items.Count == 0) return; FileManagerItemInfo item = e.Items[0]; ViewState["EditDocumentPath"] = item.PhysicalPath; WeTextBoxFive.Text = ClassLibraryWeiBao.ClassWeiWeiXin.GetFileName(item.PhysicalPath); // string text = File.ReadAllText(item.PhysicalPath, System.Text.Encoding.UTF8); // TreeView1.Nodes.Add(new TreeNode("新图文消息", "")); TreeView1.Nodes.Clear(); NewsMsgData CMsgData = new NewsMsgData(); CMsgData.LoadFile(item.PhysicalPath); for (int i = 0; i < CMsgData.Items.Count; i++) { if (CMsgData.Items[i].Title != "") { TreeView1.Nodes.Add(new TreeNode(CMsgData.Items[i].Title)); } } for (int i = 0; i < CMsgData.Items.Count; i++) { if (CMsgData.Items[i].Title == "") { CMsgData.Items.RemoveAt(i); } } TextBoxTitle.Text =""; txt0.Text =""; TextBoxUrl.Text =""; TextBoxEDIT.Text = ""; Label2.Text = ""; Image1.ImageUrl = ""; WeTextBoxOne.Text = CMsgData.Getdata(); Label1.Text = ""; FileManager1.Visible = false; TextEditor.Visible = true; } } }
protected void Button21_Click(object sender, EventArgs e) { if (Label2.Text == "") return; NewsItem myItem = new NewsItem(); myItem.Title = TextBoxTitle.Text ; myItem.PicUrl= txt0.Text ; myItem.Url=TextBoxUrl.Text ; string PathFile = System.IO.Path.Combine(Server.MapPath("~"),"USER_DIR\\SYSUSER\\NEWS\\"+ myItem.Url); System.IO.File.WriteAllText(PathFile, TextBoxEDIT.Text, System.Text.Encoding.UTF8); myItem.Description = "";// NewsMsgData CMsgData = new NewsMsgData(); CMsgData.LoadSet(WeTextBoxOne.Text); for (int i = 0; i < CMsgData.Items.Count; i++) { if (CMsgData.Items[i].Title == Label2.Text) { CMsgData.Items[i] = myItem; break; } } WeTextBoxOne.Text = CMsgData.Getdata(); TreeView1.Nodes.Clear(); for (int i = 0; i < CMsgData.Items.Count; i++) { TreeView1.Nodes.Add(new TreeNode(CMsgData.Items[i].Title)); } TextBoxTitle.Text = ""; txt0.Text = ""; TextBoxUrl.Text = ""; TextBoxEDIT.Text = ""; Label2.Text = ""; Button24_Click(null, null); }
protected void Button23_Click(object sender, EventArgs e) { if (TreeView1.Nodes.Count >= 10) return; for (int j = 0; j < 100; j++) { string Name = "新图文消息" + j.ToString("D2"); bool IsOK=true ; for(int i=0;i<TreeView1.Nodes.Count;i++) { if (TreeView1.Nodes[i].Text == Name) { IsOK = false; break; } } if (IsOK == true) { TreeView1.Nodes.Add(new TreeNode(Name)); Label2.Text = Name; TextBoxTitle.Text =Name; txt0.Text =""; TextBoxUrl.Text =""; TextBoxEDIT.Text = "内容描述"; NewsItem myItem = new NewsItem(); myItem.Title = Name; myItem.PicUrl =""; myItem.Url = ""; myItem.Description = "内容描述"; NewsMsgData CMsgData = new NewsMsgData(); CMsgData.LoadSet(WeTextBoxOne.Text); CMsgData.Items.Add(myItem); WeTextBoxOne.Text = CMsgData.Getdata(); Image1.ImageUrl = ""; return; } } }
protected void Button22_Click(object sender, EventArgs e) { for (int i = 0; i < TreeView1.Nodes.Count; i++) { if (TreeView1.Nodes[i].Text == Label2.Text) { TreeView1.Nodes.RemoveAt(i); break; } } NewsMsgData CMsgData = new NewsMsgData(); CMsgData.LoadSet(WeTextBoxOne.Text); for (int i = 0; i < CMsgData.Items.Count; i++) { if (CMsgData.Items[i].Title == Label2.Text) { CMsgData.Items.RemoveAt(i); break; } } WeTextBoxOne.Text = CMsgData.Getdata(); TextBoxTitle.Text =""; txt0.Text =""; TextBoxUrl.Text =""; TextBoxEDIT.Text = ""; Label2.Text = ""; Button24_Click(null, null); }
protected void Button21_Click(object sender, EventArgs e) { NewsItem myItem = new NewsItem(); myItem.Title = TextBoxTitle.Text ; myItem.PicUrl= txt0.Text ; myItem.Url=TextBoxUrl.Text ; myItem.Description= TextBoxEDIT.Text ; NewsMsgData CMsgData = new NewsMsgData(); CMsgData.LoadSet(WeTextBoxOne.Text); bool IsSave = false; for (int i = 0; i < CMsgData.Items.Count; i++) { if (CMsgData.Items[i].Title == Label2.Text) { CMsgData.Items[i] = myItem; IsSave = true; break; } } if (IsSave == false) CMsgData.Items.Add(myItem); TreeView1.Nodes.Clear(); for (int i = 0; i < CMsgData.Items.Count; i++) { TreeView1.Nodes.Add(new TreeNode(CMsgData.Items[i].Title)); } TextBoxTitle.Text = ""; txt0.Text = ""; TextBoxUrl.Text = ""; TextBoxEDIT.Text = ""; Label2.Text = ""; WeTextBoxOne.Text = CMsgData.Getdata(); Image1.ImageUrl = ""; Button24_Click(null ,null ); }
protected void FileManager1_ExecuteCommand(object sender, ExecuteCommandEventArgs e) { if (Page.IsCallback) { e.ClientScript = "alert('Use ExecuteCommand event to handle your custom command.\\nCommandName=" + e.CommandName + "\\nItem=" + e.Items[0].VirtualPath + "')"; } else { if (e.CommandName == "EditText") { if (e.Items.Count == 0) return; FileManagerItemInfo item = e.Items[0]; ViewState["EditDocumentPath"] = item.PhysicalPath; char[] x={'_','.'}; string[] Name2= ClassLibraryWeiBao.ClassWeiWeiXin.GetFileName(item.PhysicalPath).Split(x); WeTextBoxFive.Text= Name2[0].Replace("V",".") ; WeTextBoxSix.Text = Name2[1].Replace("V", "."); // string text = File.ReadAllText(item.PhysicalPath, System.Text.Encoding.UTF8); // TreeView1.Nodes.Add(new TreeNode("新图文消息", "")); NewsMsgData CMsgData = new NewsMsgData(); CMsgData.LoadFile(item.PhysicalPath); TextBoxTitle.Text = CMsgData.Items[0].Title; txt0.Text = CMsgData.Items[0].PicUrl; TextBoxUrl.Text = CMsgData.Items[0].Url; TextBoxEDIT.Text = CMsgData.Items[0].Description; WeTextBoxOne.Text = CMsgData.Getdata(); Label1.Text = ""; FileManager1.Visible = false; TextEditor.Visible = true; } } }
protected void Button24_Click(object sender, EventArgs e) { if (WeTextBoxFive.Text.Trim() == "") { Label1.Text = "请输入关键字"; return; } NewsItem myItem = new NewsItem(); myItem.Title = TextBoxTitle.Text; myItem.PicUrl = txt0.Text; myItem.Url = TextBoxUrl.Text; myItem.Description = TextBoxEDIT.Text; NewsMsgData CMsgData = new NewsMsgData(); CMsgData.LoadSet(WeTextBoxOne.Text); bool IsSave = false; for (int i = 0; i < CMsgData.Items.Count; i++) { CMsgData.Items[i] = myItem; IsSave = true; break; } if (IsSave == false) CMsgData.Items.Add(myItem); WeTextBoxOne.Text = CMsgData.Getdata(); try { long nX = (int)(double.Parse(WeTextBoxFive.Text) * 100000); long nY = (int)(double.Parse(WeTextBoxSix.Text) * 100000); string NAME2 = nX.ToString() + "_" + nY.ToString(); //模糊地址 //long nX1 = (int)(double.Parse(WeTextBoxFive.Text) * 10000000); //long nY1 = (int)(double.Parse(WeTextBoxSix.Text) * 10000000); string NAME1 = WeTextBoxFive.Text.Replace(".", "V") + "_" + WeTextBoxSix.Text.Replace(".", "V"); //高精度地址 string PathFile1 = System.IO.Path.Combine(Server.MapPath("~"), "USER_DIR\\SYSUSER\\MyPost\\location1\\" + NAME1 + ".dll"); //图文 关键词回复目录); File.WriteAllText(PathFile1, WeTextBoxOne.Text, System.Text.Encoding.UTF8); string PathFile2 = System.IO.Path.Combine(Server.MapPath("~"), "USER_DIR\\SYSUSER\\MyPost\\location2\\" + NAME2 + ".dll"); //图文 关键词回复目录); File.WriteAllText(PathFile2, WeTextBoxOne.Text, System.Text.Encoding.UTF8); FileManager1.Visible = true; TextEditor.Visible = false; Label1.Text = "保存成功!"; FileManager1.FileViewMode = IZ.WebFileManager.Components.FileViewRenderMode.Details; } catch { Label1.Text = "保存失败,关键字中不能有特殊字符"; } }