private void feedback_list(HttpContext context) { int page = DTRequest.GetFormInt("page", 1); int pageSize = DTRequest.GetFormInt("size", 10); string site_path = Utils.SafeXXS(DTRequest.GetQueryString("site").Trim()); if (string.IsNullOrWhiteSpace(site_path)) { context.Response.Write("{\"status\": 0, \"msg\": \"对不起,参数错误!\"}"); return; } int totalcount = 0; DataTable dt = new BLL.plugin_feedback().GetList(pageSize, page, "is_lock=0 and site_path='" + site_path + "'", "add_time desc", out totalcount).Tables[0]; dt.Columns.Remove("user_tel"); dt.Columns.Remove("user_qq"); dt.Columns.Remove("user_email"); dt.Columns.Remove("row_number"); dt.Columns.Remove("site_path"); JsonHelper.WriteJson(context, new { status = 1, msg = "获取留言列表成功!", total = totalcount, list = dt } ); }
//批量删除 protected void lbtnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("plugin_feedback", DTEnums.ActionEnum.Delete.ToString()); int sucCount = 0; int errorCount = 0; BLL.plugin_feedback bll = new BLL.plugin_feedback(); 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)); }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { ChkAdminLevel("plugin_feedback", DTEnums.ActionEnum.Reply.ToString()); //检查权限 BLL.plugin_feedback bll = new BLL.plugin_feedback(); model = bll.GetModel(this.id); model.reply_content = Utils.ToHtml(txtReContent.Text); model.reply_time = DateTime.Now; bll.Update(model); AddAdminLog(DTEnums.ActionEnum.Reply.ToString(), "回复留言插件内容:" + model.title); //记录日志 JscriptMsg("留言回复成功!", "index.aspx"); }
/// <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_feedback_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_feedback().GetList(page_size, page_index, _where, "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_feedback_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_feedback().GetList(top, _where, "add_time desc").Tables[0]; return(dt); }
//批量审核 protected void lbtnUnLock_Click(object sender, EventArgs e) { ChkAdminLevel("plugin_feedback", DTEnums.ActionEnum.Audit.ToString()); BLL.plugin_feedback bll = new BLL.plugin_feedback(); 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)); }
//数据绑定 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.plugin_feedback bll = new BLL.plugin_feedback(); 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 feedback_add(HttpContext context) { StringBuilder strTxt = new StringBuilder(); BLL.plugin_feedback bll = new BLL.plugin_feedback(); Model.plugin_feedback model = new Model.plugin_feedback(); string _site_path = DTRequest.GetQueryString("site"); string _code = DTRequest.GetFormString("txtCode"); string _title = DTRequest.GetFormString("txtTitle"); string _content = DTRequest.GetFormString("txtContent"); string _user_name = DTRequest.GetFormString("txtUserName"); string _user_tel = DTRequest.GetFormString("txtUserTel"); string _user_qq = DTRequest.GetFormString("txtUserQQ"); string _user_email = DTRequest.GetFormString("txtUserEmail"); //检查站点目录 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(_content)) { context.Response.Write("{\"status\": 0, \"msg\": \"对不起,请输入留言的内容!\"}"); return; } model.site_path = Utils.DropHTML(_site_path); model.title = Utils.DropHTML(_title); model.content = Utils.ToHtml(_content); model.user_name = Utils.DropHTML(_user_name); model.user_tel = Utils.DropHTML(_user_tel); model.user_qq = Utils.DropHTML(_user_qq); model.user_email = Utils.DropHTML(_user_email); model.add_time = DateTime.Now; model.is_lock = 1; //不需要审核,请改为0 if (bll.Add(model) > 0) { //是否开启通知功能 if (config.bookmsg > 0 && config.receive != "") { switch (config.bookmsg) { case 1: DTcms.Model.sms_template smsModel = new DTcms.BLL.sms_template().GetModel(config.booktemplet); //取得短信内容 if (smsModel != null) { //替换模板内容 string smstxt = smsModel.content; smstxt = smstxt.Replace("{webname}", siteConfig.webname); smstxt = smstxt.Replace("{webtel}", siteConfig.webtel); smstxt = smstxt.Replace("{weburl}", siteConfig.weburl); smstxt = smstxt.Replace("{username}", model.user_name); smstxt = smstxt.Replace("{usertel}", model.user_tel); smstxt = smstxt.Replace("{userqq}", model.user_qq); smstxt = smstxt.Replace("{useremail}", model.user_email); smstxt = smstxt.Replace("{usertitle}", model.title); smstxt = smstxt.Replace("{usercontent}", model.content); //发送短信 string tipMsg = string.Empty; bool result = new DTcms.BLL.sms_message().Send(config.receive, smstxt, 1, out tipMsg); if (!result) { LogHelper.WriteLog("手机信息发送失败!"); } } break; case 2: //获得邮件内容 DTcms.Model.mail_template mailModel = new DTcms.BLL.mail_template().GetModel(config.booktemplet); if (mailModel != null) { //替换模板内容 string titletxt = mailModel.maill_title; string bodytxt = mailModel.content; titletxt = titletxt.Replace("{webname}", siteConfig.webname); titletxt = titletxt.Replace("{username}", model.user_name); bodytxt = bodytxt.Replace("{webname}", siteConfig.webname); bodytxt = bodytxt.Replace("{webtel}", siteConfig.webtel); bodytxt = bodytxt.Replace("{weburl}", siteConfig.weburl); bodytxt = bodytxt.Replace("{username}", model.user_name); bodytxt = bodytxt.Replace("{usertel}", model.user_tel); bodytxt = bodytxt.Replace("{userqq}", model.user_qq); bodytxt = bodytxt.Replace("{useremail}", model.user_email); bodytxt = bodytxt.Replace("{usertitle}", model.title); bodytxt = bodytxt.Replace("{usercontent}", model.content); //循环发送 string[] emailArr = config.receive.Split(','); foreach (string email in emailArr) { if (DTcms.Common.Utils.IsValidEmail(email)) { //发送邮件 try { DTMail.sendMail(siteConfig.emailsmtp, siteConfig.emailssl, siteConfig.emailusername, DESEncrypt.Decrypt(siteConfig.emailpassword, siteConfig.sysencryptstring), siteConfig.emailnickname, siteConfig.emailfrom, email, titletxt, bodytxt); } catch { LogHelper.WriteLog("邮件发送失败!"); } } } } break; } } context.Response.Write("{\"status\": 1, \"msg\": \"恭喜您,留言提交成功!\"}"); return; } context.Response.Write("{\"status\": 0, \"msg\": \"对不起,保存过程中发生错误!\"}"); return; }
//赋值操作 private void ShowInfo(int _id) { BLL.plugin_feedback bll = new BLL.plugin_feedback(); model = bll.GetModel(_id); txtReContent.Text = Utils.ToTxt(model.reply_content); }