protected internal override void DoOperation() { if (IsRelativeForm == false) { PerformanceMonitorHelper.GetDefaultMonitor().WriteExecutionDuration("CheckCurrentUserInAcl", () => CheckCurrentUserInAcl(WfClientContext.Current.OriginalActivity.Process)); } OnProcessReady(WfClientContext.Current.OriginalActivity.Process); OnPrepareCommandState(WfClientContext.Current.OriginalActivity.Process); SetLockResult lockResult = null; if (WfClientContext.Current.InMoveToMode) { if (LockConfigSetting.GetConfig().Enabled) { PerformanceMonitorHelper.GetDefaultMonitor().WriteExecutionDuration("AddLock", () => { lockResult = WfClientContext.Current.AddFormLock( WfClientContext.Current.OriginalActivity.Process.ResourceID, WfClientContext.Current.OriginalActivity.ID); }); } } PerformanceMonitorHelper.GetDefaultMonitor().WriteExecutionDuration("SetScene", () => SetScene(lockResult)); //需要导航到目标视图 TransferToTargetView(); }
private void SetScene(SetLockResult lockResult) { bool isReadOnly = true; MCS.Library.SOA.DataObjects.OperationType logOpType = MCS.Library.SOA.DataObjects.OperationType.OpenForm; if (lockResult != null && lockResult.Succeed && WfClientContext.Current.InMoveToMode && IsRelativeForm == false) { isReadOnly = false; logOpType = MCS.Library.SOA.DataObjects.OperationType.OpenFormForMove; } //如果流程已经办结,那么检查结束点的场景来决定是否只读 if (WfClientContext.Current.CurrentActivity != null && WfClientContext.Current.CurrentActivity.Process.Status == WfProcessStatus.Completed) { isReadOnly = WfClientContext.Current.CurrentActivity.Descriptor.Scene.IsNullOrEmpty(); } if (isReadOnly) { SetReadOnlyScene(WfClientContext.Current.OriginalActivity); } else { SetSceneByActivity(WfClientContext.Current.CurrentActivity); } WriteOpenFormLog(WfClientContext.Current.CurrentActivity, logOpType); }
/// <summary> /// 根据TrySetLock的结果显示不同的信息 /// </summary> /// <param name="LockOperationResult">操作返回的对象</param> /// <returns></returns> public static string GetTrySetLockOperationResultDetail(SetLockResult lockResult) { string result; string displayName = GetDisplayName(lockResult.PersonID); switch (lockResult.OriginalLockStatus) { case LockStatus.LockedByAnother: result = string.Format(Resources.TryLockedByAnother, displayName); break; case LockStatus.NotLocked: result = Resources.TryNotLocked; break; case LockStatus.LockByAnotherAndExpire: result = string.Format(Resources.TryLockByAnotherAndExpire, displayName); break; case LockStatus.LockedByRight: result = Resources.TryLockedByRight; break; case LockStatus.LockedByRightAndExpire: result = Resources.TryLockedByRightAndExpire; break; default: result = string.Empty; break; } return(result); }
/// <summary> /// 添加表单锁 /// </summary> /// <param name="formID">表单ID</param> /// <returns>加锁的结果</returns> public SetLockResult AddFormLock(string formID) { Lock formLockInfo = new Lock(formID, DeluxeIdentity.CurrentUser.ID); SetLockResult lockResult = LockAdapter.SetLock(formLockInfo); if (lockResult.Succeed) { this._Locks.Add(lockResult.NewLock); } return(lockResult); }
/// <summary> /// 添加表单锁 /// </summary> /// <param name="formID">表单ID</param> /// <param name="activityID">工作流节点ID</param> /// <returns>加锁的结果</returns> public SetLockResult AddFormLock(string formID, string activityID) { Lock formLockInfo = new Lock(formID, DeluxeIdentity.CurrentUser.ID); SetLockResult finalResult = null; using (TransactionScope scope = TransactionScopeFactory.Create()) { SetLockResult formLockResult = LockAdapter.SetLock(formLockInfo); if (formLockResult.Succeed == false && formLockResult.OriginalLock.LockType == LockType.AdminLock) { scope.Complete(); return(formLockResult); } if (formLockResult.Succeed) { this._Locks.Add(formLockResult.NewLock); } Lock activityLockInfo = new Lock(activityID, formID, DeluxeIdentity.CurrentUser.ID); activityLockInfo.LockType = LockType.ActivityLock; SetLockResult activityLockResult = LockAdapter.SetLock(activityLockInfo); if (activityLockResult.Succeed) { this._Locks.Add(activityLockResult.NewLock); } if (formLockResult.Succeed) { finalResult = formLockResult; } else { finalResult = activityLockResult; } scope.Complete(); this._LockResult = finalResult; return(finalResult); } }
/// <summary> /// 添加管理员锁 /// </summary> /// <param name="formID">表单锁</param> /// <param name="forceLock">是否强制加锁</param> /// <returns>加锁的结果</returns> public SetLockResult AddAdminLock(string formID, bool forceLock) { Lock adminLockInfo = new Lock(formID, DeluxeIdentity.CurrentUser.ID); adminLockInfo.LockType = LockType.AdminLock; SetLockResult adminLockResult = null; using (TransactionScope scope = TransactionScopeFactory.Create()) { adminLockResult = LockAdapter.SetLock(adminLockInfo, forceLock); if (adminLockResult.Succeed) { this._Locks.Add(adminLockResult.NewLock); } scope.Complete(); return(adminLockResult); } }