Sunday, July 4, 2010

Parallel Workflow






Workflow.cs

using System;

using System.ComponentModel;

using System.ComponentModel.Design;

using System.Collections;

using System.Drawing;

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;
namespace WorkflowConsoleApplication7

{

public sealed partial class Workflow3: SequentialWorkflowActivity

{

public Workflow3()

{

InitializeComponent();

}
private void codeActivity1_ExecuteCode(object sender, EventArgs e) { Console.WriteLine("Start");
}
private void codeActivity2_ExecuteCode(object sender, EventArgs e) {

Console.WriteLine("Left side flow");

}
private void codeActivity3_ExecuteCode(object sender, EventArgs e) {

Console.WriteLine("Right side flow");

}
private void codeActivity4_ExecuteCode(object sender, EventArgs e) {

Console.WriteLine("End");

Console.ReadLine();

}

}
}


Program.cs

using System;using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Workflow.Runtime;
using System.Workflow.Runtime.Hosting;
namespace WorkflowConsoleApplication7
{ class Program
{
static void Main(string[] args)
{
using(WorkflowRuntime workflowRuntime = new WorkflowRuntime())
{
AutoResetEvent waitHandle = new AutoResetEvent(false); workflowRuntime.WorkflowCompleted += delegate(object sender, WorkflowCompletedEventArgs e) {waitHandle.Set();}; workflowRuntime.WorkflowTerminated += delegate(object sender, WorkflowTerminatedEventArgs e)
{
Console.WriteLine(e.Exception.Message);
waitHandle.Set();
};
WorkflowInstance instance = workflowRuntime.CreateWorkflow(typeof(WorkflowConsoleApplication7.Workflow3));
instance.Start();
waitHandle.WaitOne();
}
}
}
}




Sharepoint workflow IfElse Condition

Custom workFlow IfElse Condition




workflow.cs
using System;

using System.ComponentModel;

using System.ComponentModel.Design;

using System.Collections;using System.Drawing;

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;
namespace WorkflowConsoleApplication7

{

public sealed partial class Workflow2: SequentialWorkflowActivity

{

public Workflow2()

{

InitializeComponent();

}

private string x;
private void codeActivity2_ExecuteCode(object sender, EventArgs e)

{

Console.WriteLine("yes"); Console.ReadLine();

}
private void codeActivity3_ExecuteCode(object sender, EventArgs e)

{

Console.WriteLine("no");

Console.ReadLine();

}
private void codeActivity1_ExecuteCode(object sender, EventArgs e)

{

Console.WriteLine("Type yes/no");

x = Convert.ToString(Console.ReadLine());

}
}
}

program.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Workflow.Runtime;
using System.Workflow.Runtime.Hosting;
namespace WorkflowConsoleApplication7
{
class Program
{
static void Main(string[] args)
{
using(WorkflowRuntime workflowRuntime = new WorkflowRuntime())
{
AutoResetEvent waitHandle = new AutoResetEvent(false); workflowRuntime.WorkflowCompleted += delegate(object sender, WorkflowCompletedEventArgs e) {waitHandle.Set();
};
workflowRuntime.WorkflowTerminated += delegate(object sender, WorkflowTerminatedEventArgs e)
{
Console.WriteLine(e.Exception.Message);
waitHandle.Set();
};
WorkflowInstance instance = workflowRuntime.CreateWorkflow(typeof(WorkflowConsoleApplication7.Workflow2));
instance.Start();
waitHandle.WaitOne();
}
}
}
}

Sharepoint Workflow

Code Activity
it is a simple workflow to display the "Hello world"


program.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Workflow.Runtime;
using System.Workflow.Runtime.Hosting;
namespace WorkflowConsoleApplication7
{
class Program { static void Main(string[] args)
{
using(WorkflowRuntime workflowRuntime = new WorkflowRuntime())
{
AutoResetEvent waitHandle = new AutoResetEvent(false); workflowRuntime.WorkflowCompleted += delegate(object sender, WorkflowCompletedEventArgs e)
{
waitHandle.Set();
};
workflowRuntime.WorkflowTerminated += delegate(object sender, WorkflowTerminatedEventArgs e) { Console.WriteLine(e.Exception.Message); waitHandle.Set(); };
WorkflowInstance instance = workflowRuntime.CreateWorkflow(typeof(WorkflowConsoleApplication7.Workflow1)); instance.Start();
waitHandle.WaitOne();
}
}
}
}

workflow.cs

using System;

using System.ComponentModel;

using System.ComponentModel.Design;

using System.Collections;

using System.Drawing;

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;
namespace WorkflowConsoleApplication7

{

public sealed partial class Workflow1: SequentialWorkflowActivity

{

public Workflow1()

{

InitializeComponent();

}
private void codeActivity1_ExecuteCode(object sender, EventArgs e) { Console.WriteLine("Hello world");

Console.ReadLine();

}

}
}

Thursday, January 28, 2010

Gridview validation using sever controls

Default.aspx

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
onrowcancelingedit="GridView1_RowCancelingEdit"
onrowediting="GridView1_RowEditing">

<Columns>
<asp:BoundField DataField ="id" HeaderText ="id" ReadOnly="true" />

<asp:TemplateField HeaderText ="name">
<ItemTemplate >
<asp:Label ID="Label1" runat="server" Text='<%#Eval("name") %>'></asp:Label>

</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%#Eval("name") %>'></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Please enter the data" ControlToValidate ="TextBox1"></asp:RequiredFieldValidator>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText ="fathername">
<ItemTemplate >
<asp:Label ID="Label2" runat="server" Text='<%#Eval("fathername") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%#Eval("fathername") %>'></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Please enter the data" ControlToValidate ="TextBox2" ></asp:RequiredFieldValidator>
</EditItemTemplate>
</asp:TemplateField>
<asp:CommandField ShowEditButton="True" />
</Columns>
</asp:GridView>



Default.aspx.cs

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindDataToGrid();
}
}
public DataSet BindDataToGrid()
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ToString());
SqlCommand cmd = new SqlCommand("select * from employee", con); SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
return ds;
}

protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
BindDataToGrid();
}
protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
GridView1.EditIndex = -1;
BindDataToGrid();
}

Thursday, January 21, 2010

SharePoint Sites and workspaces

Creating Sites and workspaces :
Step1:Click on site Settings under the Site Action Section.

Step2: Click on Sites and workspaces.Under the Site Administration Section.
Step3: Click on new Button.

Step4:Enter the Title,Description and URL name.


Step5:select Team Site under the template section.


Step6:Now Site is Created."Job"






























SharePoint Save site as template

Creating Custom List as Template
Step1: open the Custom List.
Step2: Click on List Settings under the settings section.

step3:Click on Save list as template under the Save list as template section.

Step4:Enter the new List name.



Step5:Now new List is Created.Click on OK Button.



Step6:Click on the Create under the site Action section

Step7: Now New List is Available "TaskList" under Tracking Section.








Wednesday, January 20, 2010

SharePoint Tree view

Setup Enable Quick Launch :
Step1: Click on Site Settings under the Site Action. Right side of the page
Step2: Click on Tree View under the Look and Feel Section.

Step3: Select Quick Launch Check Box.


Step4:Now Quick Launch is Updated.