Search This Blog

Monday, May 6, 2013

Sharepoint 2010 Sequential Workflow using Ifelse condition



using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Drawing;
using System.Linq;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Workflow;
using Microsoft.SharePoint.WorkflowActions;

namespace IfElseCondition.Workflow1
{
    public sealed partial class Workflow1 : SequentialWorkflowActivity
    {
        public Workflow1()
        {
            InitializeComponent();
        }

        public Guid workflowId = default(System.Guid);
        public SPWorkflowActivationProperties workflowProperties = new SPWorkflowActivationProperties();

        int _pricevalue = 0;
        public int PriceValue
        {
            get
            {
                return this._pricevalue;
            }
            set
            {
                this._pricevalue = value;
            }
        }
        public bool iresult = true;

        private void Ifcodeexecute(object sender, EventArgs e)
        {

            try
            {
                workflowProperties.Item["Status"] = "Good";
                workflowProperties.Item.Update();
            }
            catch (Exception ex)
            {

            }
         
        }

        private void elseCodeExecute(object sender, EventArgs e)
        {

            try
            {
                workflowProperties.Item["Status"] = "Bad";
                workflowProperties.Item.Update();
            }
            catch (Exception ex)
            {

            }

         
        }

        private void onWorkflowActivated1_Invoked(object sender, ExternalDataEventArgs e)
        {
            if (iresult == false)
            {

            }


        }

        private void CodeActivityforIfelse(object sender, EventArgs e)
        {
            try
            {
                this._pricevalue = Convert.ToInt32(workflowProperties.Item["Price"].ToString());
            }
            catch (Exception ex)
            {

            }
        }

        private void FinalOutput(object sender, EventArgs e)
        {

         
        }
    }
}

1 comment:

  1. JFYI - a solution contains more 200 custom actions and conditions for SharePoint Workflows: http://www.harepoint.com/Products/HarePointWorkflowExtensions/Default.aspx

    ReplyDelete