Exemplo n.º 1
0
        /// <summary>
        /// 初始化编辑数据
        /// </summary>
        protected void LoadData()
        {
            String     sql  = "SELECT * FROM [t_ad] WHERE id=" + EditID;
            T_AdEntity data = db.ExecuteObject <T_AdEntity>(sql);

            ViewState["data"] = data;
            this.SetFormValue(data);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            T_AdEntity data = (T_AdEntity)ViewState["data"];

            data = this.GetFormValue <T_AdEntity>(data);
            CmdType cmd = IsEdit ? CmdType.UPDATE : CmdType.INSERT;

            if (db.ExecuteCommand <T_AdEntity>(data, cmd))
            {
                if (!IsEdit)
                {
                    this.ClearFromValue();
                    T_LogsHelper.Append("添加广告:" + data.Title, Admin.ID);
                }
                else
                {
                    T_LogsHelper.Append("编辑广告:" + data.Title, Admin.ID);
                }
                Alert(Label1, "保存成功!", "line1px_3");
            }
        }