protected override void Execute(CodeActivityContext context) { var shownewfolderbutton = ShowNewFolderButton.Get(context); var rootfolder = RootFolder.Get(context); var folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog(); folderBrowserDialog.ShowNewFolderButton = shownewfolderbutton; if (string.IsNullOrEmpty(rootfolder)) { rootfolder = Environment.SpecialFolder.Desktop.ToString(); } Enum.TryParse(rootfolder, out Environment.SpecialFolder specialfolder); folderBrowserDialog.RootFolder = specialfolder; System.Windows.Forms.DialogResult result = System.Windows.Forms.DialogResult.Cancel; GenericTools.RunUI(() => { result = folderBrowserDialog.ShowDialog(); }); if (result != System.Windows.Forms.DialogResult.OK) { context.SetValue(Folder, null); return; } context.SetValue(Folder, folderBrowserDialog.SelectedPath); }
protected override void Execute(CodeActivityContext context) { DynamicValue taskdata = context.GetValue(this.Data); DynamicValue MessageId = new DynamicValue(); taskdata.TryGetValue("MessageId", out MessageId); IMessageStore messageStore = strICT.InFlow.Db.StoreHandler.getMessageStore(context.GetValue(cfgSQLConnectionString)); M_Message message = messageStore.getMessageBymsgId(Convert.ToInt32(MessageId.ToString())); //store message-type in GlobalTransition context.SetValue(GlobalTransition, message.Sender_SubjectName + "|" + message.Message_Type); DynamicValue data = DynamicValue.Parse(message.Data); DynamicValue variables = context.GetValue(GlobalVariables); //write message data to GlobalVariables foreach (string i in data.Keys) { DynamicValue value = new DynamicValue(); data.TryGetValue(i, out value); if (variables.ContainsKey(i)) { variables.Remove(i); } variables.Add(i, value); } context.SetValue(GlobalVariables, variables); //mark message in message-store as received messageStore.markMessageAsReceived(message.Id); }
protected override void Execute(CodeActivityContext context) { var text = Text.Get(context); string basepath = Interfaces.Extensions.DataDirectory; string path = System.IO.Path.Combine(basepath, "tessdata"); // 百度OCR var _ocr = new Baidu.Aip.Nlp.Nlp("SYxNNxCZXW6TaarZS2a9oeiH", "MP8OclERWqaKfSrT77majSD9QQkOhN5z"); _ocr.Timeout = 60000;//设置超时时间 //_ocr.Init(path, lang.ToString(), Emgu.CV.OCR.OcrEngineMode.TesseractLstmCombined); //_ocr.PageSegMode = Emgu.CV.OCR.PageSegMode.SparseText; // OpenRPA.Interfaces.Image.Util.SaveImageStamped(ele.element, "OCR"); Bitmap sourceimg = null; var result = _ocr.Ecnet(text); context.SetValue(CorrectText, result["item"]["correct_query"].ToString()); context.SetValue(Score, Convert.ToDouble(result["item"]["score"])); //IEnumerator<ImageElement> _enum = result.ToList().GetEnumerator(); //context.SetValue(_elements, _enum); //bool more = _enum.MoveNext(); //if (more) //{ // context.ScheduleAction(Body, _enum.Current, OnBodyComplete); //} }
protected override void Execute(CodeActivityContext context) { DynamicValue data = context.GetValue(this.Data); //set transition DynamicValue transition = new DynamicValue(); data.TryGetValue("transition", out transition); context.SetValue(GlobalTransition, transition.ToString()); data.Remove("transition"); //write parameters DynamicValue variables = context.GetValue(GlobalVariables); foreach (string i in data.Keys) { DynamicValue value = new DynamicValue(); data.TryGetValue(i, out value); if (variables.ContainsKey(i)) { variables.Remove(i); } variables.Add(i, value); } context.SetValue(GlobalVariables, variables); }
protected override void Execute(CodeActivityContext context) { var startuptime = context.GetValue(this.startuptimestamp); var currentdatetimeutc = DateTime.UtcNow; using (DispatchEngineContainer dec = new DispatchEngineContainer()) { // look for shutdown message(s) bool toshutdown = dec.DispatcherControls.Any(c => c.Cmd == EngineControl.Shutdown && c.TimeStamp >= startuptime); if (toshutdown) { // shutdown cmd found, heading to final state context.SetValue(this.transition, EngineControl.Shutdown); } else if (dec.IrqQueue.Count() > 0) { // go sweep expired schedules & dispatches context.SetValue(this.transition, EngineControl.Interrupt); } else if (dec.DpcQueue.Count() > 0) { // go create missing dispatches context.SetValue(this.transition, EngineControl.Deferred); } else { // poll to find dispatches ready to run or exipred schedules context.SetValue(this.transition, EngineControl.Poll); } } }
// If your activity returns a value, derive from CodeActivity<TResult> // and return the value from the Execute method. protected override void Execute(CodeActivityContext context) { // Obtain the runtime value of the CreditNum input argument string creditNum = context.GetValue(CreditNum); if (creditNum.Substring(0, 1) == "4") // Check if the card is Visa { context.SetValue(Issuer, 3); } else if (creditNum.Substring(0, 2) == "51" && creditNum.Substring(6, 2) == "55") // Check if the card is Mastercard { context.SetValue(Issuer, 3); } else if (creditNum.Substring(0, 4) == "6011" || creditNum.Substring(0, 3) == "644" || creditNum.Substring(0, 2) == "65") //Check if the card is Discovery { context.SetValue(Issuer, 3); } else if (creditNum.Substring(0, 2) == "34" || creditNum.Substring(6, 2) == "37") // Check if the card is American Express { context.SetValue(Issuer, 4); } else { context.SetValue(Issuer, -1); //Other card is not valid } }
protected override void Execute(CodeActivityContext context) { Job job = context.GetValue(this.Job); string connectionStringKeyName = context.GetValue(this.ConnectionStringKeyName); string query = context.GetValue(this.Query); string columnName = context.GetValue(ColumnName); bool isSystemColumn = context.GetValue(IsSystemColumn); bool throwErrorIfNullOrEmpty = context.GetValue(ThrowErrorIfNullOrEmpty); string theResult = string.Empty; if (job != null) { theResult = job.DataSource.Lookup(connectionStringKeyName, query); context.SetValue(Result, theResult); if ((throwErrorIfNullOrEmpty) && (string.IsNullOrEmpty(theResult))) { job.AddContainerError(-1, string.Format("Look up result was empty or null! Connection = '{0}', Query = '{1}'", connectionStringKeyName, query)); } } else { WorkerData data = context.GetValue(this.Data); theResult = data.Job.DataSource.Lookup(connectionStringKeyName, query); new CodeActivityTraceWriter(job, data).WriteLine(string.Format("Lookup:'{0}, Return:'{1}'", query, theResult)); context.SetValue(Result, theResult); if ((throwErrorIfNullOrEmpty) && ((!(string.IsNullOrEmpty(columnName))) && (string.IsNullOrEmpty(theResult)))) { data.CurrentRow.AddError(string.Format("Look up result was empty or null! Connection = '{0}', Query = '{1}'", connectionStringKeyName, query), columnName, isSystemColumn); } } }
// If your activity returns a value, derive from CodeActivity<TResult> // and return the value from the Execute method. protected override void Execute(CodeActivityContext context) { // Obtain the runtime value of the Text input argument try { string url = "http://freegeoip.net/json/"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) { using (StreamReader streamReader = new StreamReader(response.GetResponseStream())) { string jsonStr = streamReader.ReadToEnd(); JObject jObj = JObject.Parse(jsonStr); string ipAddress = jObj["ip"].ToString(); if (Regex.IsMatch(ipAddress, ipRegEx)) { context.SetValue(NewIp, ipAddress); } else { context.SetValue(IsSuccess, false); } } } } catch (Exception) { context.SetValue(IsSuccess, false); } }
protected override void Execute(CodeActivityContext context) { string text = ""; System.Windows.Media.Imaging.BitmapSource image = null; int counter = 0; while (string.IsNullOrEmpty(text) && image == null) { counter++; try { if (SendCtrlC.Get(context)) { var keys = FlaUI.Core.Input.Keyboard.Pressing(FlaUI.Core.WindowsAPI.VirtualKeyShort.LCONTROL, FlaUI.Core.WindowsAPI.VirtualKeyShort.KEY_C); keys.Dispose(); } System.Windows.IDataObject idat = null; Exception threadEx = null; System.Threading.Thread staThread = new System.Threading.Thread(() => { try { if (System.Windows.Clipboard.ContainsText()) { idat = System.Windows.Clipboard.GetDataObject(); text = (string)idat.GetData(typeof(string)); } if (System.Windows.Clipboard.ContainsImage()) { idat = System.Windows.Clipboard.GetDataObject(); image = System.Windows.Clipboard.GetImage(); // var tmp = System.Windows.Clipboard.GetImage(); // image = new ImageElement(tmp); //image = (System.Drawing.Image)idat.GetData(typeof(System.Drawing.Image)); } } catch (Exception ex) { threadEx = ex; } }); staThread.SetApartmentState(System.Threading.ApartmentState.STA); staThread.Start(); staThread.Join(); } catch (Exception ex) { Log.Debug(ex.Message); System.Threading.Thread.Sleep(250); } if (counter == 3) { break; } } context.SetValue(StringResult, text); context.SetValue(ImageResult, image); }
// If your activity returns a value, derive from CodeActivity<TResult> // and return the value from the Execute method. protected override void Execute(CodeActivityContext context) { Data data; if (File.Exists(HttpContext.Current.Server.MapPath("App_Data/users.json"))) { string appData = File.ReadAllText(HttpContext.Current.Server.MapPath("App_Data/users.json")); data = JsonConvert.DeserializeObject <Data>(appData); if (data.containsUserName(context.GetValue(userName))) { context.SetValue(wasSuccessful, false); return; } } else { data = new Data(); } User user = new User(context.GetValue(userName), context.GetValue(password)); data.addUser(user); string json = JsonConvert.SerializeObject(data); File.WriteAllText(HttpContext.Current.Server.MapPath("App_Data/users.json"), json); context.SetValue(wasSuccessful, true); }
/// <summary> /// When implemented in a derived class, performs the execution of the activity. /// </summary> /// <param name="context">The execution context under which the activity executes.</param> protected override void Execute(CodeActivityContext context) { TeamFoundationRequestContext requestContext = context.GetValue(this.TeamFoundationRequestContext); #if UsingILocationService ILocationService tfLocationService = requestContext.GetService <ILocationService>(); Uri uriRequestContext = new Uri(tfLocationService.GetLocationData(requestContext, Guid.Empty).GetServerAccessMapping(requestContext).AccessPoint + "/" + requestContext.ServiceHost.Name); #else var tfLocationService = requestContext.GetService <TeamFoundationLocationService>(); var accessMapping = tfLocationService.GetServerAccessMapping(requestContext); Uri uriRequestContext = new Uri(tfLocationService.GetHostLocation(requestContext, accessMapping)); #endif string strHost = System.Environment.MachineName; string strFQDN = System.Net.Dns.GetHostEntry(strHost).HostName; UriBuilder uriBuilderRequestContext = new UriBuilder(uriRequestContext.Scheme, strFQDN, uriRequestContext.Port, uriRequestContext.PathAndQuery); string teamProjectCollectionUrl = uriBuilderRequestContext.Uri.AbsoluteUri; var teamProjectCollection = new TfsTeamProjectCollection(new Uri(teamProjectCollectionUrl)); string serverUri = teamProjectCollectionUrl; var workItemEvent = context.GetValue(this.WorkItemChangedEvent); int workItemId = workItemEvent.CoreFields.IntegerFields.First(k => k.Name == "ID").NewValue; WorkItemStore workItemStore = GetWorkitemStore(serverUri); var workItem = workItemStore.GetWorkItem(workItemId); context.SetValue(this.ChangedFields, workItemEvent.ChangedFields); context.SetValue(this.WorkItem, workItem); context.SetValue(this.TFSCollectionUrl, serverUri); }
/// <summary> /// 读取配置文件中以上配置节的值 /// </summary> private void ReadAppConfig(CodeActivityContext context) { //为三个输出变量赋值 context.SetValue(SleepTime, int.Parse(ConfigHelper.GetSettingValue("sleepTime"))); var key = ConfigHelper.GetSettingValue("list_id"); context.SetValue(Id_list, key); context.SetValue(Seconds_Interval, double.Parse(ConfigHelper.GetSettingValue("seconds_add"))); //context.SetValue<string>(temp, "123"); }
protected override void Execute(CodeActivityContext context) { var filename = Filename.Get(context); filename = Environment.ExpandEnvironmentVariables(filename); iTextSharp.text.pdf.PdfReader reader = new iTextSharp.text.pdf.PdfReader(filename); context.SetValue(Result, reader); var result = GetTextFromAllPages(reader); context.SetValue(AllText, result); }
protected override void Execute(CodeActivityContext context) { var isSaveAs = IsSaveAs.Get(context); var initialDirectory = InitialDirectory.Get(context); var title = Title.Get(context); var defaultExt = DefaultExt.Get(context); var filter = Filter.Get(context); var filterIndex = FilterIndex.Get(context); var checkFileExists = CheckFileExists.Get(context); var checkPathExists = CheckPathExists.Get(context); var multiselect = Multiselect.Get(context); System.Windows.Forms.FileDialog dialog; if (isSaveAs) { dialog = new System.Windows.Forms.SaveFileDialog(); } else { dialog = new System.Windows.Forms.OpenFileDialog(); ((System.Windows.Forms.OpenFileDialog)dialog).Multiselect = multiselect; } if (!string.IsNullOrEmpty(title)) { dialog.Title = title; } if (!string.IsNullOrEmpty(defaultExt)) { dialog.DefaultExt = defaultExt; } if (!string.IsNullOrEmpty(filter)) { dialog.Filter = filter; dialog.FilterIndex = filterIndex; } dialog.CheckFileExists = checkFileExists; dialog.CheckPathExists = checkPathExists; System.Windows.Forms.DialogResult result = System.Windows.Forms.DialogResult.Cancel; GenericTools.RunUI(() => { result = dialog.ShowDialog(); }); if (result != System.Windows.Forms.DialogResult.OK) { context.SetValue(FileName, null); context.SetValue(FileNames, null); return; } context.SetValue(FileName, dialog.FileName); context.SetValue(FileNames, dialog.FileNames); }
//public InArgument<DownloadItem> inDownloadItem { set; get; } protected override void Execute(CodeActivityContext context) { List <string> list = context.GetValue(List); //DownloadItem di = context.GetValue(inDownloadItem); bool flag = false; int index = 0; foreach (var row in list) { if (!row.Contains(",")) { index++; } else { break; } } /*/----------------------------------------- * * * if(list[4].Contains("ERROR")) * { * string str = string.Empty; * foreach (var row in context.GetValue(List)) * { * * if (!row.Equals("")) * { * str += row; * str += ","; * } * * } * str += string.Format("itemID={0}, promID={1}", di.Id, di.PromotionId); * WriteLogClass.WriteLog(str); * * } * //-----------------------------------------*/ if (index > 0) { list.RemoveRange(0, index); flag = true; } context.SetValue(List, list); context.SetValue(HasChanged, flag); }
// 如果活动返回值,则从 CodeActivity<TResult> // 并从 Execute 方法返回该值。 //qu protected override void Execute(CodeActivityContext context) { // 获取 Text 输入参数的运行时值 string text = context.GetValue(this.Text); var state = context.GetValue(this.Match_Enum); List<SMSModel_QueryReceive> list = context.GetValue(List_QueryReceive); SMSModel_QueryReceive item = context.GetValue(Item); // int state = -1; //将拥有符合条件的msgid的item存入list InsertListModel(item, ref list, ref state); context.SetValue(Match_Enum, state); context.SetValue(List_QueryReceive, list); }
protected override void Execute(CodeActivityContext context) { base.Execute(context); Logger.Info("CheckReserved activity is executing..."); bool bReserved = false; string oldBusiId = ""; string verifyData = context.GetValue(VerifyData); if (string.IsNullOrEmpty(verifyData)) { Logger.Error($"CheckReserved: object of VerifyData is null or empty!"); throw new ApplicationException($"CheckReserved: object of VerifyData null or empty!"); } var jsonObj = JsonConvert.DeserializeObject <Dictionary <string, string> >(verifyData); if (!jsonObj.ContainsKey("reservedH")) { Logger.Error($"Cannot find reservedH key in VerifyData."); throw new ApplicationException("reservedH is not found."); } bReserved = jsonObj["reservedH"] == "Y"; if (bReserved) { if (!jsonObj.ContainsKey("busiIDOld")) { Logger.Error($"Cannot find busiIDOld key in VerifyData."); throw new ApplicationException("busiIDOld is not found."); } oldBusiId = jsonObj["busiIDOld"]; Logger.Info($"檢查確認為保留戶,保留戶原交易序號: {oldBusiId}"); } else { Logger.Info("檢查確認並非為保留戶"); } context.SetValue(IsReserved, bReserved); context.SetValue(OldBusinessId, oldBusiId); Logger.Info("CheckReserved activity executed."); }
protected override void Execute(CodeActivityContext context) { // Mapeamento dos parametros para variaveis: string tfsServer = context.GetValue(this.TFSServer); string tfsCollection = context.GetValue(this.TFSCollection); string tfsProject = context.GetValue(this.TFSProject); string tfsUser = context.GetValue(this.TFSUser); string tfsPassword = context.GetValue(this.TFSPassword); string tfsDomain = context.GetValue(this.TFSDomain); string envEnvironmentName = context.GetValue(this.EnvEnvironmentName); try { #region Client do TFS e Lab Service System.Net.NetworkCredential administratorCredentials = new System.Net.NetworkCredential(tfsUser, tfsPassword, tfsDomain); string tfsName = tfsServer + "/" + tfsCollection; Uri uri = new Uri(tfsName); TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(uri, administratorCredentials); LabService lab = tfs.GetService <LabService>(); if (lab == null) { throw new System.ArgumentOutOfRangeException("Lab Service não encontrado."); } #endregion #region Obtém o ambiente var env = lab.GetLabEnvironments(tfsProject).FirstOrDefault(c => c.Name == envEnvironmentName); if (env != null) { context.TrackBuildMessage("Ambiente encontrado sob URI: '" + env.Uri.ToString() + "'.", BuildMessageImportance.High); context.SetValue(this.Result, env); context.SetValue(this.ResultUri, env.Uri.ToString()); } #endregion } catch (Exception ex) { context.TrackBuildError("Ambiente não pode ser obtido: " + ex.ToString() + "."); } }
protected override void Execute(CodeActivityContext context) { Job job = context.GetValue(this.Job); string connectionStringKeyName = context.GetValue(this.ConnectionStringKeyName); string query = context.GetValue(this.Query); int timeOut = context.GetValue(this.TimeOut); if (timeOut == 0) { timeOut = 5;//default } bool throwErrorIfNullOrEmpty = context.GetValue(ThrowErrorIfNullOrEmpty); bool silent = context.GetValue(Silent); DataTable table = null; if (!silent) { new CodeActivityTraceWriter(job).WriteLine(string.Format("Executing query '{0}' using connection string '{1}'", query, connectionStringKeyName)); } Trace.Flush(); string errorMessage = string.Empty; if (job != null) { table = job.DataSource.LoadDataTable(connectionStringKeyName, query, ref errorMessage, timeOut, silent); } else { WorkerData data = context.GetValue(this.Data); table = data.Job.DataSource.LoadDataTable(connectionStringKeyName, query, ref errorMessage, timeOut, silent); } if (!silent) { new CodeActivityTraceWriter(job).WriteLine(string.Format("Executed query with connection:'{0}', query:'{1}';{2} records.", connectionStringKeyName, query, table.Rows.Count)); } context.SetValue(Result, table); context.SetValue(QueryHasError, string.IsNullOrEmpty(errorMessage) ? false : true); context.SetValue(ErrorMessage, errorMessage); if ((throwErrorIfNullOrEmpty) && (table.Rows.Count == 0)) { job.AddContainerError(-1, string.Format("Execute query's result was empty or null! Connection = '{0}', Query = '{1}'", connectionStringKeyName, query)); } }
protected override void Execute(CodeActivityContext context) { CoreFunctions core = new CoreFunctions(context.GetValue(cfgWFMBaseAddress), context.GetValue(cfgWFMUsername), context.GetValue(cfgWFMPassword), context.GetValue(cfgSQLConnectionString)); string id = core.startNewSubjectProcess(context.GetValue(ProcessInstanceId), context.GetValue(ProcessSubjectId), context.GetValue(Owner)); context.SetValue(NewProcessId, id); }
// If your activity returns a value, derive from CodeActivity<TResult> // and return the value from the Execute method. protected override void Execute(CodeActivityContext context) { // Obtain the runtime value of the Text input argument string text = context.GetValue(this.Text); context.SetValue(UserClickedButton, System.Windows.MessageBox.Show( text, "FIB->FIS Handover", System.Windows.MessageBoxButton.YesNo)); }
protected override void Execute(CodeActivityContext context) { #region Workflow Arguments // This will be the api key or a path to the file with the key in it (or blank) var versionPatternOrSeedFilePath = VersionPatternOrSeedFilePath.Get(context); // The local build directory var packageId = PackageId.Get(context); var sourcesDirectory = SourcesDirectory.Get(context); #endregion string versionPattern; try { versionPattern = ExtractVersion(versionPatternOrSeedFilePath, packageId, QueryPackageId, sourcesDirectory); } catch (ArgumentException) { versionPattern = ExtractVersion(versionPatternOrSeedFilePath, packageId, QuerySolutionName, sourcesDirectory); } // Write to the log context.WriteBuildMessage(string.Format("Version Pattern: {0}", versionPattern), BuildMessageImportance.Normal); // Return the value back to the workflow context.SetValue(VersionPattern, versionPattern); }
protected override void Execute(CodeActivityContext executionContext) { IWorkflowContext context = executionContext.GetExtension <IWorkflowContext>(); IOrganizationServiceFactory serviceFactory = executionContext.GetExtension <IOrganizationServiceFactory>(); IOrganizationService orgService = serviceFactory.CreateOrganizationService(context.InitiatingUserId); Money valorTotal = executionContext.GetValue <Money>(In_Valor_Total); Decimal pctComissao = executionContext.GetValue <Decimal>(In_PctComissao); Money ValorComissao = new Money(0); if (pctComissao >= 0) { ValorComissao.Value = valorTotal.Value * (pctComissao / 100); } else { throw new InvalidPluginExecutionException("comissao não pode ser negativa"); } executionContext.SetValue(Out_ValorComissao, ValorComissao); }
protected override void Execute(CodeActivityContext context) { // Get the connection string DBConnection ext = context.GetExtension <DBConnection>(); if (ext == null) { throw new InvalidProgramException("No connection string available"); } // Lookup the Request RequestDataContext dc = new RequestDataContext(ext.ConnectionString); Request r = dc.Requests.SingleOrDefault(x => x.RequestKey == RequestKey.Get(context)); if (r == null) { throw new InvalidProgramException("The specified request (" + RequestKey.Get(context) + ") was not found"); } // Update the Request record r.ActionTaken = ActionTaken.Get(context); r.RouteNext = RouteNext.Get(context); PersistRequest persist = context.GetExtension <PersistRequest>(); persist.AddRequest(r); context.SetValue(Request, r); }
protected override void Execute(CodeActivityContext context) { var useHeaderRow = false; if (UseHeaderRow != null) { useHeaderRow = UseHeaderRow.Get(context); } string[] delimeters = null; if (Delimeter != null) { var d = Delimeter.Get(context); if (!string.IsNullOrEmpty(d)) { delimeters = new string[] { d }; } } if (delimeters == null || delimeters.Length == 0) { delimeters = new string[] { ",", ";" } } ; System.Data.DataTable result = null; var filename = Filename.Get(context); filename = Environment.ExpandEnvironmentVariables(filename); result = GetDataTabletFromCSVFile(filename, useHeaderRow, delimeters); if (DataTable != null) { context.SetValue(DataTable, result); } } }
// 如果活动返回值,则从 CodeActivity<TResult> // 派生并从 Execute 方法返回该值。 protected override void Execute(CodeActivityContext context) { var httpContent = new StringContent(context.GetValue(内容)); httpContent.Headers.ContentType = new MediaTypeHeaderValue(context.GetValue(MIME类型).GetDescription()); context.SetValue(字符串形式的Http内容, httpContent); }
// If your activity returns a value, derive from CodeActivity<TResult> // and return the value from the Execute method. protected override void Execute(CodeActivityContext context) { // Obtain the runtime value of the Text input argument ItemInfo i = new ItemInfo(); i.ItemCode = context.GetValue<string>(this.ItemCode); switch (i.ItemCode) { case "12345": i.Description = "Widget"; i.Price = (decimal)10.0; break; case "12346": i.Description = "Gadget"; i.Price = (decimal)15.0; break; case "12347": i.Description = "Super Gadget"; i.Price = (decimal)25.0; break; } context.SetValue(this.Item, i); }
protected override void Execute(CodeActivityContext context) { var isValid = new bool?(); var loan = context.GetValue(this.Loan); if (!(loan.CreditRating > 0)) { isValid = false; } if (!(loan.DownPaymentAmount > 0)) { isValid = false; } if (!(loan.LoanAmount > 0)) { isValid = false; } //If we didn't get set to false then we're valid. if(!isValid.HasValue) { isValid = true; } context.SetValue(Valid, isValid); }
/// <inheritdoc /> protected override void Execute(CodeActivityContext context) { var appointmentData = context.GetValue(Appointment) ?? GetAppointmentFromParameters(context); var service = ExchangeHelper.GetService(context.GetValue(OrganizerPassword), context.GetValue(ExchangeUrl), context.GetValue(OrganizerEmail)); var recurrMeeting = new Appointment(service) { Subject = appointmentData.Subject, Body = new MessageBody(appointmentData.IsBodyHtml ? BodyType.HTML : BodyType.Text, appointmentData.Body), Start = appointmentData.StartTime, End = appointmentData.EndTime, Location = appointmentData.Subject, Recurrence = appointmentData.Recurrence }; var requiredAttendees = context.GetValue(RequiredAttendees); var optionalAttendees = context.GetValue(OptionalAttendees); AppointmentHelper.UpdateAttendees(recurrMeeting, requiredAttendees, optionalAttendees); // This method results in in a CreateItem call to EWS. recurrMeeting.Save(SendInvitationsMode.SendToAllAndSaveCopy); context.SetValue(AppointmentId, recurrMeeting.Id); }
// 如果活动返回值,则从 CodeActivity<TResult> // 并从 Execute 方法返回该值。 protected override void Execute(CodeActivityContext context) { // 获取 Text 输入参数的运行时值 string text = context.GetValue(this.Text); context.SetValue(retText, text + "123"); }
// If your activity returns a value, derive from CodeActivity<TResult> // and return the value from the Execute method. protected override void Execute(CodeActivityContext context) { // Obtain the runtime value of the Text input argument string text = context.GetValue(Text); context.SetValue(Output, $"{text} workflow"); }
// If your activity returns a value, derive from CodeActivity<TResult> // and return the value from the Execute method. protected override void Execute(CodeActivityContext context) { // Obtain the runtime value of the Text input argument ItemInfo i = new ItemInfo(); i.ItemCode = context.GetValue <string>(this.ItemCode); switch (i.ItemCode) { case "12345": i.Description = "Widget"; i.Price = (decimal)10.0; break; case "12346": i.Description = "Gadget"; i.Price = (decimal)15.0; break; case "12347": i.Description = "Super Gadget"; i.Price = (decimal)25.0; break; } context.SetValue(this.Item, i); }
protected override void Execute(CodeActivityContext context) { var isValid = new bool?(); var loan = context.GetValue(this.Loan); if (!(loan.CreditRating > 0)) { isValid = false; } if (!(loan.DownPaymentAmount > 0)) { isValid = false; } if (!(loan.LoanAmount > 0)) { isValid = false; } //If we didn't get set to false then we're valid. if (!isValid.HasValue) { isValid = true; } context.SetValue(Valid, isValid); }
// 如果活动返回值,则从 CodeActivity<TResult> // 派生并从 Execute 方法返回该值。 protected override void Execute(CodeActivityContext context) { // 获取 Text 输入参数的运行时值 Guid id = context.WorkflowInstanceId; context.SetValue(currentWorkflowId, id); }
protected override void Execute(CodeActivityContext context) { var timeout = Timeout.Get(context); if (Timeout == null || Timeout.Expression == null) { timeout = TimeSpan.FromSeconds(10); } var key = Key.Get(context); var fileurl = Fileurl.Get(context); var desiredstatus = Status.Get(context).ToLower(); string status = ""; var sw = new Stopwatch(); sw.Start(); do { var res = SimpleRequests.GET(fileurl, key); var o = JObject.Parse(res); status = o["status"].ToString(); if (status != desiredstatus) { System.Threading.Thread.Sleep(1000); } } while (status != desiredstatus && sw.Elapsed < timeout); context.SetValue(Result, status); }
protected override void Execute(CodeActivityContext context) { var key = Key.Get(context); var queue = Queue.Get(context); var fileurl = Fileurl.Get(context); var status = ""; while (status != "to_review" && status != "exported") { var statusres = SimpleRequests.GET(fileurl, key); var statuso = JObject.Parse(statusres); status = statuso["status"].ToString(); } var fileid = fileurl.Substring(fileurl.LastIndexOf("/") + 1); var res = SimpleRequests.GET(queue + "/export?status=exported&format=json&id=" + fileid, key); var results = JsonConvert.DeserializeObject <ExportResult>(res); try { results.LoadGeneralData(); } catch (Exception ex) { Log.Error(ex.ToString()); } context.SetValue(Result, results); }
// アクティビティが値を返す場合は、CodeActivity<TResult> から派生して、 // Execute メソッドから値を返します。 protected override void Execute(CodeActivityContext context) { string text = context.GetValue(this.Target); var result = Convert.ToBase64String(Encoding.GetEncoding("UTF-8").GetBytes(text)); context.SetValue(Base64Data, result); }
protected override void Execute(CodeActivityContext context) { var provider = ServiceLocator.Current.GetInstance<IFlowExtensionProvider>(); var output = provider.NeedConfirmation(); context.SetValue(IsSkip, !output); }
// 如果活动返回值,则从 CodeActivity<TResult> // 派生并从 Execute 方法返回该值。 protected override void Execute(CodeActivityContext context) { var sourceimage = 原图.Get(context); var sim = 相似度下限.Get(context); var width = 查找区域宽度.Get(context); var height = 查找区域高度.Get(context); var etm = new ExhaustiveTemplateMatching(sim==null?0.9f:sim.Value); var match = etm.ProcessImage(sourceimage, context.GetValue(匹配图), new Rectangle(查找区域左偏移量.Get(context), 查找区域上偏移量.Get(context), width == null ? sourceimage.Width : width.Value, height == null ? sourceimage.Height : height.Value)); context.SetValue(匹配项, match); if (match != null && match.Length > 0) { var bestmatch = match.OrderByDescending(q => q.Similarity).First(); context.SetValue(最佳匹配项, bestmatch); var bestmatchpos = bestmatch.Rectangle.Location; context.SetValue(最佳匹配项坐标位置, bestmatchpos); } }
protected override void Execute(CodeActivityContext context) { // Obtain the runtime value of the Text input argument Expense expense = context.GetValue(this.Expense); ExpenseReview review = context.GetValue(this.ExpenseReview); ExpenseComponent bc = new ExpenseComponent(); if (review.IsApproved) { context.SetValue(this.Expense, bc.Disburse(expense, review)); } else { context.SetValue(this.Expense, bc.Reject(expense, review)); } }
// If your activity returns a value, derive from CodeActivity<TResult> // and return the value from the Execute method. protected override void Execute(CodeActivityContext context) { var wfcontext = context.GetValue(this.WFContext); wfcontext.ViewName = "CreditCard"; wfcontext.ViewData.Model = new CreditCardInfo(); context.SetValue(WFContext, wfcontext); }
// If your activity returns a value, derive from CodeActivity<TResult> // and return the value from the Execute method. protected override void Execute(CodeActivityContext context) { var wfcontext = context.GetValue(this.WFContext); wfcontext.ViewName = "BillingAddress"; wfcontext.ViewData.Model = new Order(); context.SetValue(WFContext, wfcontext); }
protected override void Execute(CodeActivityContext context) { // Obtain the runtime value of the Text input argument Expense expense = context.GetValue(this.Expense); //expense.WorkflowID = Guid.NewGuid(); ExpenseComponent bc = new ExpenseComponent(); context.SetValue(this.Expense, bc.Submit(expense)); }
protected override void Execute(CodeActivityContext context) { string path = context.GetValue(this.Path); var buildDir= new DirectoryInfo(path); var package = buildDir.GetFiles().FirstOrDefault<FileInfo>(m => m.Extension == ".cspkg"); var configuration = buildDir.GetFiles().FirstOrDefault<FileInfo>(m => m.Extension == ".cscfg"); if (package == null) throw new Exception(String.Format("Cloud Service package file hasn't been found in the folder: {0}", path)); if (configuration == null) throw new Exception(String.Format("Cloud Service configuration file hasn't been found in the folder: {0}", path)); context.SetValue(Package,package.FullName); context.SetValue(Configuration,configuration.FullName); }
// 如果活动返回值,则从 CodeActivity<TResult> // 并从 Execute 方法返回该值。 protected override void Execute(CodeActivityContext context) { List<SMSModel_QueryReceive> list = context.GetValue(List_QueryReceive); //根据传入的集合判断查询状态(结束,还可查询) var state_enum = smsQuery.GetQueryState(list); context.SetValue(State, state_enum); }
// If your activity returns a value, derive from CodeActivity<TResult> // and return the value from the Execute method. protected override void Execute(CodeActivityContext context) { var wfcontext = context.GetValue(this.WFContext); wfcontext.ViewName = "PromoCode"; context.SetValue(WFContext, wfcontext); }
protected override void Execute(CodeActivityContext context) { // Obtain the runtime value of the Text input argument Expense expense = context.GetValue(this.Expense); //expense.WorkflowID = this.WorkflowInstanceId; ExpenseComponent bc = new ExpenseComponent(); context.SetValue(this.Expense, bc.Escalate(expense)); }
protected override void Execute(CodeActivityContext context) { IProcessStore processStore = StoreHandler.getProcessStore(context.GetValue(cfgSQLConnectionString)); P_WorkflowInstance senderInstance = processStore.getWorkflowInstance(context.GetValue(SenderId)); P_ProcessSubject senderProcessSubject = processStore.getProcessSubject(senderInstance.ProcessSubject_Id); P_Process process = processStore.getProcess(senderProcessSubject.Process_Id); P_ProcessSubject recipientProcessSubject = processStore.getProcessSubject(senderProcessSubject.Process_Id, context.GetValue(RecipientSubject)); //check if message is for internal subject if (recipientProcessSubject.WFM_WFName != null) { string recipientuser = context.GetValue(RecipientUsername); if(recipientuser != null) { if(recipientuser.Length == 0) { recipientuser = null; } } P_WorkflowInstance recipientInstance = processStore.getWorkflowInstance(recipientProcessSubject.Id, senderInstance.ProcessInstance_Id, recipientuser); if (recipientInstance != null) { //update recipient workflow id context.SetValue(RecipientId, recipientInstance.Id); } //message is for internal subject context.SetValue(IsMessageForExternalSubject, false); //update recipient processsubjectId context.SetValue(RecipientProcessSubjectId, recipientProcessSubject.Id); } else { //message is for external subject context.SetValue(IsMessageForExternalSubject, true); } context.SetValue(GlobalProcessName, process.GlobalProcessName); context.SetValue(ProcessInstanceId, senderInstance.ProcessInstance_Id); context.SetValue(SenderSubject, senderProcessSubject.Name); context.SetValue(SenderUsername, senderInstance.Owner); context.SetValue(Recipient_Role_Id, recipientProcessSubject.U_Role_Id); }
// If your activity returns a value, derive from CodeActivity<TResult> // and return the value from the Execute method. protected override void Execute(CodeActivityContext context) { var wfcontext = context.GetValue(this.WFContext); wfcontext.ViewName = "ShippingMethod"; List<ShippingMethod> shippingmethods = new List<ShippingMethod>{ new ShippingMethod{Name="Standard",Description="Standard Shipping (5 -8 days)"}, new ShippingMethod{Name="TwoDay",Description="Two-Day Shipping"}, new ShippingMethod{Name="OneDay",Description="One-Day Shipping"}}; wfcontext.ViewData.Model = shippingmethods; context.SetValue(WFContext, wfcontext); }
// If your activity returns a value, derive from CodeActivity<TResult> // and return the value from the Execute method. protected override void Execute(CodeActivityContext context) { var wfcontext = context.GetValue(this.WFContext); wfcontext.ViewName = "PaymentOptions"; List<PaymentOption> shippingmethods = new List<PaymentOption>{ new PaymentOption{Name="CreditCard",Description="Credit Card"}, new PaymentOption{Name="GoogleCheckOut",Description="Google Checkout"}, new PaymentOption{Name="PayPal",Description="PayPal"}}; wfcontext.ViewData.Model = shippingmethods; context.SetValue(WFContext, wfcontext); }
protected override void Execute(CodeActivityContext context) { var provider = ServiceLocator.Current.GetInstance<IFlowExtensionProvider>(); var dto = context.GetValue(Dto); var output = provider.ConfirmEmail(dto); var item = new FlowStatusDto() {Steps = new List<ActivityOutput>()}; if (output != null) item.Steps.Add(output); context.SetValue(ActivityOutput, item); }
// If your activity returns a value, derive from CodeActivity<TResult> // and return the value from the Execute method. protected override void Execute(CodeActivityContext context) { // Obtain the runtime value of the Text input argument int userId = context.GetValue(this.UserId); User user = db.Users.Find(userId); UserRequest userReq = new UserRequest(); userReq.Id = user.Id; userReq.FirstName = user.FirstName; userReq.LastName = user.LastName; userReq.CarId = user.CarId; context.SetValue(UserReq, userReq); }
/// <summary> /// 读取配置文件中以上配置节的值 /// </summary> private void ReadAppConfig(CodeActivityContext context) { //为三个输出变量赋值 //context.SetValue(SleepTime, int.Parse(ConfigHelper.GetSettingValue("sleepTime"))); //var key_list = ConfigHelper.GetSettingValue("id_list"); //var key_hash = ConfigHelper.GetSettingValue("id_hash"); var key_list_msgid = ConfigHelper.GetSettingValue("id_list_msgid"); context.SetValue(Id_list_msgid, key_list_msgid); //context.SetValue(Id_hash, key_hash); //context.SetValue(Seconds_Interval, double.Parse(ConfigHelper.GetSettingValue("seconds_add"))); }
protected override void Execute(CodeActivityContext context) { DynamicValue data = context.GetValue(this.Data); DynamicValue transition = new DynamicValue(); data.TryGetValue("recipient", out transition); context.SetValue(Recipient, transition.ToString()); data.Remove("recipient"); DynamicValue variables = context.GetValue(GlobalVariables); foreach (string i in data.Keys) { DynamicValue value = new DynamicValue(); data.TryGetValue(i, out value); if (variables.ContainsKey(i)) { variables.Remove(i); } variables.Add(i, value); } context.SetValue(GlobalVariables, variables); }
// If your activity returns a value, derive from CodeActivity<TResult> // and return the value from the Execute method. protected override void Execute(CodeActivityContext context) { var provider = ServiceLocator.Current.GetInstance<ICoreFlowProvider>(); var dto = context.GetValue(Dto); var item = context.GetValue(ActivityOutput); var output = provider.SendEmail(dto); if (output != null) item.Steps.Add(output); context.SetValue(ActivityOutput, item); //throw new Exception("Test"); }
// 如果活动返回值,则从 CodeActivity<TResult> // 派生并从 Execute 方法返回该值。 protected override void Execute(CodeActivityContext context) { // 获取 Text 输入参数的运行时值 string it = System.Console.ReadLine(); System.Console.WriteLine("你输入的是:"+it); if (it == null) { it = "something wrong"; } context.SetValue(inputstring,it); }
// Si la actividad devuelve un valor, se debe derivar de CodeActivity<TResult> // y devolver el valor desde el método Execute. protected override void Execute(CodeActivityContext context) { // Obtenga el valor de tiempo de ejecución del argumento de entrada Text int campaignID = context.GetValue(this.CampaignID); //CampaignDataModel model = null; // CampaignBO.GetInstance().Get(campaignID); //if(model.DateStarted != DateTime.MinValue) //{ // throw new Exception("Campaign already started"); //} //model.DateStarted = DateTime.Now; ////CampaignBO.GetInstance().Update(model); context.SetValue(WorkflowID, 1); }
// 如果活动返回值,则从 CodeActivity<TResult> // 派生并从 Execute 方法返回该值。 protected override void Execute(CodeActivityContext context) { // create an instance of blob counter algorithm BlobCounterBase bc = new BlobCounter(); // set filtering options bc.FilterBlobs = true; bc.MinWidth = context.GetValue(最小宽度); bc.MinHeight = context.GetValue(最小高度); // set ordering options bc.ObjectsOrder = ObjectsOrder.Size; // process binary image bc.ProcessImage(context.GetValue(处理目标)); var blobs = bc.GetObjectsInformation(); context.SetValue(输出目标, blobs); }
// 如果活动返回值,则从 CodeActivity<TResult> // 并从 Execute 方法返回该值。 protected override void Execute(CodeActivityContext context) { // 获取 Text 输入参数的运行时值 //string text = context.GetValue(this.Text); //1 根据传入的参数,获取Redis中的集合对象并返回 //1.1 获取传入的参数 string id_list = context.GetValue(Id_List); //1.2根据Redis中保存的 集合 的 key 获取该Redis帮助类(实例化) ListReidsHelper<PMS.Model.QueryModel.Redis_SMSContent> redisListhelper = new ListReidsHelper<PMS.Model.QueryModel.Redis_SMSContent>(id_list); //2 取得Redis中保存的该 Key 所对应的集合对象 var list_final = new List<PMS.Model.QueryModel.Redis_SMSContent>(); list_final = redisListhelper.GetLast(); context.SetValue(List_redis, list_final); }