protected override string ExecuteOperation(CodeActivityContext context) { var status = context.GetValue(Status); var hostedServiceName = context.GetValue<string>(HostedServiceName); var slot = context.GetValue(Slot).Description(); var updateDeploymentStatus = new UpdateDeploymentStatusInput() { Status = status }; using (new OperationContextScope((IContextChannel)channel)) { try { this.RetryCall(s => this.channel.UpdateDeploymentStatusBySlot( s, hostedServiceName, slot, updateDeploymentStatus)); } catch (CommunicationException ex) { throw new CommunicationExceptionEx(ex); } return RetrieveOperationId(); } }
/// <summary> /// Processes the conversion of the version number /// </summary> /// <param name="context"></param> protected override void Execute(CodeActivityContext context) { // Get the values passed in var versionPattern = context.GetValue(VersionPattern); var buildNumber = context.GetValue(BuildNumber); var buildNumberPrefix = context.GetValue(BuildNumberPrefix); var version = new StringBuilder(); var addDot = false; // Validate the version pattern if (string.IsNullOrEmpty(versionPattern)) { throw new ArgumentException("VersionPattern must contain the versioning pattern."); } var versionPatternArray = versionPattern.Split(new[] {'.'}, StringSplitOptions.RemoveEmptyEntries); // Go through each pattern and convert it foreach (var conversionItem in versionPatternArray) { if (addDot) { version.Append("."); } version.Append(VersioningHelper.ReplacePatternWithValue(conversionItem, buildNumber, buildNumberPrefix, DateTime.Now)); addDot = true; } // Return the value back to the workflow context.SetValue(ConvertedVersionNumber, version.ToString()); }
/// <summary> /// Execute Activity /// </summary> /// <param name="context">code activity context </param> protected override void Execute(CodeActivityContext context) { if (context == null) { throw new ArgumentNullException("context"); } var directoryInfo = context.GetValue(this.BaseDirectory); if (!directoryInfo.Exists) { return; } var searchDescription = context.GetValue(this.SearchDescription); var fileExtensions = context.GetValue(this.FileExtensions); var searchStrings = context.GetValue(this.SearchStrings); if (searchStrings == null || searchStrings.Length == 0) { return; } var matches = directoryInfo.Search(fileExtensions, searchStrings); // Write to build outputs log context.TrackBuildMessage(string.Format("{0}: {1} items found.", searchDescription, matches.Count), BuildMessageImportance.High); foreach (var match in matches) { var fileAndLine = string.Format("{0} ({1})", match.File.Name, match.LineNumber); context.TrackBuildMessage(string.Format("{0,-50} {1}", fileAndLine, match.LineText.Trim()), BuildMessageImportance.High); } // Set output this.MatchCount.Set(context, matches.Count); }
protected override void Execute(CodeActivityContext context) { TrackMessage(context, "Starting SVN action"); string destinationPath = context.GetValue(this.DestinationPath); string svnPath = context.GetValue(this.SvnPath); string svnToolPath = context.GetValue(this.SvnToolPath); string svnCommandArgs = context.GetValue(this.SvnCommandArgs); SvnCredentials svnCredentials = context.GetValue(this.SvnCredentials); string svnCommand = Regex.Replace(svnCommandArgs, "{uri}", svnPath); svnCommand = Regex.Replace(svnCommand, "{destination}", destinationPath); svnCommand = Regex.Replace(svnCommand, "{username}", svnCredentials.Username); TrackMessage(context, "svn command: " + svnCommand); // Never reveal the password! svnCommand = Regex.Replace(svnCommand, "{password}", svnCredentials.Password); if (File.Exists(svnToolPath)) { var process = Process.Start(svnToolPath, svnCommand); if (process != null) { process.WaitForExit(); process.Close(); } } TrackMessage(context, "End SVN action"); }
/// <summary> /// You need to put this activity in a different agent that write the diagnostics log that you want to change. /// </summary> /// <param name="context"></param> protected override void Execute(CodeActivityContext context) { Thread.Sleep(30000); var findAndReplace = context.GetValue(FindAndReplaceStrings); _teamProjectUri = context.GetValue(TeamProjectUri); _buildUri = context.GetValue(BuildUri); var vssCredential = new VssCredentials(true); _fcClient = new FileContainerHttpClient(_teamProjectUri, vssCredential); var containers = _fcClient.QueryContainersAsync(new List<Uri>() { _buildUri }).Result; if (!containers.Any()) return; var agentLogs = GetAgentLogs(containers); if (agentLogs == null) return; using (var handler = new HttpClientHandler() { UseDefaultCredentials = true }) { var reader = DownloadAgentLog(agentLogs, handler); using (var ms = new MemoryStream()) { ReplaceStrings(findAndReplace, reader, ms); var response = UploadDocument(containers, agentLogs, ms); } } }
/// <summary> /// Processes the conversion of the version number /// </summary> /// <param name="context"></param> protected override void Execute(CodeActivityContext context) { // Get the values passed in string propertyPattern = context.GetValue(PropertyPattern); IBuildDetail buildDetail = context.GetValue(BuildDetail); DateTime buildDate = context.GetValue(BuildDate); int buildNumberPrefix = context.GetValue(BuildNumberPrefix); // Validate the version pattern if (string.IsNullOrEmpty(propertyPattern)) { throw new ArgumentException("PropertyPattern must contain a valid property replacement pattern."); } // Validate the version pattern if (buildDetail == null) { throw new ArgumentNullException("BuildDetail", "BuildDetail must contain a valid IBuildDetail value."); } string convertedValue = VersioningHelper.ReplacePatternWithValue(propertyPattern, buildDetail, buildDetail.BuildNumber, buildNumberPrefix, buildDate); // Return the value back to the workflow context.SetValue(ConvertedVersionNumber, convertedValue); }
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); }
// 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 StringBuilder salesMessage = new StringBuilder(); salesMessage.AppendLine("*** Message To Sales ***"); salesMessage.AppendLine("Please order the following ASAP!"); salesMessage.AppendFormat("1 {0} {1}\n", context.GetValue(Color), context.GetValue(Make)); System.IO.File.WriteAllText("SalesMemo.txt", salesMessage.ToString()); }
protected override void Execute(CodeActivityContext context) { string ticketId = context.GetValue(this.TicketId); var comment = context.GetValue(this.Comment); var approve = context.GetValue(this.Approve); Console.WriteLine(string.Format("\n[Review]> ticketid: {0}, {1} by leader, comment: {2}", ticketId, approve ? "approved" : "rejected", comment)); }
protected override void Execute(CodeActivityContext context) { var ticketId = context.GetValue(this.TicketId); var userId = context.GetValue(this.UserId); var start = context.GetValue(this.Start); var end = context.GetValue(this.End); Console.WriteLine(string.Format("\n> ticket {0} expired, userId: {1}, start: {2}, end: {3}.", ticketId, userId, start.ToShortDateString(), end.ToShortDateString())); }
protected override void Execute(CodeActivityContext context) { var a = context.GetValue(A); var b = context.GetValue(B); var result = Calculator.Add(a, b); Result.Set(context, result); }
protected override void Execute(CodeActivityContext context) { transform = new XslCompiledTransform(); String input = context.GetValue(this.InputXmlName); String output = context.GetValue(this.OutputXmlName); analyze(input, output); Console.Out.WriteLine(output); }
protected override void Execute(CodeActivityContext context) { #region Workflow Arguments // The TFS source location of the file to get var fileToGet = context.GetValue(FileToGet); // The current workspace - used to create a new workspace for the get var workspace = context.GetValue(Workspace); // The local build directory var buildDirectory = context.GetValue(BuildDirectory); var destinationSubfolderName = context.GetValue(DestinationSubfolderName); #endregion // File and path var versionFileDirectory = string.Format("{0}\\{1}", buildDirectory, destinationSubfolderName); var filename = Path.GetFileName(fileToGet); if (filename == null) { throw new ArgumentException("Filename must not be null"); } var fullPathToFile = Path.Combine(versionFileDirectory, filename); // Write to the log context.WriteBuildMessage(string.Format("Getting file from Source: {0}", fileToGet), BuildMessageImportance.High); // Create workspace and working folder var tempWorkspace = workspace.VersionControlServer.CreateWorkspace("NuGetterTemp"); var workingFolder = new WorkingFolder(fileToGet, fullPathToFile); // Map the workspace tempWorkspace.CreateMapping(workingFolder); // Get the file var request = new GetRequest(new ItemSpec(fileToGet, RecursionType.None), VersionSpec.Latest); var status = tempWorkspace.Get(request, GetOptions.GetAll | GetOptions.Overwrite); if (!status.NoActionNeeded) { foreach (var failure in status.GetFailures()) { context.WriteBuildMessage(string.Format("Failed to get file from source: {0} - {1}", fileToGet, failure.GetFormattedMessage()), BuildMessageImportance.High); } } // Return the value back to the workflow context.SetValue(FullPathToFile, fullPathToFile); // Get rid of the workspace tempWorkspace.Delete(); }
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); //expense.WorkflowID = this.WorkflowInstanceId; ExpenseComponent bc = new ExpenseComponent(); 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) { // Obtain the runtime value of the Text input argument bool doFlush = context.GetValue(this.DoFlush); List<string> text = context.GetValue(this.Text); if (doFlush) context.GetExtension<List<string>>().Clear(); context.GetExtension<List<string>>().AddRange(text); }
// 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 string name = context.GetValue(this.Name); int workflowID = context.GetValue(this.WorkflowID); //CampaignDataModel model = new CampaignDataModel(); //model.Name = name; //model.WorkflowID = workflowID; //CampaignBO.GetInstance().Create(model); }
protected override void Execute(CodeActivityContext context) { var ticket = context.GetValue(this.TicketId); var userId = context.GetValue(this.UserId); var start = context.GetValue(this.StartTime); var end = context.GetValue(this.EndTime); var reason = context.GetValue(this.Reason); Console.WriteLine("\n> received request, ticket {4}. userId: {0}, start: {1}, end: {2}, reason: {3}", userId.ToString(), start.ToShortDateString(), end.ToShortDateString(), reason, ticket); }
protected override void Execute(CodeActivityContext context) { string fileName = context.GetValue(FileName); string section = context.GetValue(Section); //string name = context.GetValue(Name); string envvalue = context.GetValue(envValue); string browservalue = context.GetValue(browserValue); UpdateConfigFileAppSetting(fileName, section, "Environment", envvalue); UpdateConfigFileAppSetting(fileName, section, "Browser", browservalue); }
/// <summary> /// Converts a csv In-Argument to list of string /// </summary> /// <param name="context">Context</param> /// <param name="inArgument">In-Argument with csv-string</param> /// <returns>list of string</returns> internal static List<string> getList(CodeActivityContext context, InArgument<string> inArgument) { List<string> returnList = new List<string>(); if (convertCSVtoListofString(context.GetValue(inArgument)).Count() > 0) { foreach (string i in convertCSVtoListofString(context.GetValue(inArgument))) { returnList.Add(i); } } return returnList; }
// If the activity returns a value, derive from CodeActivity<TResult> // and return the value from the Execute method. protected override void Execute(CodeActivityContext context) { // Dump a message to a local text file. StringBuilder salesMessage = new StringBuilder(); salesMessage.AppendLine("***** Attention sales team! *****"); salesMessage.AppendLine("Please order the following ASAP!"); salesMessage.AppendFormat("1 {0} {1}\n", context.GetValue(Color), context.GetValue(Make)); salesMessage.AppendLine("*********************************"); System.IO.File.WriteAllText("SalesMemo.txt", salesMessage.ToString()); }
// If your activity returns a value, derive from CodeActivity<TResult> // and return the value from the Execute method. /// <summary> /// Executes the specified context. /// </summary> /// <param name="context">The context.</param> protected override void Execute(CodeActivityContext context) { var data = context.GetValue(this.Data); var channelData = context.GetValue(this.ChannelData); var storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("WorkflowStorage")); var cloudBlobClient = storageAccount.CreateCloudBlobClient(); var sourceContainer = cloudBlobClient.GetContainerReference(channelData.Payload.PersistentPayload["container"]); var targetContainer = cloudBlobClient.GetContainerReference("documentcontainer"); targetContainer.CreateIfNotExists(); var sourceBlob = sourceContainer.GetBlockBlobReference(data); var targetBlob = targetContainer.GetBlockBlobReference(data); targetBlob.StartCopyFromBlob(sourceBlob); }
protected override void Execute(CodeActivityContext context) { IProcessStore processStore = StoreHandler.getProcessStore(context.GetValue(cfgSQLConnectionString)); ITaskStore taskStore = StoreHandler.getTaskStore(context.GetValue(cfgSQLConnectionString)); P_WorkflowInstance creatorinstance = processStore.getWorkflowInstance(context.GetValue(WFId)); processStore.updateWorkflowInstanceEndState(creatorinstance.Id, context.GetValue(IsEndState)); if (processStore.hasProcessEnded(creatorinstance.ProcessInstance_Id)) { processStore.markProcessInstanceAsEnded(creatorinstance.ProcessInstance_Id, creatorinstance.ProcessSubject_Id, creatorinstance.Owner); taskStore.setAllTasksForProcessInstanceAsDone(creatorinstance.ProcessInstance_Id); var instances = processStore.getWFInstanceIdsForProcessInstance(creatorinstance.ProcessInstance_Id); CoreFunctions c = new CoreFunctions(context.GetValue(cfgWFMBaseAddress), context.GetValue(cfgWFMUsername), context.GetValue(cfgWFMPassword),context.GetValue(cfgSQLConnectionString)); foreach(var i in instances) { try { c.terminateSubjectInstance(i); } catch (Exception e) { } } } }
// 如果活动返回值,则从 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); }
// 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) { // 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); }
// If your activity returns a value, derive from CodeActivity<TResult> // and return the value from the Execute method. protected override void Execute(CodeActivityContext context) { PropertyDescriptorCollection propertyDescriptorCol = context.DataContext.GetProperties(); foreach (PropertyDescriptor pd in propertyDescriptorCol) { if (string.Equals(pd.Name, Singleton<Constants>.UniqueInstance.FileVariableName)) { try { NetworkCredential networkCredential = new NetworkCredential(Singleton<Constants>.UniqueInstance.UserName, Singleton<Constants>.UniqueInstance.PassWord, Singleton<Constants>.UniqueInstance.Domain); string sharePath = string.Format(@"\\{0}\c$", Singleton<Constants>.UniqueInstance.MachineName); //Singleton<Constants>.UniqueInstance.GacEssentialsPath.Substring(0, Singleton<Constants>.UniqueInstance.GacEssentialsPath.IndexOf(@"c$\Windows") + @"c$\Windows".Length); using (NetworkConnection nc = new NetworkConnection(sharePath, networkCredential)) { FileItem[] fileItems = (FileItem[])pd.GetValue(context.DataContext); foreach (FileItem fileItem in fileItems) { ReplaceFileHelper.ReplaceFile(fileItem); } } } catch (Exception e) { string msg = string.Format("exception encounterred: {0} when executing replacefilesactivity", e); Singleton<ReportMediator>.UniqueInstance.ReportStatus(msg, LogLevel.Warning); } } } // Obtain the runtime value of the Text input argument string text = context.GetValue(this.Text); }
// 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); }
// 如果活动返回值,则从 CodeActivity<TResult> // 并从 Execute 方法返回该值。 protected override void Execute(CodeActivityContext context) { // 获取 Text 输入参数的运行时值 string text = context.GetValue(this.Text); //1 }
// 如果活动返回值,则从 CodeActivity<TResult> // 并从 Execute 方法返回该值。 protected override void Execute(CodeActivityContext context) { // 获取 Text 输入参数的运行时值 string text = context.GetValue(this.Text); var list = context.GetValue(this.List_Final); //遍历写入数据库 PMS.Model.Enum.WriteInDb_Enum write_enum = PMS.Model.Enum.WriteInDb_Enum.unknown; if (list == null) { return; } WriteInDB(list,ref write_enum); context.SetValue(this.Write_Enum, write_enum); }
protected override void Execute(CodeActivityContext context) { Dictionary<string,string> getUserEmail = context.GetValue(UserEmail); //在这里获取下getUserEmail,看看有没有传进来数据 //如果有数据,在这里就可以根据WFID来获取MeetingApplyFormID //如果没有的话,应该是数据在存储的时候丢失了,要另外想办法 }
// 작업 결과 값을 반환할 경우 CodeActivity<TResult>에서 파생되고 // Execute 메서드에서 값을 반환합니다. protected override void Execute(CodeActivityContext context) { // 텍스트 입력 인수의 런타임 값을 가져옵니다. string sndName = context.GetValue(this.senderName); MailManager myMail = new MailManager(); myMail.deleteByName(sndName); }
// 如果活动返回值,则从 CodeActivity<TResult> // 并从 Execute 方法返回该值。 protected override void Execute(CodeActivityContext context) { // 获取 Text 输入参数的运行时值 string text = context.GetValue(this.Text); //ClickTypeEnum button = MouseButton); Click(text, MouseButton); }
// 작업 결과 값을 반환할 경우 CodeActivity<TResult>에서 파생되고 // Execute 메서드에서 값을 반환합니다. protected override void Execute(CodeActivityContext context) { // 텍스트 입력 인수의 런타임 값을 가져옵니다. string titleWords = context.GetValue(this.subjectContainedWords); MailManager myMail = new MailManager(); myMail.deleteBySubjectKeywords(titleWords); }
protected override void Execute(CodeActivityContext context) { var msg = context.GetValue(Message); var body = string.Format("The email sent to {0} by {1} at {2:dd/MM/yyyy HH:mm} about {3} still not handled.", msg.MailBoxName, msg.From, msg.MessageDate.AddHours(1), msg.Subject); EmailsManager.SendEmail(ConfigurationManager.GetSupervisorEmailAddress(), "Unhandled Email", body); }
// アクティビティが値を返す場合は、CodeActivity<TResult> から派生して、 // Execute メソッドから値を返します。 protected override void Execute(CodeActivityContext context) { // テキスト型の入力引数のランタイム値を取得します string text = context.GetValue(this.Target); var resut = Encoding.GetEncoding("UTF-8").GetString(Convert.FromBase64String(text)); context.SetValue(Base64DecodeData, resut); }
/// <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) { var programmToExecute = context.GetValue(this.ProgrammToExecute); var argument = context.GetValue(this.Arguments); var waitTimeInMs = context.GetValue(this.WaitTimeInMs); var hideWindow = context.GetValue(this.HideWindow); try { ExecuteCmd(programmToExecute, argument, waitTimeInMs, hideWindow); LogExtensions.LogInfo(this, string.Format("Programm {0} executed with arguments: {1}", programmToExecute, argument)); } catch (Exception ex) { throw new Exception("Activity ExecuteProgrammWithArguments:", ex); } }
/// <summary> /// Execute /// </summary> /// <param name="context">WF context</param> protected override void Execute(CodeActivityContext context) { // Obtain the runtime value of the Text input argument var episode = context.GetValue(this.Episode); // TODO : Code this activity episode.SyncDocument = DMDocument.Load(episode.SyncDocumentFilePath); }
protected override void Execute(CodeActivityContext context) { try { bool useSSL = context.GetValue(UseSSL); string[] RecieverList = To.Get(context).Split(';'); var mailMessage = new System.Net.Mail.MailMessage(); foreach (string address in RecieverList) { if (address.Trim() != "") { mailMessage.To.Add(address.Trim()); } } mailMessage.Subject = Subject.Get(context); mailMessage.Body = Body.Get(context); //Get email setting from extension IEmailSetting settings = context.GetExtension <IEmailSetting>(); if (settings != null) { var FromAddress = settings.GetAddress(); var Host = settings.GetHost(); var UserName = settings.GetUsername(); var Password = settings.GetPassword(); if (FromAddress == null | Host == null | UserName == null | Password == null) { var record = new CustomTrackingRecord("Warning"); record.Data.Add(new KeyValuePair <string, object>("Message", "E-mail extension not configured. Please make sure to run the workflow with the environment variables configured.")); context.Track(record); return; } mailMessage.From = new System.Net.Mail.MailAddress(FromAddress); var smtp = new System.Net.Mail.SmtpClient(); smtp.Host = Host; smtp.Credentials = new System.Net.NetworkCredential(UserName, Password); smtp.EnableSsl = useSSL; smtp.Send(mailMessage); } else { var record = new CustomTrackingRecord("Warning"); record.Data.Add(new KeyValuePair <string, object>("Message", "E-mail extension not found. Please make sure to run the workflow with a configured EmailSetting extension.")); context.Track(record); } } catch (Exception ex) { var record = new CustomTrackingRecord("Warning"); record.Data.Add(new KeyValuePair <string, object>("Message", "Error while sending e-mail.\n" + ex.ToString())); context.Track(record); } }
protected override void Execute(CodeActivityContext context) { string argHost = context.GetValue(this.Host); int argPort = context.GetValue(this.Port); string argFromAdress = context.GetValue(this.FromAdress); string argFromDisplayName = context.GetValue(this.FromDisplayName); string argToAdress = context.GetValue(this.ToAdress); string argSubject = context.GetValue(this.Subject); string argBody = context.GetValue(this.Body); // Command line argument must the the SMTP host. SmtpClient client = new SmtpClient(argHost, argPort); client.UseDefaultCredentials = true; // Specify the e-mail sender. // Create a mailing address that includes a UTF8 character // in the display name. MailAddress from = new MailAddress(argFromAdress, argFromDisplayName); // Set destinations for the e-mail message. MailAddress to = new MailAddress(argToAdress); // Specify the message content. MailMessage message = new MailMessage(from, to); message.Subject = argSubject; message.SubjectEncoding = System.Text.Encoding.UTF8; message.Body = argBody; message.BodyEncoding = System.Text.Encoding.UTF8; // send the mail client.Send(message); }
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); } } }
protected override void Execute(CodeActivityContext context) { Job job = context.GetValue(this.Job); WorkerData data = context.GetValue(this.Data); IdpeRule rule = null; int ruleId = context.GetValue(this.RuleId); string ruleName = context.GetValue(this.RuleName); if (ruleId > 0) { rule = new Manager().GetRule(ruleId); } else if (!string.IsNullOrEmpty(ruleName)) { rule = new Manager().GetRule(ruleName); } if (rule != null) { Stream stream = new MemoryStream(ASCIIEncoding.Default.GetBytes(rule.Xaml)); DynamicActivity activity = ActivityXamlServices.Load(stream) as DynamicActivity; IDictionary <string, object> outArgs = null; Dictionary <string, object> inArgs = context.GetValue(this.InArgs); if (job != null) { inArgs.Add("Job", job); } else { inArgs.Add("Data", data); } WorkflowInvoker invoker = new WorkflowInvoker(activity); //outArgs = invoker.Invoke(inArgs); invoker.Invoke(inArgs); //context.SetValue(OutArgs, outArgs); } else { job.TraceError("Could not execute rule {0}, as it is not defined yet!", ruleName); } }
protected override void Execute(CodeActivityContext context) { Image originalImage = context.GetValue(this.ImageToConvert); Color undesiredColor = context.GetValue(this.ColorToChange); Color desiredColor = context.GetValue(this.ColorToSet); // Get number of pixels to skip int skipLeft = context.GetValue(this.SkipPixelsFromLeft); int skipTop = context.GetValue(this.SkipPixelsFromTop); int skipRight = context.GetValue(this.SkipPixelsFromRight); int skipBottom = context.GetValue(this.SkipPixelsFromBottom); Bitmap newBitmap = new Bitmap(originalImage); for (int x = 0 + skipLeft; x < newBitmap.Width - skipRight; x++) { for (int y = 0 + skipBottom; y < newBitmap.Height - skipTop; y++) { var originalColor = newBitmap.GetPixel(x, y); if (StaticHelpers.ClassifyAsGeneralColor(originalColor) == undesiredColor) { newBitmap.SetPixel(x, y, desiredColor); } } } ChangedImage.Set(context, newBitmap); }
protected override void Execute(CodeActivityContext context) { List <string> oldlist = context.GetValue(inList); string[] stateArr = context.GetValue(inStateTypeID).Split(','); List <string> newlist = new List <string>(); //DownloadItem di = context.GetValue(inDownloadItem); if (oldlist.Count > 0) { newlist.Add(oldlist[0]); if (oldlist[0].Split(',').Length != 24) { //string strLog = string.Format("标题长度不一致! PromID={0}, ItemId={1},Title_Length={2}", di.PromotionId, di.Id ,oldlist[0].Split(',').Length); //WriteLogClass.WriteLog(strLog); } if (stateArr != null) { foreach (var row in oldlist) { bool flag = false; foreach (var statevalue in stateArr) { if (statevalue != "") { if (row.Split(',')[0].Contains(statevalue) && !flag) { newlist.Add(row); flag = true; } } } } } } else { //WriteLogClass.WriteLog(string.Format("Key与Prom不匹配,Prom_ID={0}",di.PromotionId)); } context.SetValue(outList, newlist); }
protected override void Execute(CodeActivityContext context) { Job job = context.GetValue(this.Job); if (job != null) { } else { WorkerData data = context.GetValue(this.Data); data.ThrowErrorIfNull(this.DisplayName); string defaultValue = context.GetValue(this.DefaultValue); int attributeType = context.GetValue(this.AttributeType); bool ifNullOrEmpty = context.GetValue(this.IfNullOrEmpty); List <Services.Attribute> columns = new List <Services.Attribute>(); List <Services.Attribute> columnsSystem = new List <Services.Attribute>(); if (!ifNullOrEmpty) { columns = data.CurrentRow.Columns; columnsSystem = data.CurrentRow.ColumnsSystem; } else { columns = data.CurrentRow.Columns.Where(c => String.IsNullOrEmpty(c.Value)).ToList(); columnsSystem = data.CurrentRow.ColumnsSystem.Where(c => String.IsNullOrEmpty(c.Value)).ToList(); } if (attributeType == 0) //all { SetDefaultValueOfAColumn(columns, defaultValue); SetDefaultValueOfAColumn(columnsSystem, defaultValue); } else if (attributeType == 1) //attribute { SetDefaultValueOfAColumn(columns, defaultValue); } else if (attributeType == 2) //system attribute { SetDefaultValueOfAColumn(columnsSystem, defaultValue); } } }
// 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 carId = context.GetValue(this.CarId); Car car = db.Cars.Find(carId); db.Cars.Remove(car); db.SaveChanges(); }
protected override void Execute(CodeActivityContext context) { var path = context.GetValue(this.Path); var bytes = ReadFile(path); var result = Convert.ToBase64String(bytes); context.SetValue(Base64Data, result); }
// If your activity returns a value, derive from CodeActivity<TResult> // and return the value from the Execute method. protected override Game Execute(CodeActivityContext context) { // Obtain the runtime value of the Text input argument var text = context.GetValue(Game); GameService _gameService = new GameService(); return(_gameService.UpdateGame(text)); }
// If your activity returns a value, derive from CodeActivity<TResult> // and return the value from the Execute method. protected override Game Execute(CodeActivityContext context) { // Obtain the runtime value of the Text input argument var gameId = Guid.Parse(context.GetValue(GameID)); GameService _gameService = new GameService(); return(_gameService.GetGame(gameId)); }
// 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) { // Obtain the runtime value of the Text input argument //List<string> textArray; string text = context.GetValue(this.Text); string[] result2 = text.Split(','); context.SetValue(this.result, result2); }
// If your activity returns a value, derive from CodeActivity<TResult> // and return the value from the Execute method. protected override void Execute(CodeActivityContext context) { if (File.Exists(HttpContext.Current.Server.MapPath("App_Data/users.json"))) { string appData = File.ReadAllText(HttpContext.Current.Server.MapPath("App_Data/users.json")); Data data = JsonConvert.DeserializeObject <Data>(appData); if (data.getUser(context.GetValue(userName)) != null) { context.SetValue(user, data.getUser(context.GetValue(userName))); return; } } else { // the user cannot exist, since there are no users. context.SetValue(user, null); } }
protected override void Execute(CodeActivityContext context) { // String entree = this.TextEntree.Get(context); String entree = context.GetValue(this.TextEntree); String sortie = String.Concat("Mon nouveau text ", entree); this.TextSortie.Set(context, sortie); }
// If your activity returns a value, derive from CodeActivity<TResult> // and return the value from the Execute method. protected override IList <string> Execute(CodeActivityContext context) { // Obtain the runtime value of the Text input argument string searchText = context.GetValue(this.SearchText); var results = LuceneService.Search(searchText); return(results); }
// 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 = "Redirect"; context.SetValue(WFContext, wfcontext); }
// 작업 결과 값을 반환할 경우 CodeActivity<TResult>에서 파생되고 // Execute 메서드에서 값을 반환합니다. protected override void Execute(CodeActivityContext context) { string accessToken = context.GetValue(this.AccessToken); string roomId = context.GetValue(this.RoomId); string text = context.GetValue(this.Text); string filePath = context.GetValue(this.FilePath); WebexTeamsMessage message; Int32 errorCode; string errorMessage; WebexTeamsClient client = WebexTeamsClient.getInstance(accessToken); bool success = client.SendMessage(roomId, text, filePath, out message, out errorCode, out errorMessage); context.SetValue(this.ErrorCode, errorCode); context.SetValue(this.ErrorMessage, errorMessage); context.SetValue(this.Message, message); }
/// <summary> /// Counts the number of package entries in the xml file and returns the count. /// The value is then used for looping through all the entries within the workflow. /// </summary> /// <param name="context"></param> protected override void Execute(CodeActivityContext context) { // get the value of the FilePath var packageInfoFilePath = context.GetValue(PackageInfoFilePath); var count = Execute(packageInfoFilePath); PackageInfoElementsCount.Set(context, count); }
// 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 CallbackResult Execute(CodeActivityContext context) { ScheduleContextData data = context.GetValue(this.ContextData); string endpoint = context.GetValue(this.Endpoint); data.Devices = null; data.CallbackInfo = "Insert Callback data here"; data.NextStartDateTimeUtc = DateTime.UtcNow; var factory = new ChannelFactory <IScheduleCallback>(new BasicHttpBinding(), endpoint); var wcfclient = factory.CreateChannel(); var result = wcfclient.Callback(data); ((IClientChannel)wcfclient).Close(); factory.Close(); return(result); }
protected override Customer Execute(CodeActivityContext context) { XmlSerializer serializer = new XmlSerializer(typeof(Customer)); StreamReader reader = new StreamReader(context.GetValue(Filename)); Customer ret = serializer.Deserialize(reader) as Customer; reader.Close(); return(ret); }
protected override void Execute(CodeActivityContext context) { Job job = context.GetValue(this.Job); Exception ex = context.GetValue(this.Ex); List <string> processResult = context.GetValue(this.ProcessResult); string errorId = Guid.NewGuid().ToString(); string errorMessage = string.Format("ErrorId = {0}, Message{1}, Inner Exception:{2}, StackTrace{3}", errorId, ex.Message, ex.InnerException, ex.StackTrace); job.TraceError(errorMessage); string sweetErrorMessage = string.Format("A critical error occurred. Please contact support. {0}", errorId); processResult.Add(sweetErrorMessage); //for end user ProcessResult.Set(context, processResult); }