/// <summary> /// 修改应用(同时修改类型为1,对应权限的名称) /// </summary> public void DoUpdate() { this.DoValidate(); SysAuth[] auths = this.GetRelatedAuth(); using (TransactionScope trans = new TransactionScope()) { try { this.UpdateAndFlush(); if (auths.Length > 0) { foreach (SysAuth auth in auths) { auth.UpdateByApplication(this); } } else { SysAuth auth = new SysAuth(); auth.CreateByApplication(this); } trans.VoteCommit(); } catch (Exception ex) { trans.VoteRollBack(); throw ex; } } }
/// <summary> /// 创建应用(将同时生成一条Type为1的权限信息) /// </summary> public void DoCreate() { this.DoValidate(); using (TransactionScope trans = new TransactionScope()) { try { // 事务开始 this.CreateAndFlush(); SysAuth auth = new SysAuth(); auth.CreateByApplication(this); trans.VoteCommit(); } catch (Exception ex) { trans.VoteRollBack(); throw ex; } } }