//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("link", OSEnums.ActionEnum.Delete.ToString()); //检查权限 int sucCount = 0; int errorCount = 0; BLL.plugins.link bll = new BLL.plugins.link(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { if (bll.Delete(id)) { sucCount += 1; } else { errorCount += 1; } } } AddAdminLog(OSEnums.ActionEnum.Delete.ToString(), "删除友情链接成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志 Response.Redirect(Utils.CombUrlTxt("list.aspx", "keywords={0}", this.keywords)); }
private bool DoAdd() { bool result = false; Model.plugins.link model = new Model.plugins.link(); BLL.plugins.link bll = new BLL.plugins.link(); model.title = txtTitle.Text.Trim(); model.is_lock = Utils.StrToInt(rblIsLock.SelectedValue, 0); if (cbIsRed.Checked == true) { model.is_red = 1; } else { model.is_red = 0; } model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99); model.user_name = txtUserName.Text.Trim(); model.user_tel = txtUserTel.Text.Trim(); model.email = txtEmail.Text.Trim(); model.site_url = txtSiteUrl.Text.Trim(); model.img_url = txtImgUrl.Text.Trim(); model.is_image = 1; if (string.IsNullOrEmpty(model.img_url)) { model.is_image = 0; } if (bll.Add(model) > 0) { AddAdminLog(OSEnums.ActionEnum.Add.ToString(), "添加友情链接:" + model.title); //记录日志 result = true; } return result; }
private bool DoAdd() { bool result = false; Model.plugins.link model = new Model.plugins.link(); BLL.plugins.link bll = new BLL.plugins.link(); model.title = txtTitle.Text.Trim(); model.is_lock = Utils.StrToInt(rblIsLock.SelectedValue, 0); if (cbIsRed.Checked == true) { model.is_red = 1; } else { model.is_red = 0; } model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99); model.user_name = txtUserName.Text.Trim(); model.user_tel = txtUserTel.Text.Trim(); model.email = txtEmail.Text.Trim(); model.site_url = txtSiteUrl.Text.Trim(); model.img_url = txtImgUrl.Text.Trim(); model.is_image = 1; if (string.IsNullOrEmpty(model.img_url)) { model.is_image = 0; } if (bll.Add(model) > 0) { AddAdminLog(OSEnums.ActionEnum.Add.ToString(), "添加友情链接:" + model.title); //记录日志 result = true; } return(result); }
private void RptBind(string _strWhere, string _orderby) { this.page = OSRequest.GetQueryInt("page", 1); this.txtKeywords.Text = this.keywords; BLL.plugins.link bll = new BLL.plugins.link(); this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); this.rptList.DataBind(); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("list.aspx", "keywords={0}&page={1}", this.keywords, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
//批量审核 protected void lbtnUnLock_Click(object sender, EventArgs e) { ChkAdminLevel("link", OSEnums.ActionEnum.Audit.ToString()); //检查权限 BLL.plugins.link bll = new BLL.plugins.link(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { bll.UpdateField(id, "is_lock=0"); } } AddAdminLog(OSEnums.ActionEnum.Audit.ToString(), "审核友情链接"); //记录日志 Response.Redirect(Utils.CombUrlTxt("list.aspx", "keywords={0}", this.keywords)); }
//保存排序 protected void btnSave_Click(object sender, EventArgs e) { ChkAdminLevel("link", OSEnums.ActionEnum.Edit.ToString()); //检查权限 BLL.plugins.link bll = new BLL.plugins.link(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); int sortId; if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId)) { sortId = 99; } bll.UpdateField(id, "sort_id=" + sortId.ToString()); } AddAdminLog(OSEnums.ActionEnum.Edit.ToString(), "修改友情链接插件排序:"); //记录日志 Response.Redirect(Utils.CombUrlTxt("list.aspx", "keywords={0}", this.keywords)); }
//设置操作 protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e) { ChkAdminLevel("plugin_link", OSEnums.ActionEnum.Edit.ToString()); //检查权限 int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value); BLL.plugins.link bll = new BLL.plugins.link(); Model.plugins.link model = bll.GetModel(id); switch (e.CommandName.ToLower()) { case "lbtnisred": if (model.is_red == 1) { bll.UpdateField(id, "is_red=0"); } else { bll.UpdateField(id, "is_red=1"); } break; } this.RptBind("id>0" + CombSqlTxt(this.keywords), "sort_id asc,add_time desc"); }
private void ShowInfo(int _id) { BLL.plugins.link bll = new BLL.plugins.link(); Model.plugins.link model = bll.GetModel(_id); txtTitle.Text = model.title; if (model.is_red == 1) { cbIsRed.Checked = true; } else { cbIsRed.Checked = false; } rblIsLock.SelectedValue = model.is_lock.ToString(); txtSortId.Text = model.sort_id.ToString(); txtUserName.Text = model.user_name; txtUserTel.Text = model.user_tel; txtEmail.Text = model.email; txtSiteUrl.Text = model.site_url; txtImgUrl.Text = model.img_url; }
//设置操作 protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e) { ChkAdminLevel("plugin_link", OSEnums.ActionEnum.Edit.ToString()); //检查权限 int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value); BLL.plugins.link bll = new BLL.plugins.link(); Model.plugins.link model = bll.GetModel(id); switch (e.CommandName.ToLower()) { case "lbtnisred": if (model.is_red == 1) bll.UpdateField(id, "is_red=0"); else bll.UpdateField(id, "is_red=1"); break; } this.RptBind("id>0" + CombSqlTxt(this.keywords), "sort_id asc,add_time desc"); }