Thursday, November 27, 2008

Hosting of WorkFlow at WCF

Hosting through Web app
protected void btnSubmit_Click(object sender, EventArgs e)
{
WorkflowRuntime WFRuntime = new WorkflowRuntime();
WFRuntime.StartRuntime();
ExternalDataExchangeService edx = new ExternalDataExchangeService();
WFRuntime.AddService(edx);
edx.AddService(new ApproveReq ());
Anada.AbsenceManager.Workflow.Model.Request Req = new Anada.AbsenceManager.Workflow.Model.Request();
Req.RequestId = 1;
Req.EmployeeId = 1;
Req.BossId = 3 ;
Req.StartDate = DateTime.Now;
Req.EndDate = DateTime.Now.AddDays(5);
Req.RequestStateId = 4;
Req.RequestTypeId = 1;
Req.UserName = "Prakash";
Req.CreateDate = DateTime.Now;
Req.ModifyDate = DateTime.Now;
Req.RequestDate = DateTime.Now;
Dictionary paras = new Dictionary();
//paras.Add("CountryID", Convert.ToInt32(txtCountryID .Text));
//paras.Add("mPersonId", Convert.ToInt32(txtPersonId .Text));
//paras.Add("CalendarId",Convert.ToInt32(txtCalendarId .Text));
//paras.Add("username", "Prakash");
//paras.Add("FromDate", Req.StartDate);
//paras.Add("ToDate", Req.EndDate);
//paras.Add("FromDate", Convert.ToDateTime(txtFromDate.Text));
paras.Add("mAppRequest", Req);
////WFSvc.WorkFlowSVCClient obj = new WFSvc.WorkFlowSVCClient();
////obj.GetRequestWFInstance(Anada.AbsenceManager.Workflow.Flows.Request mrequest, ////paras);
WorkflowInstance instance = WFRuntime.CreateWorkflow(typeof(Anada.AbsenceManager.Workflow.Flows.ApproveRequest), paras);
//instance.Start();
}

No comments:

Post a Comment