Пример #1
0
        /// <summary>
        /// 初始化编辑数据
        /// </summary>
        protected void LoadData()
        {
            String        sql  = "SELECT * FROM [t_links] WHERE id=" + EditID;
            T_LinksEntity data = db.ExecuteObject <T_LinksEntity>(sql);

            ViewState["data"] = data;
            this.SetFormValue(data);
        }
Пример #2
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            T_LinksEntity data = (T_LinksEntity)ViewState["data"];

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

            if (db.ExecuteCommand <T_LinksEntity>(data, cmd))
            {
                if (!IsEdit)
                {
                    this.ClearFromValue();
                    T_LogsHelper.Append("添加友情连接:" + data.LinkName, Admin.ID);
                }
                else
                {
                    T_LogsHelper.Append("编辑友情连接:" + data.LinkName, Admin.ID);
                }
                Alert(Label1, "保存成功!", "line1px_3");
            }
        }