/// <summary> /// Initialize constructor parameters /// </summary> public WorkflowEventsProcessorConstructorTest() { _decisionTask = Substitute.For <DecisionTask>(); _pollforDecisionTaskRequest = Substitute.For <PollForDecisionTaskRequest>(); _amazonSwf = Substitute.For <IAmazonSimpleWorkflow>(); _workflowBase = Substitute.For <WorkflowBase>("domain", "workflowName", "version", "taskList", _amazonSwf); }
protected override void OnInit(EventArgs e) { IsAuthenticate(); base.OnInit(e); if (TaskInstanceID == Guid.Empty) { throw new Exception("TaskInstanceID not found in QueryString"); } using (var wfs = new WorkflowService()) { TaskInstance = wfs.GetTaskInstanceByID(TaskInstanceID); WorkflowObject = wfs.GetWorkflowBaseByWorkflowCode(TaskInstance.WorkflowInstance.Workflow.WorkflowCode); } if (!IsPostBack) { lblMessage.Text = ""; PopulateTaskActionCombobox(); PopulateHistory(); try { WorkflowObject.FormatFinishTaskPage(this, FinishTaskUIEventsEnum.FT_OnInit, TaskActionIDComboBox, PerformerIDComboBox, TaskInstance, null); } catch (Exception ex) { ShowException(ex); return; } } TaskActionIDComboBox.SelectedIndexChanged += TaskActionIDComboBox_SelectedIndexChanged; }
public WorkflowTests() { _decisionTask = Substitute.For <DecisionTask>(); _decisionTask.WorkflowType = new WorkflowType { Name = "TestWorkflow", Version = "TestVersion" }; _decisionTask.WorkflowExecution = new WorkflowExecution { RunId = "TestRunId", WorkflowId = "" }; var results = new ConcurrentDictionary <int, string>(); results.AddOrUpdate(1, "TestResult", (index, value) => $"{value} - {index}"); _executionContext = WorkflowStateSerializer.Serialize(new WorkflowState() { CurrentStepNumber = 1, NumberOfActions = 1, Results = results }); _pollforDecisionTaskRequest = Substitute.For <PollForDecisionTaskRequest>(); _pollforDecisionTaskRequest.Domain = "TestDomain"; _amazonSwf = Substitute.For <IAmazonSimpleWorkflow>(); _workflow = Substitute.For <WorkflowBase>("domain", _defaultWorkflowName, "version", "taskList", _amazonSwf); }
/// <summary> /// Constructor for the workflow event processor. /// </summary> /// <param name="decisionTask">Decision task passed in from SWF as decision task response.</param> /// <param name="workflow">IEnumerable set of string for workflow name and Type for workflow class.</param> /// <param name="request">The request used to retrieve <paramref name="decisionTask"/>, which will be used to retrieve subsequent history event pages.</param> /// <param name="swfClient">An SWF client.</param> public WorkflowEventsProcessor(DecisionTask decisionTask, WorkflowBase workflow, PollForDecisionTaskRequest request, IAmazonSimpleWorkflow swfClient) { if (decisionTask == null) { throw new ArgumentNullException(nameof(decisionTask)); } if (workflow == null) { throw new ArgumentNullException(nameof(workflow)); } if (request == null) { throw new ArgumentNullException(nameof(request)); } if (swfClient == null) { throw new ArgumentNullException(nameof(swfClient)); } // Store the decision task and allocate a new decision context and event dictionary which // we will use as we walk through the chain of events _decisionTask = decisionTask; _request = request; _decisionContext = new WorkflowDecisionContext(); _swfClient = swfClient; _workflow = workflow; // Set up our events data structure. Events = new WorkflowEventsIterator(ref decisionTask, _request, _swfClient); }
public static WorkflowBase Convert(Session Session, Type ConvertToType, WorkflowBase CurrentObject) { object newObject = Activator.CreateInstance(ConvertToType, Session); CurrentObject.CopyProperties(newObject); for (int i = CurrentObject.Items.Count - 1; i >= 0; i--) { var workflowItem = new WorkflowItem(Session); CurrentObject.Items[i].CopyProperties(workflowItem); (newObject as WorkflowBase).Items.Add(workflowItem); } for (int i = CurrentObject.Attachments.Count - 1; i >= 0; i--) { var workFlowAttachment = new WorkFlowAttachment(Session); CurrentObject.Attachments[i].CopyProperties(workFlowAttachment); (newObject as WorkflowBase).Attachments.Add(workFlowAttachment); } (newObject as WorkflowBase).ChildItems.Add(CurrentObject); (newObject as WorkflowBase).Tracking.Add(CreateTracking(newObject as WorkflowBase, string.Format("Converted from {0}", CurrentObject.No))); return(newObject as WorkflowBase); }
public MakeDecisionTests() { _decisionTask = Substitute.For <DecisionTask>(); _decisionTask.WorkflowType = new WorkflowType { Name = "TestWorkflow", Version = "TestVersion" }; _decisionTask.WorkflowExecution = new WorkflowExecution { RunId = "TestRunId", WorkflowId = "" }; var results = new ConcurrentDictionary <int, string>(); results.AddOrUpdate(1, "TestResult", (key, value) => $"{key} - {value}"); WorkflowStateSerializer.Serialize(new WorkflowState() { CurrentStepNumber = 1, NumberOfActions = 1, Results = results }); _pollforDecisionTaskRequest = Substitute.For <PollForDecisionTaskRequest>(); _pollforDecisionTaskRequest.Domain = "TestDomain"; _amazonSwf = Substitute.For <IAmazonSimpleWorkflow>(); _workflowBase = Substitute.For <WorkflowBase>("domain", "workflowName", "version", "taskList", _amazonSwf); var describeWorkflowExecutionRequest = Substitute.For <DescribeWorkflowExecutionRequest>(); describeWorkflowExecutionRequest.Domain = _pollforDecisionTaskRequest.Domain; describeWorkflowExecutionRequest.Execution = _decisionTask.WorkflowExecution; }
internal void Workflow_CloneTest() { var workflow = new WorkflowBase("domain", "workflowName", "version", "taskList", _amazonSwf); var wfClone = workflow.Clone(); Assert.False(Object.ReferenceEquals(workflow, wfClone)); }
/// <inheritdoc /> /// <summary> /// Class constructor /// </summary> /// <param name="workflow">Workflow originating the capture</param> /// <param name="codec">Capture codec</param> /// <param name="stream">Capture stream</param> /// <param name="options">Optional user-provided options</param> /// <exception cref="NotSupportedException"> /// Thrown When the mimetype is not provided by the codec or is not supported /// </exception> public ClipboardHandler(WorkflowBase workflow, Codec codec, Stream stream, object options) : base(workflow, codec, stream, options) { if (!SupportedMimetypes.Contains(codec.GetMediaType()?.Type)) { throw new NotSupportedException("The media type is unknown or not supported by this handler"); } }
private static WorkflowTracking CreateTracking(Session session, WorkflowBase WorkflowBase, string Description) { WorkflowTracking tracking = new WorkflowTracking(session) { Workflow = WorkflowBase, Description = Description }; return(tracking); }
/// <inheritdoc /> /// <summary> /// Class constructor /// </summary> /// <param name="workflow">Workflow to be edited</param> public WorkflowPropertyDialog(WorkflowBase workflow = null) { InitializeComponent(); Tag = Size; this.tabStrip.ExtendTabs = false; Workflow = workflow ?? new Workflow(); InitializeGeneralPage(); }
public static WorkflowTracking CreateTracking(WorkflowBase WorkflowBase, string Description) { WorkflowTracking tracking = new WorkflowTracking(WorkflowBase.Session) { Workflow = WorkflowBase, Description = Description }; return(tracking); }
public static double CalculateAdditionalAmount(this WorkflowBase Workflow) { if (!Workflow.Session.IsObjectsSaving) { return(Math.Round((Workflow.TotalExcl + Workflow.VATTotal) * (Workflow.AdditionalPercent / 100), 2)); } else { return(0); } }
public static double CalculateDepositAmount(this WorkflowBase Workflow) { if (!Workflow.Session.IsObjectsSaving) { return(Math.Round(Workflow.TotalIncl * (Workflow.DepositPercent / 100), 2)); } else { return(0); } }
public static double CalculateCostTotalIncl(this WorkflowBase Workflow) { if (!Workflow.Session.IsObjectsSaving) { return(Math.Round((Workflow.TotalCostExcl + Workflow.CostVATTotal) + Workflow.AdditionalAmount, 2)); } else { return(0); } }
public static double CalculateCostVATTotal(this WorkflowBase Workflow) { if (!Workflow.Session.IsObjectsSaving) { return(Math.Round(Workflow.Items.Sum(g => g.CostVATTotal - (g.CostVATTotal * Workflow.DiscountPercent / 100)), 2)); } else { return(0); } }
public static double CalculateSubTotalExcl(this WorkflowBase Workflow) { if (!Workflow.Session.IsObjectsSaving) { return(Math.Round(Workflow.Items.Sum(g => g.TotalExcl), 2)); } else { return(0); } }
public static double CalculatePayment(this WorkflowBase Workflow) { if (!Workflow.Session.IsObjectsSaving) { return(Math.Round(Workflow.Payments.ToList().Sum(g => g.Amount), 2)); } else { return(0); } }
public WorkflowEventsProcessorTests() { _decisionTask = Substitute.For <DecisionTask>(); _decisionTask.WorkflowType = new WorkflowType { Name = "TestWorkflow", Version = "TestVersion" }; _decisionTask.WorkflowExecution = new WorkflowExecution { RunId = "TestRunId", WorkflowId = "" }; var results = new ConcurrentDictionary <int, string>(); results.AddOrUpdate(1, "TestResult", UpdateValueFactory); _executionContext = WorkflowStateSerializer.Serialize(new WorkflowState() { CurrentStepNumber = 1, NumberOfActions = 1, Results = results }); _pollforDecisionTaskRequest = Substitute.For <PollForDecisionTaskRequest>(); _pollforDecisionTaskRequest.Domain = "TestDomain"; _amazonSwf = Substitute.For <IAmazonSimpleWorkflow>(); _workflowBase = Substitute.For <WorkflowBase>("domain", "workflowName", "version", "taskList", _amazonSwf); var describeWorkflowExecutionRequest = Substitute.For <DescribeWorkflowExecutionRequest>(); describeWorkflowExecutionRequest.Domain = _pollforDecisionTaskRequest.Domain; describeWorkflowExecutionRequest.Execution = _decisionTask.WorkflowExecution; //_amazonSwf.DescribeWorkflowExecution(describeWorkflowExecutionRequest) // .ReturnsForAnyArgs( // info => // new DescribeWorkflowExecutionResponse() // { // HttpStatusCode = HttpStatusCode.OK, // WorkflowExecutionDetail = new WorkflowExecutionDetail() {LatestExecutionContext = _executionContext} // }); SDK.Workflow.WorkflowEventsProcessor processor = Substitute.For <SDK.Workflow.WorkflowEventsProcessor>(_decisionTask, _workflowBase, _pollforDecisionTaskRequest, _amazonSwf); processor.GetLastExecContext().ReturnsForAnyArgs(info => WorkflowStateSerializer.Deserialize(_executionContext)); //_workflowEventsIterator = Substitute.For<WorkflowEventsIterator>(_decisionTask, _pollforDecisionTaskRequest, // _amazonSwf); }
/// <summary> /// Ceks the connection. /// </summary> /// <returns></returns> private static bool CekConnection() { try { var db1 = new WorkflowBase(); return true; } catch (Exception ex) { MessageBox.Show( string.Format(ex.Message), @"Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } }
public static void ConvertSaved(WorkflowBase TargetObject, WorkflowBase SourceObject) { using (UnitOfWork unitOfWork = new UnitOfWork(TargetObject.Session.DataLayer)) { WorkflowBase sourceObject = unitOfWork.FindObject(SourceObject.GetType(), CriteriaOperator.Parse("Oid == ?", SourceObject.Oid)) as WorkflowBase; WorkflowBase targetObject = unitOfWork.FindObject(TargetObject.GetType(), CriteriaOperator.Parse("Oid == ?", TargetObject.Oid)) as WorkflowBase; sourceObject.WorkFlowTypeConvertedTo = targetObject.WorkFlowType; targetObject.WorkFlowTypeConvertedFrom = sourceObject.WorkFlowType; sourceObject.ChildItems.Add(targetObject as WorkflowBase); sourceObject.Tracking.Add(CreateTracking(sourceObject, string.Format("Converted to {0}", (targetObject as WorkflowBase).GetType().Name))); unitOfWork.CommitTransaction(); } }
private void EnqueueWorkflow(WorkflowBase workflow) { lock (this.workflowQueue) { // If we are unloading the camera, it's safe to clear the workflow queue // if (workflow is UnloadCameraWorkflow) { this.workflowQueue.Clear(); } this.workflowQueue.Enqueue(workflow); } MaybeProcessNextWorkflow(); }
private void MaybeProcessNextWorkflow() { lock (this.workflowQueue) { if ((this.currentWorkflow != null) && (this.currentWorkflow.IsComplete == false)) { return; } if (this.workflowQueue.Count > 0) { this.currentWorkflow = this.workflowQueue.Dequeue(); this.currentWorkflow.Complete += OnWorkflowComplete; ThreadPool.QueueUserWorkItem(new WaitCallback(this.currentWorkflow.Begin)); } } }
public static double CalculateAmountOutstanding(this WorkflowBase Workflow) { if (!Workflow.Session.IsObjectsSaving) { if (Workflow.WorkFlowType == Ignyt.BusinessInterface.WorkFlowType.Purchase) { return(Math.Round(Workflow.CostTotalIncl - Workflow.PaymentTotal - Workflow.CreditTotal, 2)); } else if (Workflow.WorkFlowType == Ignyt.BusinessInterface.WorkFlowType.SupplierInvoice) { return(Math.Round(Workflow.CostTotalIncl - Workflow.PaymentTotal - Workflow.CreditTotal, 2)); } else { return(Math.Round(Workflow.TotalIncl - Workflow.PaymentTotal - Workflow.CreditTotal - Workflow.Excess, 2)); } } else { return(0); } }
public static double CalculateCreditTotal(this WorkflowBase Workflow) { if (!Workflow.Session.IsObjectsSaving) { if (Workflow.WorkFlowType == Ignyt.BusinessInterface.WorkFlowType.Purchase) { return(Math.Round(Workflow.ChildItems.Where(g => g.WorkFlowType == Ignyt.BusinessInterface.WorkFlowType.SupplierCreditNote).ToList().Sum(g => g.CostTotalIncl), 2)); } else if (Workflow.WorkFlowType == Ignyt.BusinessInterface.WorkFlowType.SupplierInvoice) { return(Math.Round(Workflow.ChildItems.Where(g => g.WorkFlowType == Ignyt.BusinessInterface.WorkFlowType.SupplierCreditNote).ToList().Sum(g => g.CostTotalIncl), 2)); } else { return(Math.Round(Workflow.ChildItems.Where(g => g.WorkFlowType == Ignyt.BusinessInterface.WorkFlowType.CreditNote).ToList().Sum(g => g.TotalIncl), 2)); } } else { return(0); } }
/// <inheritdoc /> /// <summary> /// Class constructor /// </summary> /// <param name="workflow">Workflow originating the capture</param> /// <param name="codec">Capture codec</param> /// <param name="stream">Capture stream</param> /// <param name="options">Optional user-provided options</param> public FileHandler(WorkflowBase workflow, Codec codec, Stream stream, object options) : base( workflow, codec, stream, options) { string fileExtension = ""; if (codec.GetMediaType() is MediaType mediaType) { fileExtension = mediaType.Extension; } else { Log.Warn("codec does not provide file extension information"); } // add substitution templates this.templates[CommonVariable.Extension] = () => fileExtension; this.templates[CommonVariable.Type] = () => workflow.Type == WorkflowType.Still ? Resources.TemplateHelper_Type_Screenshot : Resources.TemplateHelper_Type_Recording; // construct file name from template string template = Resources.SaveToFile_DefaultNameTemplate; if (options is Dictionary <string, string> optionDict && optionDict.ContainsKey("PathTemplate")) { template = optionDict["PathTemplate"]; } // open stream this.fileName = TemplateHelper.GetString(TemplateHelper.Normalize(template)); Log.Info("opening output file stream: " + this.fileName); if (Path.GetDirectoryName(this.fileName) is string dirName) { Directory.CreateDirectory(dirName); } OutputStream = new FileStream(Environment.ExpandEnvironmentVariables(this.fileName), FileMode.CreateNew); }
protected void LogOutput(TimeSpan totalElapsed, WorkflowBase <TStage, TWorkflowResult, TPattern, TRenderStage> workflow, TWorkflowResult workflowResult) { Logger.LogInfo(""); LogExtraVersion(); LoggerUtils.LogSystemInfo(Logger, CoreName); Logger.LogInfo(""); if (!string.IsNullOrEmpty(workflowResult.RootPath)) { Logger.LogInfo($"{"Scan path or file:",LoggerUtils.Align} {workflowResult.RootPath}"); } string threadCountString = workflowResult.ThreadCount <= 0 ? "default" : workflowResult.ThreadCount.ToString(); Logger.LogInfo($"{"Thread count:",LoggerUtils.Align} {threadCountString}"); Logger.LogInfo($"{"Finish date:",LoggerUtils.Align} {DateTime.Now}"); if (!workflow.Stage.Is(Stage.Match)) { Logger.LogInfo($"{"Stage: ",LoggerUtils.Align} {workflow.Stage}"); } LogMatchesCount(workflowResult); if (workflowResult.ErrorCount > 0) { Logger.LogInfo($"{"Errors count: ",LoggerUtils.Align} {workflowResult.ErrorCount}"); } LogStatistics(workflowResult); Logger.LogInfo(""); Logger.LogInfo($"{"Time elapsed:",LoggerUtils.Align} {totalElapsed.Format()}"); }
public SceneEditorDialog(WorkflowBase pToEdit) { InitializeComponent(); baseClassToEdit = pToEdit; EditWorkflowManager.Instance.EditorGUIHandle = this; }
/// <summary> /// Handles the Click event of the btnSave control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void btnSave_Click(object sender, EventArgs e) { try { var r = new Workflow { WorkflowId = txtID.Text.Trim(), WorkflowDescription = txtDescription.Text.Trim() }; // --- Confirm if (Confirm("Do you want to save this data?") != DialogResult.Yes) return; using (var db = new WorkflowBase()) { if ((_saveMode == SaveMode.AddMode ? db.Save(r) // Save New : db.Update(r)) == 1) // Update ResetData(); } } catch (ArgumentNullException ex) { MessageBox.Show(ex.Message, @"Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } catch (Exception ex) { MessageBox.Show(ex.Message, @"Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } }
/// <summary> /// Handles the Validated event of the txtID control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void txtID_Validated(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtID.Text.Trim())) return; var db = new WorkflowBase(); Workflow r = db.GetById(txtID.Text.Trim()); db.Dispose(); try { txtDescription.Text = r.WorkflowDescription; txtID.Enabled = false; _saveMode = SaveMode.EditMode; } catch (NullReferenceException) { _saveMode = SaveMode.AddMode; } }
/// <summary> /// Handles the Click event of the btnDelete control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void btnDelete_Click(object sender, EventArgs e) { // --- If Not EditMode if (_saveMode != SaveMode.EditMode) return; try { var r = new Workflow { WorkflowId = txtID.Text.Trim() }; var db = new WorkflowBase(); if (Confirm("Are you sure to delete this data?") == DialogResult.Yes) { DialogResult dlg; using (var f = new LogonPresentation()) { dlg = f.ShowDialog(this); } if (dlg == DialogResult.OK) { if ((db.Delete(r) == 1)) ResetData(); } } db.Dispose(); } catch (ArgumentNullException ex) { MessageBox.Show(ex.Message, @"Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } catch (Exception ex) { MessageBox.Show(ex.Message, @"Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } }
/// <summary> /// Constructor for the workflow event processor. /// </summary> /// <param name="decisionTask">Decision task passed in from SWF as decision task response.</param> /// <param name="workflow">IEnumerable set of string for workflow name and Type for workflow class.</param> /// <param name="request">The request used to retrieve <paramref name="decisionTask"/>, which will be used to retrieve subsequent history event pages.</param> /// <param name="swfClient">An SWF client.</param> /// <param name="storageManager">IStorageManager</param> public WorkflowEventsProcessor(DecisionTask decisionTask, WorkflowBase workflow, PollForDecisionTaskRequest request, IAmazonSimpleWorkflow swfClient, IStorageManager storageManager) : this(decisionTask, workflow, request, swfClient) { _storageClient = storageManager; _decisionContext = new WorkflowDecisionContext(_storageClient); }
public WorkflowWorker(WorkflowBase workflow, IAmazonSimpleWorkflow swfClient) { _swfClient = swfClient; _workflow = workflow; }
public WorkflowWorker(WorkflowBase workflow, IAmazonSimpleWorkflow swfClient, IStorageManager storageManager) : this(workflow, swfClient) { _storageClient = storageManager; }
/// <summary> /// Searches the data. /// </summary> private void SearchData() { if (InvokeRequired) { var o = new DelegateThis(SearchData); Invoke(o); } else { string teks = lblDetail.Text.Trim(); if (string.IsNullOrEmpty(teks)) return; XLPassportForm pass = new XLPassportFormBase().GetById(teks); string msg = ""; if (pass != null) { lblHeader.Text = string.Format("Permh. a.n {0}", pass.Name); var db = new WorkflowBase(); Workflow wf = db.GetById(pass.WorkFlowXID.ToString().Trim()); db.Dispose(); msg = wf != null ? wf.WorkflowDescription : "Status tidak diketahui, hubungi petugas!"; } else { msg = "No. Permohonan tidak ditemukan!"; } lblDetail.Text = msg; } }
public ActivityWorkerSimple(WorkflowBase workflow, IAmazonSimpleWorkflow swfClient) : base(workflow, swfClient) { }