protected void BtnCollec_Click(object sender, EventArgs e) { StringBuilder selectList = new StringBuilder(""); selectList = this.EgvItemRules.SelectList; bool flag = DataConverter.CBoolean(base.Request.Form["ChkIsTitle"]); if (selectList.Length > 0) { CollectionProgress progress = new CollectionProgress(); progress.ItemId = selectList.ToString(); progress.IsTitle = flag; progress.PhysicalApplicationPath = HttpContext.Current.Request.PhysicalApplicationPath; progress.UserName = PEContext.Current.Admin.UserName; progress.AdminName = PEContext.Current.Admin.AdminName; progress.CreateCollectionProc(); string str = "false"; if (CollectionItem.ExistsCreateHtml(selectList.ToString())) { str = "true"; } BasePage.ResponseRedirect("CollectionProc.aspx?ItemIds=" + selectList.ToString() + "&isCreateHtml=" + str); } else { AdminPage.WriteErrMsg("<li>请选择要采集的项目!</li>"); } }
protected void BtnStopCreate_Click(object sender, EventArgs e) { string nodeValue = XmlManage.Instance("Config/CreateCollectionWork.config", XmlType.File).GetNodeValue("CollectionWork/WorkId"); if (base.Application[nodeValue] != null) { CollectionProgress progress = base.Application[nodeValue] as CollectionProgress; progress.CreateThread.Abort(); base.Application.Remove(nodeValue); if (DataConverter.CBoolean(this.HdnIsCreateHtml.Value)) { string nodeIds = ""; string str3 = BasePage.RequestString("ItemIds"); if (!string.IsNullOrEmpty(str3)) { if (str3.Contains(",")) { foreach (string str4 in str3.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) { nodeIds = GetNodeIs(nodeIds, str4); } } else { nodeIds = GetNodeIs(nodeIds, str3); } } HtmlContent content = new HtmlContent(); content.CreateMethod = CreateContentType.CreateByNotCreate; content.NodeIdArray = nodeIds; content.CommonCreateHtml(); } } }
protected void Page_Load(object sender, EventArgs e) { string str; if (!base.IsPostBack && ((str = BasePage.RequestString("Action")) != null)) { if (!(str == "Delete")) { if (!(str == "Copy")) { if (str == "Detection") { int itemId = BasePage.RequestInt32("ItemID"); CollectionProgress progress = new CollectionProgress(); progress.Detection(itemId); if (!string.IsNullOrEmpty(progress.ErrorInfo)) { CollectionItem.Disabled(itemId); AdminPage.WriteErrMsg(progress.ErrorInfo); return; } AdminPage.WriteSuccessMsg("<li>测试采集项目成功!</li>", "ItemManage.aspx"); } return; } } else { if (CollectionItem.Delete(BasePage.RequestInt32("ItemID"))) { AdminPage.WriteSuccessMsg("<li>删除指定的采集项目成功!</li>", "ItemManage.aspx"); } return; } if (CollectionItem.Copy(BasePage.RequestInt32("ItemID"))) { AdminPage.WriteSuccessMsg("<li>复制指定的采集项目成功!</li>", "ItemManage.aspx"); } } }
public ProgressInfo AcquireProgress() { ProgressInfo info = new ProgressInfo(); string nodeValue = XmlManage.Instance("Config/CreateCollectionWork.config", XmlType.File).GetNodeValue("CollectionWork/WorkId"); if (base.Application[nodeValue] == null) { return(null); } CollectionProgress progress = (CollectionProgress)base.Application[nodeValue]; info.IsInput = progress.IsInput; info.Message = progress.CollectionMessage; info.CollectionEnd = false; info.ErrorMessage = progress.ErrorInfo; info.IsCreateHtml = progress.IsCreateHtml; info.ItemId = progress.ItemId; if (!string.IsNullOrEmpty(info.ErrorMessage)) { info.CollectionEnd = true; base.Application.Remove(nodeValue); return(info); } if (progress.IsInput) { if (progress.CollectionCompleted == progress.CollectionCount) { info.Completed = progress.CollectionCompleted; info.ExecutionTime = ((TimeSpan)(DateTime.Now - progress.CollectionStartTime)).ToString(); info.Id = progress.CreateId; info.Count = progress.CollectionCount; info.Completed = progress.CollectionCompleted; info.Progress = "100%"; if (progress.ItemCompleted == progress.ItemCount) { info.CollectionEnd = true; base.Application.Remove(nodeValue); } if (info.IsCreateHtml) { string nodeIds = ""; string itemId = info.ItemId; if (!string.IsNullOrEmpty(itemId)) { if (itemId.Contains(",")) { foreach (string str4 in itemId.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) { nodeIds = GetNodeIs(nodeIds, str4); } } else { nodeIds = GetNodeIs(nodeIds, itemId); } } info.Message = "请稍后,准备生成采集文章..."; HtmlContent content = new HtmlContent(); content.CreateMethod = CreateContentType.CreateByNotCreate; content.NodeIdArray = nodeIds; info.CreateWorkId = Guid.NewGuid().ToString(); content.CommonCreateHtml(); } return(info); } info.Completed = progress.CollectionCompleted; info.Id = progress.CreateId; info.Count = progress.CollectionCount; info.ExecutionTime = "0:00:00"; info.Progress = "0"; if (progress.CollectionCompleted != 0) { info.Progress = (((double)progress.CollectionCompleted) / ((double)progress.CollectionCount)).ToString("p"); TimeSpan span2 = (TimeSpan)(DateTime.Now - progress.CollectionStartTime); info.ExecutionTime = span2.Hours.ToString() + ":" + span2.Minutes.ToString() + ":" + span2.Seconds.ToString(); } } return(info); }