private void ShowInfo(int _id) { BLL.plugin_link bll = new BLL.plugin_link(); Model.plugin_link model = bll.GetModel(_id); ddlSitePath.SelectedValue = model.site_path; 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; if (!string.IsNullOrEmpty(model.img_url)) { ImgDiv.Visible = true; ImgUrl.ImageUrl = model.img_url; } }
//批量删除 protected void lbtnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("plugin_link", DTEnums.ActionEnum.Delete.ToString()); //检查权限 int sucCount = 0; int errorCount = 0; BLL.plugin_link bll = new BLL.plugin_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(DTEnums.ActionEnum.Delete.ToString(), "删除友情链接成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志 JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("index.aspx", "site_id={0}&property={1}&keywords={2}", this.site_id.ToString(), this.property.ToString(), this.keywords)); }
/// <summary> /// 图文分页列表 /// </summary> /// <param name="page_size">页面大小</param> /// <param name="page_index">当前页码</param> /// <param name="strwhere">查询条件</param> /// <param name="totalcount">总记录数</param> /// <returns>DateTable</returns> public DataTable get_link_list(int page_size, int page_index, string strwhere, out int totalcount) { DataTable dt = new DataTable(); string _where = "is_lock=0"; if (!string.IsNullOrEmpty(strwhere)) { _where += " and " + strwhere; } dt = new BLL.plugin_link().GetList(page_size, page_index, _where, "sort_id asc,add_time desc", out totalcount).Tables[0]; return(dt); }
/// <summary> /// 友情链接列表 /// </summary> /// <param name="top">显示条数</param> /// <param name="strwhere">查询条件</param> /// <returns>DataTable</returns> public DataTable get_link_list(int top, string strwhere) { DataTable dt = new DataTable(); string _where = "is_lock=0"; if (!string.IsNullOrEmpty(strwhere)) { _where += " and " + strwhere; } dt = new BLL.plugin_link().GetList(top, _where).Tables[0]; return(dt); }
private void RptBind(string _strWhere, string _orderby) { this.page = DTRequest.GetQueryInt("page", 1); this.txtKeywords.Text = this.keywords; BLL.plugin_link bll = new BLL.plugin_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("index.aspx", "site_id={0}&property={1}&keywords={2}&page={3}", this.site_id.ToString(), this.property.ToString(), this.keywords, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
//批量审核 protected void lbtnUnLock_Click(object sender, EventArgs e) { ChkAdminLevel("plugin_link", DTEnums.ActionEnum.Audit.ToString()); //检查权限 BLL.plugin_link bll = new BLL.plugin_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(DTEnums.ActionEnum.Audit.ToString(), "审核友情链接"); //记录日志 JscriptMsg("批量审核成功!", Utils.CombUrlTxt("index.aspx", "site_id={0}&property={1}&keywords={2}", this.site_id.ToString(), this.property.ToString(), this.keywords)); }
//保存排序 protected void lbtnSave_Click(object sender, EventArgs e) { ChkAdminLevel("plugin_link", DTEnums.ActionEnum.Edit.ToString()); //检查权限 BLL.plugin_link bll = new BLL.plugin_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(DTEnums.ActionEnum.Edit.ToString(), "修改友情链接插件排序:"); //记录日志 JscriptMsg("保存排序成功!", Utils.CombUrlTxt("index.aspx", "site_id={0}&property={1}&keywords={2}", this.site_id.ToString(), this.property.ToString(), this.keywords)); }
//设置操作 protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e) { ChkAdminLevel("plugin_link", DTEnums.ActionEnum.Edit.ToString()); //检查权限 int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value); BLL.plugin_link bll = new BLL.plugin_link(); Model.plugin_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.property, this.keywords), "sort_id asc,add_time desc"); }
private bool DoEdit(int _id) { bool result = false; BLL.plugin_link bll = new BLL.plugin_link(); Model.plugin_link model = bll.GetModel(_id); model.site_path = ddlSitePath.SelectedValue; 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.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改友情链接:" + model.title); //记录日志 result = true; } return(result); }
private void link_add(HttpContext context) { StringBuilder strTxt = new StringBuilder(); BLL.plugin_link bll = new BLL.plugin_link(); Model.plugin_link model = new Model.plugin_link(); string _site_path = DTRequest.GetQueryString("site"); string _code = DTRequest.GetFormString("txtCode"); string _title = DTRequest.GetFormString("txtTitle"); string _user_name = DTRequest.GetFormString("txtUserName"); string _user_tel = DTRequest.GetFormString("txtUserTel"); string _email = DTRequest.GetFormString("txtEmail"); string _site_url = DTRequest.GetFormString("txtSiteUrl"); string _img_url = DTRequest.GetFormString("txtImgUrl"); //检查站点目录 if (string.IsNullOrEmpty(_site_path)) { context.Response.Write("{\"status\":0, \"msg\":\"对不起,网站传输参数有误!\"}"); return; } //校检验证码 if (string.IsNullOrEmpty(_code)) { context.Response.Write("{\"status\":0, \"msg\":\"对不起,请输入验证码!\"}"); return; } if (context.Session[DTKeys.SESSION_CODE] == null) { context.Response.Write("{\"status\":0, \"msg\":\"对不起,系验证码已过期!\"}"); return; } if (_code.ToLower() != (context.Session[DTKeys.SESSION_CODE].ToString()).ToLower()) { context.Response.Write("{\"status\":0, \"msg\":\"验证码与系统的不一致!\"}"); return; } if (string.IsNullOrEmpty(_title)) { context.Response.Write("{\"status\": 0, \"msg\": \"对不起,请输入网站标题!\"}"); return; } if (string.IsNullOrEmpty(_site_url)) { context.Response.Write("{\"status\": 0, \"msg\": \"对不起,请输入网站网址!\"}"); return; } model.site_path = Utils.DropHTML(_site_path); model.title = Utils.DropHTML(_title); model.is_lock = 1; model.is_red = 0; model.user_name = Utils.DropHTML(_user_name); model.user_tel = Utils.DropHTML(_user_tel); model.email = Utils.DropHTML(_email); model.site_url = Utils.DropHTML(_site_url); model.img_url = Utils.DropHTML(_img_url); model.is_image = 1; if (string.IsNullOrEmpty(model.img_url)) { model.is_image = 0; } if (bll.Add(model) > 0) { context.Response.Write("{\"status\": 1, \"msg\": \"恭喜您,提交成功!\"}"); return; } context.Response.Write("{\"status\": 0, \"msg\": \"对不起,保存过程中发生错误!\"}"); return; }