private void detach_DemandTransitionHistories1(DemandTransitionHistory entity) { this.SendPropertyChanging(); entity.SecurityTrustee1 = null; }
private void detach_DemandTransitionHistories(DemandTransitionHistory entity) { this.SendPropertyChanging(); entity.Demand = null; }
private void attach_DemandTransitionHistories(DemandTransitionHistory entity) { this.SendPropertyChanging(); entity.SecurityTrustee = this; }
private void attach_DemandTransitionHistories(DemandTransitionHistory entity) { this.SendPropertyChanging(); entity.InitialState = this; }
private void detach_DemandTransitionHistories1(DemandTransitionHistory entity) { this.SendPropertyChanging(); entity.DemandStatusInternal1 = null; }
partial void DeleteDemandTransitionHistory(DemandTransitionHistory instance);
partial void UpdateDemandTransitionHistory(DemandTransitionHistory instance);
partial void InsertDemandTransitionHistory(DemandTransitionHistory instance);
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 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(); } }