protected override void OnSaving() { QueryLevel found = GetQueryLevel(this.姓名, this.公司编码, this.职务等级); if (found != null && found.标识 != this.标识) { throw new Exception("用户已具备这个职等的权限,不能重复设置."); } else { base.OnSaving(); } }
/// <summary> /// 通过 Id 获取线路 /// </summary> /// <param name="id"></param> /// <returns></returns> public static QueryLevel GetQueryLevel(Guid id) { QueryLevel obj = (QueryLevel)Session.DefaultSession.GetObjectByKey(typeof(QueryLevel), id); return(obj); }