protected void DeleteBtn_Click(object sender, EventArgs e) { string xmlTitle = We7Helper.Base64Decode(MailFileText.Text); string title = TitleText.Text; string root = Server.MapPath("/_Data/SendEmail/"); if (xmlTitle.Trim() != "") { File.Delete(Path.Combine(root, xmlTitle)); Messages.ShowMessage("您已经成功删除【" + xmlTitle + "】邮件。"); } else { List <string> list = GetIDs(); if (list.Count < 1) { Messages.ShowMessage("您没有选择任何一条记录!"); return; } foreach (string titleTM in list) { File.Delete(Path.Combine(root, We7Helper.Base64Decode(titleTM))); } Messages.ShowMessage(string.Format("您已经成功删除了{0}封邮件", list.Count.ToString())); } LoadAdvices(); }
/// <summary> /// 页面加载信息 /// </summary> void LoadErrorEmailInfo() { //TitleTextBox.Text = Title; string root = Server.MapPath("/_Data/ErrorEmail/" + FileName); if (File.Exists(root)) { XmlDocument doc = new XmlDocument(); doc.Load(root); XmlNode node = doc.SelectSingleNode("/root/infoBody"); if (node != null) { ReplayContent.InnerHtml = We7Helper.Base64Decode(node.InnerText); } node = doc.SelectSingleNode("/root/infoUser"); if (node != null) { UserLabel.Text = We7Helper.Base64Decode(node.InnerText); } node = doc.SelectSingleNode("/root/infoRawManage"); if (node != null) { InfoRawManage.InnerHtml = We7Helper.Base64Decode(node.InnerText); } node = doc.SelectSingleNode("/root/infoSubject"); if (node != null) { TitleTextBox.Text = EmailTitleLabel.Text = We7Helper.Base64Decode(node.InnerText); } } }
/// <summary> /// 页面加载xml数据 /// </summary> void LoadAdvices() { List <AdviceReply> adviceReply = new List <AdviceReply>(); string root = Server.MapPath("/_Data/ErrorEmail/"); if (Directory.Exists(root)) { DirectoryInfo dir = new DirectoryInfo(root); FileInfo[] files = dir.GetFiles("*.xml"); for (int i = files.Length - 1; i >= 0; i--) { FileInfo file = files[i]; AdviceReply ar = new AdviceReply(); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(file.FullName); XmlNode node = xmlDoc.SelectSingleNode("/root/infoSubject"); ar.Title = We7Helper.Base64Decode(node.InnerText); node = xmlDoc.SelectSingleNode("/root/infoBody"); ar.Content = We7Helper.Base64Decode(node.InnerText); node = xmlDoc.SelectSingleNode("/root/infoUser"); ar.UserEmail = We7Helper.Base64Decode(node.InnerText); node = xmlDoc.SelectSingleNode("/root/infoTime"); ar.CreateDate = Convert.ToDateTime(node.InnerText); ar.MailFile = file.Name; adviceReply.Add(ar); } } if (adviceReply != null) { Pager.RecorderCount = adviceReply.Count; } else { Pager.RecorderCount = 0; } if (Pager.Count < 0) { Pager.PageIndex = 0; } Pager.FreshMyself(); if (Pager.Count <= 0) { DataGridView.DataSource = null; DataGridView.DataBind(); return; } DataGridView.DataSource = adviceReply.GetRange(Pager.Begin, Pager.Count); DataGridView.DataBind(); }