• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# CodeActivityContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中CodeActivityContext的典型用法代码示例。如果您正苦于以下问题:C# CodeActivityContext类的具体用法?C# CodeActivityContext怎么用?C# CodeActivityContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CodeActivityContext类属于命名空间,在下文中一共展示了CodeActivityContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Execute

        /// <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());
        }
开发者ID:Bjornej,项目名称:TfsVersioning,代码行数:35,代码来源:ConvertVersionPattern.cs


示例2: Execute

        // 如果活动返回值,则从 CodeActivity<TResult>
        // 派生并从 Execute 方法返回该值。
        protected override void Execute(CodeActivityContext context)
        {
            // 获取 Text 输入参数的运行时值
            ReviewCheck ReviewCheck = ReviewChecks.Get(context);
            DocumentApply documentApply = inApply.Get(context);
            if (ReviewCheck.Agree == 1)
            {

                if (inApply.Get(context).IsNeed)
                {
                    documentApply.Status = 4;
                }
                else
                {
                    documentApply.Status = 5;
                }
            }
            else
            {
                documentApply.Status = 6;
            }
            new YunShanOA.BusinessLogic.DocumentManager.DocumentManager().Save(documentApply);

            outApply.Set(context, documentApply);
        }
开发者ID:huaminglee,项目名称:yunshanoa,代码行数:27,代码来源:UpdateAfterCheck.cs


示例3: Execute

        protected override void Execute(CodeActivityContext context)
        {
            try
            {
                Guid FlowInstranceID = context.WorkflowInstanceId;
                DebugStatus debug = new DebugStatus();
                if (debug.status == 0)
                {
                    string result = s.Get(context);

                    if (result == "true")
                    {
                        //TODO Change the step.
                        //BLL.Document.DocumentEndStep(FlowInstranceID, "1");
                    }
                    else
                    {
                        //BLL.Document.DocumentEndStep(FlowInstranceID, "2");
                    }
                }
            }
            catch//(Exception e)
            {
                //执行出错
            }
        }
开发者ID:xiluo,项目名称:document-management,代码行数:26,代码来源:EndActivity.cs


示例4: Execute

        protected override void Execute(CodeActivityContext context)
        {
            bool hire = Hire.Get(context);
            ApplicantResume resume = Resume.Get(context);
            string baseURI = WebConfigurationManager.AppSettings["BaseURI"];

            if (string.IsNullOrEmpty(baseURI))
                throw new InvalidOperationException("No baseURI appSetting found in web.config");

            string htmlMailText;

            if (hire)
            {
                htmlMailText = string.Format(ServiceResources.GenericMailTemplate,
                    ServiceResources.HireHeading,
                    string.Format(ServiceResources.OfferText, resume.Name),baseURI);
            }
            else
            {
                htmlMailText = string.Format(ServiceResources.GenericMailTemplate,
                    ServiceResources.NoHireHeading,
                    string.Format(ServiceResources.NoHireText, resume.Name), baseURI);
            }

            SmtpClient smtpClient = new SmtpClient();

            MailMessage msg = new MailMessage("[email protected]", resume.Email,
                string.Format(ServiceResources.ApplicationMailSubject), htmlMailText);
            msg.IsBodyHtml = true;

            smtpClient.Send(msg);
        }
开发者ID:Helen1987,项目名称:edu,代码行数:32,代码来源:NotifyApplicant.cs


示例5: Execute

        protected override void Execute(CodeActivityContext executionContext)
        {
            //Create the tracing service
            ITracingService tracingService = executionContext.GetExtension<ITracingService>();
            //Create the context
            IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();
            IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();
            IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
            Entity entity = null;
            var inputs = context.InputParameters;
            if (context.InputParameters.Contains("target"))
                entity = (Entity)context.InputParameters["target"];

            if (entity == null)
                return;
            DocLogic logic = new DocLogic(service);
            LoadDocParametersFactory loadDocParametersFactory = null;
            var subject = Subject.Get(executionContext);
            switch (entity.LogicalName)
            {
                case "opportunity":
                    loadDocParametersFactory = new OpportunityParametersFactory(service, entity, subject);
                    break;
                case "new_order":
                    loadDocParametersFactory = new OrderParametersFactory(service, entity, subject);
                    break;
                default:
                    loadDocParametersFactory = null;
                    break;
            }
            logic.Excute(loadDocParametersFactory);
        }
