//列出采集项目 private void GetCollItemList() { TPortalClass.JpCollect JpCollect = new TPortalClass.JpCollect(); //string ls_sql2 = "SELECT * FROM JpCollect as a,JpColumns as b where a.ClassId = b.cid order by Id"; DataTable dt = JpCollect.Getcjlb(); this.GvCollItemList.DataSource = dt; this.GvCollItemList.DataBind(); }
//复制向导 private void CopyCollectInfo() { TPortalClass.JpCollect JpCollect = new TPortalClass.JpCollect(); if (Request.QueryString["id"] != null) { JpCollect.ItemName = ItemName + "副本"; JpCollect.ClassId = ClassId; JpCollect.WebEncode = WebEncode; JpCollect.WebName = WebName; JpCollect.WebUrl = WebUrl; JpCollect.ItemRemark = ItemRemark; JpCollect.Script_Iframe = Script_Iframe; JpCollect.Script_Object = Script_Object; JpCollect.Script_Script = Script_Script; JpCollect.Script_Div = Script_Div; JpCollect.Script_Table = Script_Table; JpCollect.Script_Span = Script_Span; JpCollect.Script_Img = Script_Img; JpCollect.Script_Font = Script_Font; JpCollect.Script_A = Script_A; JpCollect.Script_Html = Script_Html; JpCollect.IsSaveImg = IsSaveImg; JpCollect.IsDesc = IsDesc; JpCollect.CollecNum = CollecNum; JpCollect.ListUrl = ListUrl; JpCollect.ListStart = ListStart; JpCollect.ListEnd = ListEnd; JpCollect.LinkStart = LinkStart; JpCollect.LinkEnd = LinkEnd; JpCollect.TitleStart = TitleStart; JpCollect.TitleEnd = TitleEnd; JpCollect.RemoveTitle = RemoveTitle; JpCollect.KeyWordStart = KeyWordStart; JpCollect.KeyWordEnd = KeyWordEnd; JpCollect.DateStart = DateStart; JpCollect.SourceStart = SourceStart; JpCollect.DateEnd = DateEnd; JpCollect.SourceEnd = SourceEnd; JpCollect.ContentStart = ContentStart; JpCollect.ContentEnd = ContentEnd; JpCollect.RemoveBodyStart = RemoveBodyStart; JpCollect.RemoveBodyEnd = RemoveBodyEnd; JpCollect.NextPageRegex = NextPageRegex; JpCollect.Copydoc(); } }
//根据ID得到列表所有内容 private void GetAllListContent() { TPortalClass.JpCollect JpCollect = new TPortalClass.JpCollect(); if (Request.QueryString["id"] != null && Request.QueryString["id"] != "8888") { Id = this.Request.QueryString["id"].ToString(); //string ls_sql = "select * from JpCollect where id = " + Id; dt = JpCollect.Getdocbyid(int.Parse(Id)); //dt = db.GetDataTable(ls_sql); if (dt.Rows.Count > 0) { this.txtId.Text = dt.Rows[0]["Id"].ToString(); ListUrl = dt.Rows[0]["ListUrl"].ToString(); ListStart = dt.Rows[0]["ListStart"].ToString(); ListEnd = dt.Rows[0]["ListEnd"].ToString(); LinkStart = dt.Rows[0]["LinkStart"].ToString(); LinkEnd = dt.Rows[0]["LinkEnd"].ToString(); TitleStart = dt.Rows[0]["TitleStart"].ToString(); TitleEnd = dt.Rows[0]["TitleEnd"].ToString(); RemoveTitle = dt.Rows[0]["RemoveTitle"].ToString(); KeyWordStart = dt.Rows[0]["KeyWordStart"].ToString(); KeyWordEnd = dt.Rows[0]["KeyWordEnd"].ToString(); DateStart = dt.Rows[0]["DateStart"].ToString(); SourceStart = dt.Rows[0]["SourceStart"].ToString(); DateEnd = dt.Rows[0]["DateEnd"].ToString(); SourceEnd = dt.Rows[0]["SourceEnd"].ToString(); ContentStart = dt.Rows[0]["ContentStart"].ToString(); ContentEnd = dt.Rows[0]["ContentEnd"].ToString(); RemoveBodyStart = dt.Rows[0]["RemoveBodyStart"].ToString(); RemoveBodyEnd = dt.Rows[0]["RemoveBodyEnd"].ToString(); NextPageRegex = dt.Rows[0]["NextPageRegex"].ToString(); ItemName = dt.Rows[0]["ItemName"].ToString(); ClassId = dt.Rows[0]["ClassId"].ToString(); WebEncode = dt.Rows[0]["WebEncode"].ToString(); WebName = dt.Rows[0]["WebName"].ToString(); WebUrl = dt.Rows[0]["WebUrl"].ToString(); ItemRemark = dt.Rows[0]["ItemRemark"].ToString(); CollecNum = Convert.ToInt32(dt.Rows[0]["CollecNum"].ToString()); IsSaveImg = Convert.ToInt32(dt.Rows[0]["IsSaveImg"].ToString()); IsDesc = Convert.ToInt32(dt.Rows[0]["IsDesc"].ToString()); Script_Iframe = Convert.ToInt32(dt.Rows[0]["Script_Iframe"].ToString()); Script_A = Convert.ToInt32(dt.Rows[0]["Script_A"].ToString()); Script_Div = Convert.ToInt32(dt.Rows[0]["Script_Div"].ToString()); Script_Font = Convert.ToInt32(dt.Rows[0]["Script_Font"].ToString()); Script_Html = Convert.ToInt32(dt.Rows[0]["Script_Html"].ToString()); Script_Img = Convert.ToInt32(dt.Rows[0]["Script_Img"].ToString()); Script_Object = Convert.ToInt32(dt.Rows[0]["Script_Object"].ToString()); Script_Script = Convert.ToInt32(dt.Rows[0]["Script_Script"].ToString()); Script_Span = Convert.ToInt32(dt.Rows[0]["Script_Span"].ToString()); Script_Table = Convert.ToInt32(dt.Rows[0]["Script_Table"].ToString()); } } }
protected void BtnAdd_Click(object sender, EventArgs e) { TPortalClass.JpCollect JpCollect = new TPortalClass.JpCollect(); int Script_Iframe = 0, Script_Object = 0, Script_Script = 0, Script_Div = 0, Script_Table = 0, Script_Span = 0; int Script_Img = 0, Script_Font = 0, Script_A = 0, Script_Html = 0, IsSaveImg = 0, IsDesc = 0; if (this.ChkIframe.Checked) { Script_Iframe = 1; } if (this.ChkObject.Checked) { Script_Object = 1; } if (this.ChkScript.Checked) { Script_Script = 1; } if (this.ChkDiv.Checked) { Script_Div = 1; } if (this.ChkTable.Checked) { Script_Table = 1; } if (this.ChkSpan.Checked) { Script_Span = 1; } if (this.ChkImg.Checked) { Script_Img = 1; } if (this.ChkFont.Checked) { Script_Font = 1; } if (this.ChkA.Checked) { Script_A = 1; } if (this.ChkHtml.Checked) { Script_Html = 1; } if (this.ChkSaveImg.Checked) { IsSaveImg = 1; } if (this.ChkIsDesc.Checked) { IsDesc = 1; } string ls_url = ""; JpCollect.ItemName = TxtItemName.Text; JpCollect.ClassId = ddl1.SelectedItem.Value; JpCollect.WebEncode = DdlEndoce.SelectedValue; JpCollect.WebName = TxtWebName.Text; JpCollect.WebUrl = TxtWebUrl.Text; JpCollect.ItemRemark = TxtItemRemark.Text; JpCollect.Script_Iframe = Script_Iframe; JpCollect.Script_Object = Script_Object; JpCollect.Script_Script = Script_Script; JpCollect.Script_Div = Script_Div; JpCollect.Script_Table = Script_Table; JpCollect.Script_Span = Script_Span; JpCollect.Script_Img = Script_Img; JpCollect.Script_Font = Script_Font; JpCollect.Script_A = Script_A; JpCollect.Script_Html = Script_Html; JpCollect.IsSaveImg = IsSaveImg; JpCollect.IsDesc = IsDesc; JpCollect.CollecNum = int.Parse(TxtCollecNum.Text); if (Request.QueryString["id"] == "8888") { //新建 //Response.Write("<script>alert('采集基本信息填写111111111111111');</script>"); JpCollect.Insert(); //sql = "insert into JpCollect (ItemName,ClassId,WebEncode,WebName,WebUrl,ItemRemark,Script_Iframe"; //sql += ",Script_Object,Script_Script,Script_Div,Script_Table,Script_Span,Script_Img,Script_Font"; //sql += ",Script_A,Script_Html,IsSaveImg,IsDesc,CollecNum) values ("; //sql += "'" + TxtItemName.Text + "','" + ddl1.SelectedItem.Value + "','" + DdlEndoce.SelectedValue + "','" + TxtWebName.Text + "','" + TxtWebUrl.Text + "','" + TxtItemRemark.Text + "','" + Script_Iframe.ToString() + "'"; //sql += ",'" + Script_Object.ToString() + "','" + Script_Script.ToString() + "','" + Script_Div.ToString() + "','" + Script_Table.ToString() + "','" + Script_Span.ToString() + "','" + Script_Img.ToString() + "','" + Script_Font.ToString() + "'"; //sql += ",'" + Script_A.ToString() + "','" + Script_Html.ToString() + "','" + IsSaveImg.ToString() + "','" + IsDesc.ToString() + "','" + TxtCollecNum.Text + "'"; //sql += ")"; //db.Execute(sql); //得到最大的ID //string ls_maxid = ""; ////string ls_sql = "select max(Id) as maxid from JpCollect"; //DataTable dt1 = JpCollect.GetMaxID(); //if (dt1.Rows.Count > 0) //{ // ls_maxid = JpCollect.GetMaxID(); //} ls_url = "list_collect.aspx?action=list&id=" + JpCollect.GetMaxID(); } else { //修改 JpCollect.Id = int.Parse(this.txtId.Text); JpCollect.UpdateCjjbxx(); //sql = "update JpCollect set ItemName='" + TxtItemName.Text + "',ClassId='" + ddl1.SelectedItem.Value + "',WebEncode='" + DdlEndoce.SelectedValue + "'"; //sql += ",WebName='" + TxtWebName.Text + "',WebUrl='" + TxtWebUrl.Text + "',ItemRemark='" + TxtItemRemark.Text + "'"; //sql += ",Script_Iframe='" + Script_Iframe + "',Script_Object='" + Script_Object + "',Script_Script='" + Script_Script + "'"; //sql += ",Script_Div='" + Script_Div + "',Script_Table='" + Script_Table + "',Script_Span='" + Script_Span + "'"; //sql += ",Script_Img='" + Script_Img + "',Script_Font='" + Script_Font + "',Script_A='" + Script_A + "'"; //sql += ",Script_Html='" + Script_Html + "',IsSaveImg='" + IsSaveImg + "',IsDesc='" + IsDesc + "'"; //sql += ",CollecNum='" + TxtCollecNum.Text + "' where id=" + this.txtId.Text; //db.Execute(sql); ls_url = "list_collect.aspx?action=list&id=" + this.txtId.Text; } Response.Write("<script>alert('采集基本信息填写完成!');window.location='" + ls_url + "';</script>"); }
protected void GvCollItemList_RowDeleting(object sender, GridViewDeleteEventArgs e) { int Id = Convert.ToInt32(GvCollItemList.DataKeys[e.RowIndex].Value); TPortalClass.JpCollect JpCollect = new TPortalClass.JpCollect(); JpCollect.Id = Id; JpCollect.Delete(); //string sql = "delete from JpCollect where id=" + Id; //db.Execute(sql); //db.Close(); GetCollItemList(); }
//通过测试 设置采集状态为“可采集” protected void BtnTestOK_Click(object sender, EventArgs e) { TPortalClass.JpCollect JpCollect = new TPortalClass.JpCollect(); JpCollect.Id = int.Parse(this.txtId.Text); JpCollect.UpdateCjnrcs(); //string sql = "update JpCollect set State='0' where id=" + this.txtId.Text; //db.Execute(sql); //db.Close(); Response.Write("<script>alert('采集内容测试');window.location='list_collect.aspx';</script>"); }
//列表内容更新 protected void BtnList_Click(object sender, EventArgs e) { TPortalClass.JpCollect JpCollect = new TPortalClass.JpCollect(); JpCollect.ListUrl = this.TxtListUrl.Text.Trim(); JpCollect.ListStart = this.TxtListStart.Text.Trim(); JpCollect.ListEnd = this.TxtListEnd.Text.Trim(); JpCollect.Id = int.Parse(this.txtId.Text); JpCollect.UpdateCjlb(); //string sql = "update JpCollect set ListUrl='" + this.TxtListUrl.Text.Trim() + "',ListStart='" + this.TxtListStart.Text.Trim() + "',ListEnd='" + this.TxtListEnd.Text.Trim() + "'"; //sql += " where id=" + this.txtId.Text; //db.Execute(sql); //db.Close(); string ls_url = "list_collect.aspx?action=link&id=" + this.txtId.Text; Response.Write("<script>alert('采集列表填写完成!');window.location='" + ls_url + "';</script>"); }
//内容TxtRemoveTitle protected void BtnContent_Click(object sender, EventArgs e) { TPortalClass.JpCollect JpCollect = new TPortalClass.JpCollect(); JpCollect.TitleStart = this.TxtTitleStart.Text.Trim(); JpCollect.TitleEnd = this.TxtTitleEnd.Text.Trim(); JpCollect.RemoveTitle = this.TxtRemoveTitle.Text.Trim(); JpCollect.KeyWordStart = this.TxtKeyWordStart.Text.Trim(); JpCollect.KeyWordEnd = this.TxtKeyWordEnd.Text.Trim(); //JpCollect.DateRegex = this.TxtDateRegex.Text.Trim(); //JpCollect.SourceRegex = this.TxtSourceRegex.Text.Trim(); JpCollect.DateStart = this.TxtDateStart.Text; JpCollect.SourceStart = this.TxtSourceStart.Text; JpCollect.DateEnd = this.TxtDateEnd.Text; JpCollect.SourceEnd = this.TxtSourceEnd.Text; JpCollect.ContentStart = this.TxtContentStart.Text.Trim(); JpCollect.ContentEnd = this.TxtContentEnd.Text.Trim(); JpCollect.RemoveBodyStart = this.TxtRemoveBodyStart.Text.Trim(); JpCollect.RemoveBodyEnd = this.TxtRemoveBodyEnd.Text.Trim(); JpCollect.NextPageRegex = this.TxtNextPageRegex.Text.Trim(); JpCollect.Id = int.Parse(this.txtId.Text); JpCollect.UpdateCjnr(); //string sql = "update JpCollect set TitleStart='" + this.TxtTitleStart.Text.Trim() + "',TitleEnd='" + this.TxtTitleEnd.Text.Trim() + "'"; //sql += ",RemoveTitle='" + this.TxtRemoveTitle.Text.Trim() + "',KeyWordStart='" + this.TxtKeyWordStart.Text.Trim() + "'"; //sql += ",KeyWordEnd='" + this.TxtKeyWordEnd.Text.Trim() + "',DateRegex='" + this.TxtDateRegex.Text.Trim() + "'"; //sql += ",SourceRegex='" + this.TxtSourceRegex.Text.Trim() + "',ContentStart='" + this.TxtContentStart.Text.Trim() + "'"; //sql += ",ContentEnd='" + this.TxtContentEnd.Text.Trim() + "',RemoveBodyStart='" + this.TxtRemoveBodyStart.Text.Trim() + "'"; //sql += ",RemoveBodyEnd='" + this.TxtRemoveBodyEnd.Text.Trim() + "',NextPageRegex='" + this.TxtNextPageRegex.Text.Trim() + "'"; //sql += " where id=" + this.txtId.Text; //db.Execute(sql); //db.Close(); string ls_url = "list_collect.aspx?action=test&id=" + this.txtId.Text; Response.Write("<script>alert('采集内容填写完成!');window.location='" + ls_url + "';</script>"); }