public static string GetCommandDescription (WorkflowCommand command, string nextStateName ) { string description; if (_commandNames.TryGetValue(command.Id,out description)) return description; return string.Format("Изменить на {0}", nextStateName); }
public UpdateBillDemandStateParams(WorkflowState initialState, WorkflowState destinationState, WorkflowCommand command, Guid billDemandUid, Guid initiatorId, Guid? impesonatedIdentityId, string comment) { _initialState = initialState; _destinationState = destinationState; _command = command; _billDemandUid = billDemandUid; _initiatorId = initiatorId; _impesonatedIdentityId = impesonatedIdentityId; _comment = comment; }
private void WritePreHistory(Guid demandId, Budget2DataContext context, WorkflowState initialState, WorkflowState destinationState, Guid? expectedInitiatorId, WorkflowCommand command, WorkflowState startState) { if (initialState.Order < startState.Order) return; var billDemndHistoryItem = new DemandTransitionHistory { Id = Guid.NewGuid(), DemandId = demandId, DestinationStateId = destinationState.DbStateId.Value, InitialStateId = initialState.DbStateId.Value, TransitionExpectedInitiatorId = expectedInitiatorId, CommandId = command.Id, Comment = string.Empty, Description = string.Empty }; context.DemandTransitionHistories.InsertOnSubmit(billDemndHistoryItem); }
public UpdateBillDemandStateParams(WorkflowState initialState, WorkflowState destinationState, WorkflowCommand command, Guid billDemandUid, Guid initiatorId, Guid? impesonatedIdentityId, string comment, DateTime sightingTime) : this(initialState,destinationState,command,billDemandUid,initiatorId,impesonatedIdentityId,comment) { _sightingTime = sightingTime; }
public void UpdateDemandState(WorkflowState initialState, WorkflowState destinationState, WorkflowCommand command, Guid demandId, Guid initiatorId, string comment) { if (!initialState.DbStateId.HasValue) throw new ArgumentException( "Не определено соттветствие состояния Workflow отображаемому состоянию Demand", "initialState"); if (!destinationState.DbStateId.HasValue) throw new ArgumentException( "Не определено соттветствие состояния Workflow отображаемому состоянию Demand", "destinationState"); using (var scope = ReadUncommittedSupressedScope) { using (var context = CreateContext()) { var demandHistoryItem = context.DemandTransitionHistories.Where( p => p.DemandId == demandId && p.InitialStateId == initialState.DbStateId.Value && p.DestinationStateId == destinationState.DbStateId.Value && (p.CommandId == command.Id || command.SkipCheckCommandId) && !p.TransitionInitiatorId.HasValue).ToList().FirstOrDefault(); if (demandHistoryItem == null) { demandHistoryItem = new DemandTransitionHistory() { Id = Guid.NewGuid(), DemandId = demandId, DestinationStateId = destinationState.DbStateId.Value, InitialStateId = initialState.DbStateId.Value, CommandId = (command.Id == WorkflowCommand.Unknown.Id ? (Guid?) null : command.Id), }; context.DemandTransitionHistories.InsertOnSubmit(demandHistoryItem); } demandHistoryItem.TransitionInitiatorId = initiatorId; demandHistoryItem.TransitionTime = DateTime.Now; demandHistoryItem.Comment = comment; var info = WorkflowStateService.GetWorkflowStateInfo(destinationState); demandHistoryItem.Description = WorkflowCommand.GetCommandDescription(command, info == null ? string.Empty : info.StateVisibleName); context.SubmitChanges(); } scope.Complete(); } }
protected void SetStateIfParcelExists () { var parcel = Budget2WorkflowRuntime.WorkflowParcelService.GetAndRemoveParcel(WorkflowInstanceId); if (parcel == null) return; if (!string.IsNullOrEmpty(parcel.Comment)) { Comment = parcel.Comment; } if (parcel.PreviousWorkflowState != null) PreviousWorkflowState = parcel.PreviousWorkflowState; TransitionInitiator = parcel.InitiatorId; LastCommand = parcel.Command; }
protected void rollbackEventFired1_Invoked(object sender, ExternalDataEventArgs e) { DenialEventFired(e); LastCommand = WorkflowCommand.Rollback; }
/// <summary> /// Стандартный обработчик отказа по ТП /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void technicalDenialEventFired1_Invoked(object sender, ExternalDataEventArgs e) { DenialEventFired(e); LastCommand = WorkflowCommand.DenialByTechnicalCauses; }
/// <summary> /// Стандартный обработчик прямого движения документа /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void forvadTransitionEventInvoked(object sender, ExternalDataEventArgs e) { var workflowEventArgs = e as WorkflowEventArgsWithInitiator; if (workflowEventArgs == null) return; TransitionInitiator = workflowEventArgs.InitiatorId; ImpersonatedIdentityId = workflowEventArgs.ImpersonatedIdentityId; LastCommand = WorkflowCommand.Sighting; }