开发者ID:liorg,项目名称:DesignPatternsForXrm,代码行数:32,代码来源:DocsFindMissions.cs


示例6: Execute

        /// <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);
                }
            }
        }
开发者ID:GersonDias,项目名称:OpenSource,代码行数:35,代码来源:ReplaceDiagnosticsInfo.cs


示例7: Execute

 /// <summary>
 /// The execute.
 /// </summary>
 /// <param name="context">
 /// The context.
 /// </param>
 /// <exception cref="HttpResponseException">
 /// There is a matching ETag
 /// </exception>
 protected override void Execute(CodeActivityContext context)
 {
     if (this.Request.Get(context).Headers.IfMatch.Any(etag => EntityTag.IsMatchingTag(this.ETag.Get(context), etag.Tag)))
     {
         throw new HttpResponseException(HttpStatusCode.PreconditionFailed);
     }
 }
开发者ID:IcodeNet,项目名称:cleansolution,代码行数:16,代码来源:CheckIfMatch.cs


示例8: Execute

        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");
        }
开发者ID:napramirez,项目名称:build-process,代码行数:30,代码来源:SvnActivity.cs


示例9: Execute

        /// <summary>
        /// The execute.
        /// </summary>
        /// <param name="context">
        /// The context. 
        /// </param>
        protected override void Execute(CodeActivityContext context)
        {
            var args = this.Args ?? new object[0];

            Console.WriteLine(
                "[{0,2:00}] {1}", Thread.CurrentThread.ManagedThreadId, string.Format(this.Message, args));
        }
开发者ID:IcodeNet,项目名称:cleansolution,代码行数:13,代码来源:WriteLineThread.cs


示例10: Execute

        /// <summary>
        /// Executes the workflow activity.
        /// </summary>
        /// <param name="executionContext">The execution context.</param>
        protected override void Execute(CodeActivityContext executionContext)
        {
            // Create the tracing service
            ITracingService tracingService = executionContext.GetExtension<ITracingService>();

            if (tracingService == null)
            {
                throw new InvalidPluginExecutionException("Failed to retrieve tracing service.");
            }

            tracingService.Trace("Entered " + _processName + ".Execute(), Activity Instance Id: {0}, Workflow Instance Id: {1}",
                executionContext.ActivityInstanceId,
                executionContext.WorkflowInstanceId);

            // Create the context
            IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();

            if (context == null)
            {
                throw new InvalidPluginExecutionException("Failed to retrieve workflow context.");
            }

            tracingService.Trace(_processName + ".Execute(), Correlation Id: {0}, Initiating User: {1}",
                context.CorrelationId,
                context.InitiatingUserId);

            IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();
            IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);

            try
            {
                //do the regex match
                Match match = Regex.Match(StringToValidate.Get(executionContext), MatchPattern.Get(executionContext),
                    RegexOptions.IgnoreCase);

                //did we match anything?
                if (match.Success)
                {
                    Valid.Set(executionContext, 1);
                }
                else
                {
                    Valid.Set(executionContext, 0);
                }
            }
            catch (FaultException<OrganizationServiceFault> e)
            {
                tracingService.Trace("Exception: {0}", e.ToString());

                // Handle the exception.
                throw;
            }
            catch (Exception e)
            {
                tracingService.Trace("Exception: {0}", e.ToString());
                throw;
            }

            tracingService.Trace("Exiting " + _processName + ".Execute(), Correlation Id: {0}", context.CorrelationId);
        }
开发者ID:milos01,项目名称:Crm-Sample-Code,代码行数:64,代码来源:ValidateRegex.cs


示例11: Context

        internal Context(IGraywulfActivity activity, CodeActivityContext activityContext)
        {
            InitializeMembers();

            // Get job info from the scheduler
            var scheduler = activityContext.GetExtension<IScheduler>();

            if (scheduler != null)
            {
                Guid jobguid, userguid;
                string jobid, username;

                scheduler.GetContextInfo(
                    activityContext.WorkflowInstanceId,
                    out userguid, out username,
                    out jobguid, out jobid);

                this.userGuid = userguid;
                this.userName = username;
                this.jobGuid = jobguid;
                this.jobID = jobid;

                this.contextGuid = activityContext.WorkflowInstanceId;

                this.activityContext = activityContext;
                this.activity = activity;
            }
        }
