Esempio n. 1
0
        private void NewRole()
        {
            var role = new TB_Role();

            role.AddTime         = DateTime.Now;
            role.Description     = txtDescription.Value.Trim();
            role.IsAdministrator = cbIsAdmin.Checked;
            role.IsDefault       = cbIsDefault.Checked;
            role.Name            = txtName.Value.Trim();
            role.Delete          = false;
            role.Permission      = PermissionInstance.GetDefaultMenus();
            RoleInstance.Add(role);

            // 记录历史
            var his = new TB_AccountHistory();

            his.Account  = Account.id;
            his.ActionId = ActionInstance.Find(f => f.Name.Equals("AddRole")).id;
            his.Ip       = Utility.GetClientIP(this.Context);
            his.ObjectA  = "[id=" + role.id + "] " + role.Name;
            SaveHistory(his);

            ShowNotification("./role_list.aspx", "Success: You added a new role.", true);
        }