protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["spcId"] != null) { spcId = Request.QueryString["spcId"].ToString(); } if (!currentAdmin.validationSpcAdmin(spcId)) { adminOpers.ShowNoPower(); return; } if (Request.QueryString["action"] != null && Request.QueryString["action"].ToString() == "delete" && Request.QueryString["typeid"] != null) { string typeids = string.Empty; typeids = bllarticletype.DeleteNode(Convert.ToInt32(Request.QueryString["typeid"])); DataTable dt = bllarticletype.GetList("id in(" + typeids + ")").Tables[0]; bllarticle.DeleteArticlesByTypeids(typeids); string spcDir = sys.getSpcDir(Convert.ToInt32(spcId)); for (int i = 0; i < dt.Rows.Count; i++) { sys.deleteArticleFile(Convert.ToInt32(dt.Rows[i]["id"].ToString()), spcDir, Convert.ToDateTime(dt.Rows[i]["dbo_ptime"])); } Response.Redirect("typeList.aspx?spcId=" + spcId); } else { showTypeList(); } }
private void InitPage() { DataTable dt = bllarticletype.GetList(fiter + " order by id asc").Tables[0]; DataTable dttemp = bllarticletype.getChildNodes(dt, 0); this.ddlType.Items.Add(new ListItem("所有类型", "0")); FillDdlFatherType(dt, null, 0, (dttemp.Rows.Count <= 1)); }
public void ToStaticList(int count) { DataTable dt = bllarticletype.GetList("dbo_specialityId=" + spcId).Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { ToStaticListTypeId(Convert.ToInt32(dt.Rows[i]["id"]), count); } this.lblMessage.Text = "频道列表页生成成功!共" + dt.Rows.Count.ToString() + "分类,生成" + listPages.ToString() + "页.执行时间:" + DateTime.Now.ToString("yyyy年MM月dd日hh时mm分ss秒"); }
/// <summary> /// 删除一条数据 /// </summary> public bool RealDelete(int ID) { DataTable dt = bllarticletype.GetList("dbo_fatherid=0 and dbo_specialityId=" + ID).Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { string typeids = bllarticletype.DeleteNode(Convert.ToInt32(dt.Rows[i]["id"])); bllarticle.DeleteArticlesByTypeids(typeids); } return(dal.Delete(ID)); }
private void InitPage() { string fiter = "dbo_specialityId=" + spcId + " and dbo_isArticleType=True"; if (!currentAdmin.validationSpcAdmin(spcId)) { string ids = adminOpers.getChannelPower(spcId, currentAdmin.Channels); if (ids == "-2") { Page.ClientScript.RegisterStartupScript(Page.GetType(), "alertNoTypes", "alert('专题下未创建任何文章类型或者您在该专题下没有任何权限');", true); pnlContent.Visible = false; return; } fiter = " id in(" + ids + ") "; } DataTable dt = bllarticletype.GetList(fiter + " order by id asc").Tables[0]; DataTable dttemp = bllarticletype.getChildNodes(dt, 0); if (dttemp.Rows.Count == 0) { Page.ClientScript.RegisterStartupScript(Page.GetType(), "alertNoTypes", "alert('专题下未创建任何文章类型,请先添加文章类型');", true); pnlContent.Visible = false; return; } if (!Page.IsPostBack) { this.ddlType.Items.Add(new ListItem("请选择分类", "0")); FillDdlFatherType(dt, null, 0, (dttemp.Rows.Count <= 1)); this.txtSource.Text = sys.webName; this.txtAuthor.Text = currentAdmin.Name; } if (!Page.IsPostBack && theState == MyPageState.edit) { this.btnSubmit.Text = "保存修改"; FillContent(); } }
public void showPowerSelect() { string adminPower = string.Empty; string adminName = string.Empty; model = blladmin.GetModel(Convert.ToInt32(Request.QueryString["id"])); if (model != null) { adminName = model.dbo_UserName; adminPower = model.dbo_Power; } else { return; } if (!Page.IsPostBack) { this.litName.Text = adminName; if (adminPower == "super") { this.rbtnSuper.Checked = true; this.rbtnCommon.Checked = false; } else { this.rbtnSuper.Checked = false; this.rbtnCommon.Checked = true; } } DataTable dtSpc = bllspeciality.GetList("1=1 order by id asc").Tables[0]; DataRow dr = dtSpc.NewRow(); dr["id"] = "0"; dr["dbo_name"] = "默认频道"; dr["dbo_htmlDir"] = ""; dtSpc.Rows.InsertAt(dr, 0); for (int i = 0; i < dtSpc.Rows.Count; i++) { #region 显示频道权限设置的内容 string channelId = dtSpc.Rows[i]["id"].ToString(); string channelName = dtSpc.Rows[i]["dbo_name"].ToString(); HtmlGenericControl fieldset = new HtmlGenericControl("fieldset"); fieldset.ID = "fieldset" + channelId; HtmlGenericControl legend = new HtmlGenericControl("legend"); legend.ID = "legend" + channelId; pla1.Controls.Add(fieldset); fieldset.Controls.Add(legend); legend.InnerText = "此管理员在【" + channelName + "】的管理权限"; Panel p1 = new Panel(); fieldset.Controls.Add(p1); Panel p2 = new Panel(); fieldset.Controls.Add(p2); Panel pTypes = new Panel(); pTypes.ID = "ChannelTypes" + channelId; fieldset.Controls.Add(pTypes); Panel p3 = new Panel(); fieldset.Controls.Add(p3); RadioButton rbtn1 = new RadioButton(); p1.Controls.Add(rbtn1); rbtn1.Text = "频道管理员:拥有该频道的所有权限(内容管理,类别管理,静态生成,模板管理)"; rbtn1.ID = "ChannelAdmin" + channelId; rbtn1.GroupName = "ChannelAdmin" + channelId; rbtn1.Attributes.Add("onclick", "javascript:showTypes(false,'ChannelTypes" + channelId + "');"); RadioButton rbtn2 = new RadioButton(); p2.Controls.Add(rbtn2); rbtn2.Text = "频道编辑:仅拥有相对应内容类别的管理权限"; rbtn2.ID = "ChannelEditor" + channelId; rbtn2.GroupName = "ChannelAdmin" + channelId; rbtn2.Attributes.Add("onclick", "javascript:showTypes(true,'ChannelTypes" + channelId + "');"); CheckBoxList chkList = new CheckBoxList(); chkList.ID = "chkList" + channelId; pTypes.Controls.Add(chkList); chkList.RepeatDirection = RepeatDirection.Horizontal; RadioButton rbtn3 = new RadioButton(); p3.Controls.Add(rbtn3); rbtn3.Text = "在此频道无任何管理权限"; rbtn3.ID = "Nopower" + channelId; rbtn3.GroupName = "ChannelAdmin" + channelId; rbtn3.Attributes.Add("onclick", "javascript:showTypes(false,'ChannelTypes" + channelId + "');"); #endregion if (!Page.IsPostBack) { #region 添加该频道下的文章类别 DataTable dtTypes = bllarticletype.GetList("dbo_fatherid=0 and dbo_specialityId = " + channelId + " order by id asc").Tables[0]; for (int j = 0; j < dtTypes.Rows.Count; j++) { chkList.Items.Add(new ListItem(dtTypes.Rows[j]["dbo_typename"].ToString(), dtTypes.Rows[j]["id"].ToString())); } #endregion #region 填充已经有的权限 bool IsEditor = false; string power = adminOpers.getChannelPower(channelId, adminOpers.getChannels(adminPower)); switch (power) { case "0": rbtn1.Checked = true; break; case "-1": rbtn3.Checked = true; break; default: rbtn2.Checked = true; IsEditor = true; break; } if (IsEditor && power != "-2") { string[] powers = power.Split(','); for (int j = 0; j < chkList.Items.Count; j++) { for (int k = 0; k < powers.Length; k++) { if (chkList.Items[j].Value == powers[k]) { chkList.Items[j].Selected = true; break; } } } } if (!IsEditor) { pTypes.Style.Add("display", "none"); } #endregion } } }
private void initEdit() { if (spcId == "0") { this.litSpcName.Text = "默认专题"; } else { this.litSpcName.Text = bllspeciality.GetModel(Convert.ToInt32(spcId)).dbo_Name; } DataTable dt = bllarticletype.GetList("dbo_specialityId=" + spcId + " order by id asc ").Tables[0]; DataTable dttemp = getChildNodes(dt, 0); #region 关于类型 this.ddlFatherType.Items.Add(new ListItem("作为根类型", "0")); FillDdlFatherType(dt, null, 0, (dttemp.Rows.Count <= 1)); string fatherTypeId = "0"; string strSpecialityId = "0"; bool IsDisplay = true; bool IsArticleType = true; if (theState == MyPageState.edit) { modelarticletype = bllarticletype.GetModel(Convert.ToInt32(Request.QueryString["typeid"])); if (modelarticletype != null) { this.txtTypeName.Text = modelarticletype.dbo_TypeName; this.txtLinkUrl.Text = modelarticletype.dbo_LinkUrl; fatherTypeId = modelarticletype.dbo_Fatherid.ToString(); strSpecialityId = modelarticletype.dbo_SpecialityId.ToString(); IsDisplay = modelarticletype.dbo_IsDisplay; IsArticleType = modelarticletype.dbo_IsArticleType; } } else if (Request.QueryString["fatherid"] != null) { fatherTypeId = Request.QueryString["fatherid"].ToString(); this.ddlFatherType.Enabled = false; } if (fatherTypeId != "0") { for (int i = 0; i < ddlFatherType.Items.Count; i++) { if (ddlFatherType.Items[i].Value == fatherTypeId) { this.ddlFatherType.Items[i].Selected = true; break; } } } #endregion this.chkIsDisplay.Checked = IsDisplay; this.chkIsArticleType.Checked = IsArticleType; #region 关于专题 if (theState == MyPageState.edit) { this.ddlSpeciality.Items.Add(new ListItem("默认专题", "0")); DataTable dtSpecialitys = bllspeciality.GetList("1=1 order by id desc").Tables[0]; for (int i = 0; i < dtSpecialitys.Rows.Count; i++) { this.ddlSpeciality.Items.Add(new ListItem(dtSpecialitys.Rows[i]["dbo_name"].ToString(), dtSpecialitys.Rows[i]["id"].ToString())); } if (strSpecialityId != "0") { for (int i = 0; i < ddlSpeciality.Items.Count; i++) { if (ddlSpeciality.Items[i].Value == strSpecialityId) { this.ddlSpeciality.Items[i].Selected = true; break; } } } this.litSpcName.Visible = false; } else { this.ddlSpeciality.Visible = false; } #endregion }