//批量删除 protected void lbtnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("plugin_link", DTEnums.ActionEnum.Delete.ToString()); //检查权限 int sucCount = 0; int errorCount = 0; BLL.link bll = new BLL.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", "keywords={0}", this.keywords)); }
private bool DoAdd() { bool result = false; Model.link model = new Model.link(); BLL.link bll = new BLL.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(DTEnums.ActionEnum.Add.ToString(), "添加友情链接:" + model.title); //记录日志 result = true; } return result; }
private void ShowInfo(int _id) { BLL.link bll = new BLL.link(); Model.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; } }
private bool DoAdd() { bool result = true; Model.link model = new Model.link(); BLL.link bll = new BLL.link(); model.title = txtTitle.Text.Trim(); model.is_lock = int.Parse(rblIsLock.SelectedValue); model.is_red = int.Parse(rblIsRed.SelectedValue); model.sort_id = int.Parse(txtSortId.Text.Trim()); 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) < 1) { result = false; } return result; }
private bool DoEdit(int _id) { bool result = true; BLL.link bll = new BLL.link(); Model.link model = bll.GetModel(_id); model.title = txtTitle.Text.Trim(); model.is_lock = int.Parse(rblIsLock.SelectedValue); model.is_red = int.Parse(rblIsRed.SelectedValue); model.sort_id = int.Parse(txtSortId.Text.Trim()); 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)) { result = false; } return(result); }
private bool DoAdd() { bool result = false; Model.link model = new Model.link(); BLL.link bll = new BLL.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(DTEnums.ActionEnum.Add.ToString(), "添加友情链接:" + model.title); //记录日志 result = true; } return(result); }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("plugin_link", DTEnums.ActionEnum.Delete.ToString()); //检查权限 int sucCount = 0; int errorCount = 0; BLL.link bll = new BLL.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", "keywords={0}", this.keywords), "Success"); }
private bool DoEdit(int _id) { bool result = false; BLL.link bll = new BLL.link(); Model.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.is_image = 1; if (string.IsNullOrEmpty(model.img_url)) { model.is_image = 0; } //判断上传图片 if (this.imgUpload.HasFile) { //上传前先删除原图片 if (!string.IsNullOrEmpty(model.img_url)) { Utils.DeleteFile(model.img_url); } DTcms.Model.upLoad upfile = new Web.UI.UpLoad().fileSaveAs(this.imgUpload.PostedFile, 0, false, false); if (upfile.status > 0) { model.img_url = upfile.path; } } else { //判断是否需要删除原图 if (txtImgUrl.Text.Trim() == "" && !string.IsNullOrEmpty(model.img_url)) { Utils.DeleteFile(model.img_url); } model.img_url = txtImgUrl.Text.Trim(); } if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改友情链接:" + model.title); //记录日志 result = true; } return(result); }
private void RptBind(string _strWhere, string _orderby) { this.page = DTRequest.GetQueryInt("page", 1); this.txtKeywords.Text = this.keywords; BLL.link bll = new BLL.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", "keywords={0}&page={1}", this.keywords, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { BLL.link bll = new BLL.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.Delete(id); } } JscriptMsg("批量删除成功啦!", Utils.CombUrlTxt("index.aspx", "keywords={0}", this.keywords), "Success"); }
//批量审核 protected void lbtnUnLock_Click(object sender, EventArgs e) { BLL.link bll = new BLL.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"); } } JscriptMsg("批量审核成功啦!", Utils.CombUrlTxt("index.aspx", "keywords={0}", this.keywords), "Success"); }
//保存排序 protected void btnSave_Click(object sender, EventArgs e) { BLL.link bll = new BLL.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()); } JscriptMsg("保存排序成功啦!", Utils.CombUrlTxt("index.aspx", "keywords={0}", this.keywords), "Success"); }
private void ShowInfo(int _id) { BLL.link bll = new BLL.link(); Model.link model = bll.GetModel(_id); txtTitle.Text = model.title; rblIsRed.SelectedValue = model.is_red.ToString(); 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 lbtnUnLock_Click(object sender, EventArgs e) { ChkAdminLevel("plugin_link", DTEnums.ActionEnum.Audit.ToString()); //检查权限 BLL.link bll = new BLL.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", "keywords={0}", this.keywords), "Success"); }
//保存排序 protected void lbtnSave_Click(object sender, EventArgs e) { ChkAdminLevel("plugin_link", DTEnums.ActionEnum.Edit.ToString()); //检查权限 BLL.link bll = new BLL.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", "keywords={0}", this.keywords)); }
//保存排序 protected void btnSave_Click(object sender, EventArgs e) { ChkAdminLevel("plugin_link", DTEnums.ActionEnum.Edit.ToString()); //检查权限 BLL.link bll = new BLL.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", "keywords={0}", this.keywords), "Success"); }
//设置操作 protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e) { int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value); BLL.link bll = new BLL.link(); Model.link model = bll.GetModel(id); switch (e.CommandName.ToLower()) { case "ibtnred": 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) { Model.link model = new BLL.link().GetModel(_id); ddlSiteId.SelectedValue = model.site_id.ToString(); 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; }
private void ShowInfo(int _id) { BLL.link bll = new BLL.link(); Model.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; }
//设置操作 protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e) { int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value); BLL.link bll = new BLL.link(); Model.link model = bll.GetModel(id); switch (e.CommandName.ToLower()) { case "ibtnred": 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 RptBind(string _strWhere, string _orderby) { if (!int.TryParse(Request.QueryString["page"] as string, out this.page)) { this.page = 1; } this.txtKeywords.Text = this.keywords; //图表或列表显示 BLL.link bll = new BLL.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", "keywords={0}&page={1}", this.keywords, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
private void link_add(HttpContext context) { StringBuilder strTxt = new StringBuilder(); BLL.link bll = new BLL.link(); Model.link model = new Model.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; }
//批量审核 protected void lbtnUnLock_Click(object sender, EventArgs e) { ChkAdminLevel("plugin_link", DTEnums.ActionEnum.Audit.ToString()); //检查权限 BLL.link bll = new BLL.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", "keywords={0}", this.keywords)); }