private void BindData()
        {
            #region 组装查询条件
            string whereStr  = " 1 = 1 ";
            string _keywords = keywords.Replace("'", "");

            if (!string.IsNullOrEmpty(_keywords))
            {
                if (Utils.IsSafeSqlString(_keywords))
                {
                    whereStr += " and (Title like  '%" + _keywords + "%')";
                }
                else
                {
                    JscriptMsg("搜索关键词中包含危险字符,检索终止!", Utils.CombUrlTxt("Manage.aspx", "keywords={0}", ""));
                    return;
                }
            }
            #endregion

            this.page        = RequestHelper.GetQueryInt("page", 1);
            txtKeywords.Text = this.keywords;
            BLL.common_feedback bll = new BLL.common_feedback();
            this.rptList.DataSource = bll.GetListByPage(whereStr, "ID DESC", this.page, this.pageSize);
            this.rptList.DataBind();

            this.totalCount = bll.GetRecordCount(whereStr);
            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("Manage.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)
        {
            ChkAdminLevel("_ybd_common_feedback", EnumCollection.ActionEnum.Delete.ToString()); //检查权限
            int sucCount   = 0;
            int errorCount = 0;

            BLL.common_feedback bll = new BLL.common_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(EnumCollection.ActionEnum.Delete.ToString(), "删除全局反馈记录" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("Manage.aspx", "keywords={0}", this.keywords));
        }
Exemplo n.º 3
0
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("_ybd_common_feedback", EnumCollection.ActionEnum.Add.ToString()); //检查权限

            #region
            string strError = string.Empty;
            if (txtgroup_id.Text.Trim() == "" || txtgroup_id.Text.Trim().Length > 4)
            {
                strError += "分组id为空或超出长度![br]";
            }
            if (txtuser_id.Text.Trim() == "" || txtuser_id.Text.Trim().Length > 4)
            {
                strError += "反馈者id为空或超出长度![br]";
            }
            if (txtcontents.Text.Trim() == "" || txtcontents.Text.Trim().Length > 255)
            {
                strError += "反馈内容为空或超出长度![br]";
            }
            if (txtadd_time.Text.Trim() == "" || txtadd_time.Text.Trim().Length > 8)
            {
                strError += "反馈时间为空或超出长度![br]";
            }
            if (txtis_read.Text.Trim() == "" || txtis_read.Text.Trim().Length > 4)
            {
                strError += "是否读取为空或超出长度![br]";
            }
            if (txtread_time.Text.Trim() == "" || txtread_time.Text.Trim().Length > 8)
            {
                strError += "读取时间为空或超出长度![br]";
            }

            if (strError != string.Empty)
            {
                JscriptMsg(strError, "", "Error");
                return;
            }
            #endregion

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

            model.group_id  = Convert.ToInt32(txtgroup_id.Text);
            model.user_id   = Convert.ToInt32(txtuser_id.Text);
            model.contents  = Convert.ToString(txtcontents.Text);
            model.add_time  = Convert.ToDateTime(txtadd_time.Text);
            model.is_read   = Convert.ToInt32(txtis_read.Text);
            model.read_time = Convert.ToDateTime(txtread_time.Text);

            int id = bll.Add(model);
            if (id > 0)
            {
                AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加全局反馈记录信息,主键:" + id); //记录日志
                JscriptMsg("添加全局反馈记录信息成功!", "Manage.aspx", "");
            }
            else
            {
                JscriptMsg("保存过程中发生错误!", "");
            }
        }
 private void BindInfo()
 {
     BLL.common_feedback   bll   = new BLL.common_feedback();
     Model.common_feedback model = bll.GetModel(this.id);
     if (model == null)
     {
         JscriptMsg("信息不存在或已被删除!", "back");
         return;
     }
     txtgroup_id.Text  = model.group_id + "";
     txtuser_id.Text   = model.user_id + "";
     txtcontents.Text  = model.contents + "";
     txtadd_time.Text  = model.add_time + "";
     txtis_read.Text   = model.is_read + "";
     txtread_time.Text = model.read_time + "";
 }
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("_ybd_common_feedback", EnumCollection.ActionEnum.Modify.ToString()); //检查权限
            BLL.common_feedback   bll   = new BLL.common_feedback();
            Model.common_feedback model = bll.GetModel(this.id);

            model.group_id  = Convert.ToInt32(txtgroup_id.Text);
            model.user_id   = Convert.ToInt32(txtuser_id.Text);
            model.contents  = Convert.ToString(txtcontents.Text);
            model.add_time  = Convert.ToDateTime(txtadd_time.Text);
            model.is_read   = Convert.ToInt32(txtis_read.Text);
            model.read_time = Convert.ToDateTime(txtread_time.Text);

            if (bll.Update(model))
            {
                AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改全局反馈记录信息,主键:" + id); //记录日志
                JscriptMsg("修改全局反馈记录信息成功!", "Manage.aspx");
            }
            else
            {
                JscriptMsg("保存过程中发生错误!", "");
            }
        }