Beispiel #1
0
        override protected void OnUpdateValidate()
        {
            var db = new AuthorityRepository();

            if (db.GetEntities <tbRole>(p => p.name == this.name && p.ID != this.ID).Count() > 0)
            {
                throw (new Exception(string.Format("权限组名 \"{0}\" 已经存在,请更换", this.name)));
            }
            return;
        }
Beispiel #2
0
        override protected void OnInsertValidate()
        {
            AuthorityRepository rps = new AuthorityRepository();

            if (rps.GetEntities <tbUser>(p => p.userID == this.userID).Count() > 0)
            {
                throw (new Exception(string.Format("系统中已存在用户名\"{0}\",请使用其他名称", this.userID)));
            }

            return;
        }
Beispiel #3
0
        override protected void OnDeleteValidate()
        {
            var db = new AuthorityRepository();

            if (db.GetEntities <tbUser>(p => p.roleID == this.ID).Count() > 0)
            {
                throw (new Exception(string.Format("权限正在使用,不能删除", this.name)));
            }

            db.Delete <tbPermission>(p => p.roleID == this.ID);
            return;
        }