//静态发布栏目和内容页 protected void btnpub3_Click(object sender, EventArgs e) { try { TPortalClass.JpSite site = new TPortalClass.JpSite(); TPortalClass.JpShtml jpshtml = new TPortalClass.JpShtml(); TPortalClass.JpColumns JpColumns = new TPortalClass.JpColumns(); DataTable dt_col = JpColumns.GetColumnsOnline(); if (dt_col.Rows.Count > 0) { for (int i = 0; i < dt_col.Rows.Count; i++) { if (dt_col.Rows[i]["shtml"].ToString() == "1") //静态发布的栏目 { TPortalClass.JpColumns pubcol = new TPortalClass.JpColumns(dt_col.Rows[i]["cid"].ToString()); pubcol.shtmlpublish(2, int.Parse(txtdays.Value)); } } } Response.Write("<script language=javascript>alert('发布成功!');window.location='pubhtml.aspx';</script>"); } catch { Response.Write("<script language=javascript>alert('发布失败!');window.location='pubhtml.aspx';</script>"); } finally { } }
//静态发布指定的栏目和内容页 protected void btnpub4_Click(object sender, EventArgs e) { try { if (ddlcol.SelectedValue.ToString() != "") { TPortalClass.JpColumns pubcol = new TPortalClass.JpColumns(ddlcol.SelectedValue.ToString()); pubcol.shtmlpublish(2, int.Parse(txtdays.Value)); //得到子栏目进行发布 TPortalClass.JpColumns JpColumns = new TPortalClass.JpColumns(); DataTable dt_col = JpColumns.GetAllSubonlineColumns(ddlcol.SelectedValue.ToString()); if (dt_col.Rows.Count > 0) { for (int i = 0; i < dt_col.Rows.Count; i++) { TPortalClass.JpColumns pubcol_sub = new TPortalClass.JpColumns(dt_col.Rows[i]["cid"].ToString()); pubcol_sub.shtmlpublish(2, int.Parse(txtdays.Value)); } } Response.Write("<script language=javascript>alert('发布成功!');window.location='pubhtml.aspx';</script>"); } else { Response.Write("<script language=javascript>alert('请选择需要栏目!');window.location='pubhtml.aspx';</script>"); } } catch { Response.Write("<script language=javascript>alert('发布失败!');window.location='pubhtml.aspx';</script>"); } finally { } }
//���� public void PubAll(String ids, String pubtime, String endtime) { DAO db = new DAO(); String sql = "update JpArticle set status='����',pubtime=@pubtime,endtime=@endtime where @aids like '%,'+cast(aid as varchar(12))+',%'"; SqlParameter[] prams ={ db.MakeInParam("@aids", SqlDbType.VarChar, ids), db.MakeInParam("@pubtime", SqlDbType.DateTime, pubtime), db.MakeInParam("@endtime", SqlDbType.DateTime, endtime), }; db.Execute(sql, prams); sql = "select aid, cid from JpArticle where @aids like '%,'+cast(aid as varchar(12))+',%'"; prams = new SqlParameter[]{ db.MakeInParam("@aids", SqlDbType.VarChar, ids) }; DataTable dt = db.GetDataTable(sql, prams); db.Close(); for (int i = 0; i < dt.Rows.Count; i++) { String l_cid = ""; int l_aid = 0; l_cid = dt.Rows[i]["cid"].ToString(); l_aid = Int32.Parse(dt.Rows[i]["aid"].ToString()); JpColumns col = new JpColumns(l_cid); //map_add(pubtime, endtime, l_cid, l_aid); if (col.shtml.Equals("1"))// ��ǰ������Ŀ�Ǵ���̬�����������Զ�ˢ�£���վ��ҳ��������Ŀ��ҳ����ǰ����ҳ { shtmlpublish(true, l_cid, l_aid); col.shtmlpublish(0, 0); //�����ǰ��Ŀ����һ����Ŀ����������е��ϼ�Ŀ¼ if (l_cid.Length > 3) { for (int j = 0; j < (l_cid.Length / 3 - 1); j++) { JpColumns col_sj = new JpColumns(l_cid.Substring(0, 3 * (j + 1))); col_sj.shtmlpublish(0, 0); } } } if (col.shtml.Equals("0"))// ��ʱ�������߶�̬����������ˢ�������Ŀ { col.shtmlRelation();// ������Ŀ��صľ�̬��Ŀ���� } col.RssFlush(true);// RSS���� } //���·���ʱͬʱ������ҳ�����õĶ���ҳ PubHtml_Config(); }
/// <summary> /// �����Ŀ��̬���� /// </summary> public void shtmlRelation() { DAO db = new DAO(); String sql = "SELECT cid FROM JpColumnRelations WHERE cid_relation = @cid"; SqlParameter[] sqlparam = { db.MakeInParam("@cid",SqlDbType.VarChar,cid) }; DataTable dt = db.GetDataTable(sql, sqlparam); for (int i = 0; i < dt.Rows.Count; i++) { String id = dt.Rows[0]["cid"].ToString(); JpColumns col = new JpColumns(id); col.shtmlpublish(1, 0); } db.Close(); }
//ɾ�� public void DeleteAll(String ids) { DAO db = new DAO(); String sql = ""; sql = "select aid, cid from JpArticle where @aids like '%,'+cast(aid as varchar(12))+',%'"; SqlParameter[] prams = new SqlParameter[]{ db.MakeInParam("@aids", SqlDbType.VarChar, ids) }; DataTable dt = db.GetDataTable(sql, prams); //for (int i = 0; i < dt.Rows.Count; i++) //{ // shtmlpublish(false, dt.Rows[i]["cid"].ToString(), Int32.Parse(dt.Rows[i]["aid"].ToString())); //} sql = "Delete FROM JpArticle where @aids like '%,'+cast(aid as varchar(12))+',%'"; prams = new SqlParameter[]{ db.MakeInParam("@aids", SqlDbType.VarChar, ids) }; db.Execute(sql, prams); db.Close(); for (int i = 0; i < dt.Rows.Count; i++) { String l_cid = ""; int l_aid = 0; l_cid = dt.Rows[i]["cid"].ToString(); l_aid = Int32.Parse(dt.Rows[i]["aid"].ToString()); JpColumns col = new JpColumns(l_cid); //map_add(pubtime, endtime, l_cid, l_aid); if (col.shtml.Equals("1"))// ��ǰ������Ŀ�Ǵ���̬�����������Զ�ˢ�£���վ��ҳ��������Ŀ��ҳ����ǰ����ҳ { shtmlpublish(false, l_cid, l_aid); col.shtmlpublish(0, 0); //�����ǰ��Ŀ����һ����Ŀ����������е��ϼ�Ŀ¼ if (l_cid.Length > 3) { for (int j = 0; j < (l_cid.Length / 3 - 1); j++) { JpColumns col_sj = new JpColumns(l_cid.Substring(0, 3 * (j + 1))); col_sj.shtmlpublish(0, 0); } } } col.RssFlush(false);// RSS���� } //���·���ʱͬʱ������ҳ�����õĶ���ҳ PubHtml_Config(); }