开发者ID:skyquery,项目名称:graywulf,代码行数:28,代码来源:Context.cs


示例12: DoExecute

 protected override void DoExecute(CodeActivityContext context)
 {
     devlog.Debug(string.Format("Entered for '{0}'", adapterAppointment));
     var myAdapterAppointment = adapterAppointment.Get(context);
     devlog.Debug(string.Format("would call for '{0}'", myAdapterAppointment));
     AdapterAppointmentRepository.InsertOrUpdate(myAdapterAppointment);
 }
开发者ID:olekongithub,项目名称:synctoday2015,代码行数:7,代码来源:InsertAdapterAppointment.cs


示例13: Execute

        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);

        }
开发者ID:helmsb,项目名称:WorkflowWebApiExample,代码行数:30,代码来源:ValidateLoanIsComplete.cs


示例14: ExecuteOperation

        protected override string ExecuteOperation(CodeActivityContext context)
        {
            var hostedServiceName = context.GetValue<string>(HostedServiceName);
            var slot = context.GetValue(Slot).Description();
            var storageServiceName = context.GetValue<string>(StorageServiceName);
            var deploymentName = context.GetValue<string>(DeploymentName);
            var label = context.GetValue<string>(Label);
            var package = context.GetValue<string>(Package);
            var configuration = context.GetValue<string>(Configuration);

            if (string.IsNullOrEmpty(deploymentName))
            {
                deploymentName = Guid.NewGuid().ToString();
            }

            Uri packageUrl;
            if (package.StartsWith(Uri.UriSchemeHttp, StringComparison.OrdinalIgnoreCase) ||
                package.StartsWith(Uri.UriSchemeHttps, StringComparison.OrdinalIgnoreCase))
            {
                packageUrl = new Uri(package);
            }
            else
            {
                //upload package to blob
                var storageName = string.IsNullOrEmpty(storageServiceName) ? hostedServiceName : storageServiceName;
                packageUrl = this.RetryCall(s =>
                    AzureBlob.UploadPackageToBlob(
                    channel,
                    storageName,
                    s,
                    package));
            }

            //create new deployment package
            var deploymentInput = new CreateDeploymentInput
            {
                PackageUrl = packageUrl,
                Configuration = Utility.GetConfiguration(configuration),
                Label = ServiceManagementHelper.EncodeToBase64String(label),
                Name = deploymentName
            };

            using (new OperationContextScope((IContextChannel)channel))
            {
                try
                {
                    this.RetryCall(s => this.channel.CreateOrUpdateDeployment(
                        s,
                        hostedServiceName,
                        slot,
                        deploymentInput));
                }
                catch (CommunicationException ex)
                {
                    throw new CommunicationExceptionEx(ex);
                }

                return RetrieveOperationId();
            }
        }
开发者ID:chandermani,项目名称:deployToAzureTFS2013,代码行数:60,代码来源:NewDeployment.cs


示例15: Execute

        // 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);

        }
开发者ID:yinqunjun,项目名称:WorkflowFoundation.40.45.Development,代码行数:31,代码来源:lookupItems.cs


示例16: Execute

        protected override void Execute(CodeActivityContext context)
        {
            string scriptPath = ScriptPath.Get(context);
            string scriptContents = null;

            if (!(Path.IsPathRooted(scriptPath)))
                scriptPath = Path.Combine(Directory.GetCurrentDirectory(), scriptPath);

            if (File.Exists(scriptPath))
                scriptContents = File.ReadAllText(scriptPath);
            else
                throw new FileNotFoundException(String.Format("Powershell script file {0} does not exist.", scriptPath));

            Runspace runSpace = RunspaceFactory.CreateRunspace();
            runSpace.Open();

            RunspaceInvoke runSpaceInvoker = new RunspaceInvoke(runSpace);

            Pipeline pipeLine = runSpace.CreatePipeline();
            pipeLine.Commands.AddScript(scriptContents);
            pipeLine.Commands.Add("Out-String");

            Collection<PSObject> returnObjects = pipeLine.Invoke();
            runSpace.Close();
        }
