Web/Admin/Contents/Edit.aspx.cs

(完整代码) 2KB

using System;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Common;

namespace Web.Admin.Contents
{
    public partial class Edit : Web.UI.ManagePage
    {
        public int Id;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!int.TryParse(Request.Params["id"] as string, out this.Id))
            {
                JscriptMsg(350, 230, "错误提示", "<b>出现错误啦!</b>您要修改的信息不存在或参数不正确。", "back", "Error");
                return;
            }
            if (!Page.IsPostBack)
            {
                chkLoginLevel("editContents");
                //绑定类别
                ChannelTreeBind(0, "请选择所属类别...", (int)Channel.Contents, this.ddlClassId);
                ShowInfo(this.Id);
            }
        }

        //赋值操作
        private void ShowInfo(int _id)
        {
            BLL.Contents bll = new BLL.Contents();
            Model.Contents model = bll.GetModel(_id);
            txtCallIndex.Text = model.CallIndex;
            txtTitle.Text = model.Title;
            ddlClassId.SelectedValue = model.ClassId.ToString();
            txtSortId.Text = model.SortId.ToString();
            txtContent.Value = model.Content;
        }

        //保存
        protected void btnSave_Click(object sender, EventArgs e)
        {
            BLL.Contents bll = new BLL.Contents();
            Model.Contents model = bll.GetModel(this.Id);
            model.CallIndex = txtCallIndex.Text.Trim();
            model.Title = txtTitle.Text.Trim();
            model.ClassId = int.Parse(ddlClassId.SelectedValue);
            model.Content = txtContent.Value;
            model.SortId = int.Parse(txtSortId.Text.Trim());
            bll.Update(model);
            //保存日志
            SaveLogs("[内容模块]编辑内容页:" + model.Title);
            JscriptPrint("内容编辑成功啦!", "List.aspx", "Success");
        }

    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。