Exemplo n.º 1
0
        //设置操作
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            ChkAdminLevel("news_list", DTEnums.ActionEnum.Edit.ToString()); //检查权限
            int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value);

            BLL.news   bll   = new BLL.news();
            Model.news model = bll.GetModel(id);
            switch (e.CommandName)
            {
            case "lbtnIsMsg":
                if (model.is_msg == 1)
                {
                    bll.UpdateField(id, "is_msg=0");
                }
                else
                {
                    bll.UpdateField(id, "is_msg=1");
                }
                break;

            case "lbtnIsHide":
                if (model.is_hide == 1)
                {
                    bll.UpdateField(id, "is_hide=0");
                }
                else
                {
                    bll.UpdateField(id, "is_hide=1");
                }
                break;
            }
            this.RptBind("id>0" + CombSqlTxt(this.keywords), "sort asc,time desc,id desc");
        }
Exemplo n.º 2
0
        //保存排序
        protected void btnSave_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("news_list", DTEnums.ActionEnum.Edit.ToString()); //检查权限
            BLL.news bll     = new BLL.news();
            Repeater rptList = new Repeater();

            if (this.rptList1.Visible == true)
            {
                rptList = this.rptList1;
            }
            else
            {
                rptList = this.rptList2;
            }

            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=" + sortId.ToString());
            }
            AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "保存资讯内容排序"); //记录日志
            JscriptMsg("保存排序成功!", Utils.CombUrlTxt("news_list.aspx", "keywords={0}",
                                                   this.keywords));
        }