开发者ID:bejubi,项目名称:MmapMan,代码行数:25,代码来源:ExecutePowershellScript.cs


示例17: DoExecute

 protected override void DoExecute(CodeActivityContext context)
 {
     devlog.Debug(string.Format("Called on '{0}'", ExchangeAppointment));
     var myExchangeAppointment = ExchangeAppointment.Get(context);
     devlog.Debug(string.Format("myExchangeAppointment:'{0}'", myExchangeAppointment));
     ExchangeRepository.insertOrUpdate(myExchangeAppointment);
 }
开发者ID:olekongithub,项目名称:synctoday2015,代码行数:7,代码来源:SaveExchangeAppointment.cs


示例18: Execute

        // 如果活动返回值,则从 CodeActivity<TResult>
        // 并从 Execute 方法返回该值。
        protected override void Execute(CodeActivityContext context)
        {
            // 获取 Text 输入参数的运行时值
            string text = context.GetValue(this.Text);

            //1
        }
开发者ID:evaseemefly,项目名称:PMS,代码行数:9,代码来源:GetObjFromRedis_Code.cs


示例19: Execute

        protected override void Execute(CodeActivityContext context)
        {
            // Open the config file and get the Request Address
            Configuration config = ConfigurationManager
                .OpenExeConfiguration(ConfigurationUserLevel.None);
            AppSettingsSection app =
                (AppSettingsSection)config.GetSection("appSettings");

            // Create a ReservationRequest class and populate 
            // it with the input arguments
            ReservationRequest r = new ReservationRequest
                (
                    Title.Get(context),
                    Author.Get(context),
                    ISBN.Get(context),
                    new Branch
                    {
                        BranchName = app.Settings["Branch Name"].Value,
                        BranchID = new Guid(app.Settings["ID"].Value),
                        Address = app.Settings["Address"].Value
                    },
                    context.WorkflowInstanceId
                );

            // Store the request in the OutArgument
            Request.Set(context, r);

            // Store the address in the OutArgument
            RequestAddress.Set(context, app.Settings["Request Address"].Value);
        }
开发者ID:yinqunjun,项目名称:WorkflowFoundation.40.45.Development,代码行数:30,代码来源:CreateRequest.cs


示例20: Execute

        /// <summary>
        /// NOTE: When you add this activity to a workflow, you must set the following properties:
        ///
        /// URL - manually add the URL to which you will be posting data.  For example: http://myserver.com/ReceivePostURL.aspx  
        ///		 See this sample's companion file 'ReceivePostURL.aspx' for an example of how the receiving page might look.
        ///
        /// AccountName - populate this property with the Account's 'name' attribute.
        ///
        /// AccountNum - populate this property with the Account's 'account number' attribute.
        /// </summary>
        protected override void Execute(CodeActivityContext executionContext)
        {
            IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();
            IOrganizationServiceFactory serviceFactory =
                executionContext.GetExtension<IOrganizationServiceFactory>();
            IOrganizationService service =
                serviceFactory.CreateOrganizationService(context.UserId);

            // Build data that will be posted to a URL
            string postData = "Name=" + this.AccountName.Get(executionContext) + "&AccountNum=" + this.AccountNum.Get(executionContext);

            // Encode the data
            ASCIIEncoding encoding = new ASCIIEncoding();
            byte[] encodedPostData = encoding.GetBytes(postData);

            // Create a request object for posting our data to a URL
            Uri uri = new Uri(this.URL.Get(executionContext));
            HttpWebRequest urlRequest = (HttpWebRequest)WebRequest.Create(uri);
            urlRequest.Method = "POST";
            urlRequest.ContentLength = encodedPostData.Length;
            urlRequest.ContentType = "application/x-www-form-urlencoded";

            // Add the encoded data to the request	
            using (Stream formWriter = urlRequest.GetRequestStream())
            {
                formWriter.Write(encodedPostData, 0, encodedPostData.Length);
            }

            // Post the data to the URL			
            HttpWebResponse urlResponse = (HttpWebResponse)urlRequest.GetResponse();
        }
开发者ID:cesugden,项目名称:Scripts,代码行数:41,代码来源:PostUrl.cs



注:本文中的CodeActivityContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CodeBinaryOperatorType类代码示例发布时间:2022-05-24
下一篇:
C# Code类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap