コード例 #1
0
        public static string GetCommandDescription (WorkflowCommand command, string nextStateName )
        {
            string description;
            if (_commandNames.TryGetValue(command.Id,out description))
                return description;

            return string.Format("Изменить на {0}", nextStateName);
        }
コード例 #2
0
 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;
 }
コード例 #3
0
        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);
        }
コード例 #4
0
 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;
 }
コード例 #5
0
        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();
            }
        }
コード例 #6
0
        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;
        }
コード例 #7
0
 protected void rollbackEventFired1_Invoked(object sender, ExternalDataEventArgs e)
 {
     DenialEventFired(e);
     LastCommand = WorkflowCommand.Rollback;
 }
コード例 #8
0
 /// <summary>
 /// Стандартный обработчик отказа по ТП
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void technicalDenialEventFired1_Invoked(object sender, ExternalDataEventArgs e)
 {
     DenialEventFired(e);
     LastCommand = WorkflowCommand.DenialByTechnicalCauses;
 }
コード例 #9
0
        /// <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;
        }