Exemplo n.º 1
0
        /// <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.feedback().GetList(top, _where).Tables[0];
            return(dt);
        }
Exemplo n.º 2
0
        /// <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.feedback().GetList(page_size, page_index, _where, "add_time desc", out totalcount).Tables[0];
            return(dt);
        }
Exemplo n.º 3
0
        private void feedback_add(HttpContext context)
        {
            StringBuilder strTxt = new StringBuilder();

            BLL.feedback   bll   = new BLL.feedback();
            Model.feedback model = new Model.feedback();

            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(_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.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)
            {
                context.Response.Write("{\"status\": 1, \"msg\": \"恭喜您,留言提交成功!\"}");
                return;
            }
            context.Response.Write("{\"status\": 0, \"msg\": \"对不起,保存过程中发生错误!\"}");
            return;
        }