Exemplo n.º 1
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            List <T_AccessControlEntity> list = new List <T_AccessControlEntity>();

            //功能权限
            foreach (RepeaterItem item in Repeater1.Items)
            {
                list.Add(GetItemPower(item, "t_sitemenu"));
            }

            //新闻分类权限
            foreach (RepeaterItem item in Repeater2.Items)
            {
                list.Add(GetItemPower(item, "t_group"));
            }

            db.ExecuteCommand("DELETE FROM [T_AccessControl] WHERE role=" + EditID);
            if (db.ExecuteCommand <List <T_AccessControlEntity> >(list, CmdType.INSERT))
            {
                if (Admin.RoleID == EditID)
                {
                    Admin.Update();
                }

                CacheHelper.Delete(ISessionKeys.cache_table_accesscontrol);

                Alert(Label1, "保存成功!", "line1px_3");

                //日志
                T_UserRoleEntity role = db.ExecuteObject <T_UserRoleEntity>("SELECT * FROM [T_UserRole] WHERE id=" + EditID);
                AppendLogs("修改角色:" + role.Name + "权限!", LogsAction.Edit);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 初始化编辑数据
        /// </summary>
        protected void LoadData()
        {
            String           strSql = "SELECT * FROM [T_UserRole] WHERE id=" + EditID;
            T_UserRoleEntity data   = db.ExecuteObject <T_UserRoleEntity>(strSql);

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

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

            if (db.ExecuteCommand <T_UserRoleEntity>(data, cmd))
            {
                if (!IsEdit)
                {
                    this.ClearFromValue();
                }
                else if (EditID == Admin.RoleID)
                {
                    Admin.Update();
                }
                Alert(Label1, "保存成功!", "line1px_3");
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            T_UserRoleEntity data = (T_UserRoleEntity)ViewState["data"];

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

            if (db.ExecuteCommand <T_UserRoleEntity>(data, cmd))
            {
                if (!IsEdit)
                {
                    this.ClearFromValue();
                }

                if (EditID == Admin.RoleID)
                {
                    Admin.Update();
                }
                Alert(Label1, "保存成功!", "line1px_3");

                String text = String.Format("{0}角色:{1}.", IsEdit ? "编辑" : "添加", data.Name);
                AppendLogs(text, IsEdit ? LogsAction.Edit : LogsAction.Create);
            }
        }