public CommandInfo doCommand(CommandInfo CommandInfo) { CommandInteraction cmdInteraction = new CommandInteraction(); Dictionary<string, string> paras = new Dictionary<string, string>(); foreach (Parameter p in CommandInfo.ParameterList) { paras.Add(p.Name, p.Value); } cmdInteraction.executeCommand(CommandInfo.CommandName, paras); TrackingWorkFlowInteraction twfi = new TrackingWorkFlowInteraction(); twfi.doCommand(CommandInfo); return CommandInfo; }
public void doCommand(CommandInfo commandInfo) { Assembly trackingWorkFlowAssembly = Assembly.Load("TrackingWorkFlow"); Type[] types = trackingWorkFlowAssembly.GetTypes(); foreach (Type t in types) { if (t.Name.Equals(commandInfo.WFName)) { Type tt = typeof(String); ConstructorInfo ci = t.GetConstructor(new Type[] { tt }); using (TrackingWorkFlow twf = (TrackingWorkFlow)(ci.Invoke(new object[] { commandInfo.InstanceId }))) { twf.AcceptCommand(commandInfo.CommandName); } } } }
public CommandInfo doCommand(CommandInfo CommandInfo) { CommandInfo.CommandName = CommandInfo.CommandName.Trim(); try { CommandInteraction cmdInteraction = new CommandInteraction(); Dictionary<string, string> paras = new Dictionary<string, string>(); paras.Add("InstanceId", CommandInfo.InstanceId); paras.Add("WFName", CommandInfo.WFName); if (CommandInfo.ParameterList != null) { foreach (Parameter p in CommandInfo.ParameterList) { paras.Add(p.Name, p.Value); } } TrackingDataContext tdc = new TrackingDataContext(); Guid guid = new Guid(CommandInfo.InstanceId); IQueryable<CommonResource.Tracking> trackingQuery = from tracking in tdc.Trackings where ((tracking.wfinstanceid == guid)) select tracking; foreach (CommonResource.Tracking t in trackingQuery) { t.lastmodifiedby = AuthenticationHelper.GetCurrentUser(); } //CommonResource.Tracking t = new CommonResource.Tracking(); //t.wfname = this.WFName; //t.bugid = bugId; //t.wfinstanceid = new Guid(this.InstanceId); //tdc.Trackings.InsertOnSubmit(t); tdc.SubmitChanges(); cmdInteraction.executeCommand(CommandInfo.CommandName, paras);//this is do the real action in extension TrackingWorkFlowInteraction twfi = new TrackingWorkFlowInteraction(); twfi.doCommand(CommandInfo);// this is just trigger the state machine(WF) to do one step } catch (Exception e) { throw new WebFaultException<string>(e.ToString(), HttpStatusCode.InternalServerError); } return CommandInfo; }
public WorkFlowInstance startWorkFlow(CommandInfo CommandInfo) { string WFName = CommandInfo.WFName; TrackingWorkFlowInteraction twfi = new TrackingWorkFlowInteraction(); string id=twfi.startProcess(WFName); WorkFlowInstance wfi = new WorkFlowInstance(); wfi.Id = id; List<string> candCmds = twfi.getCandidateCommands(WFName, id); CandidateCommandList ccl = new CandidateCommandList(); ccl.AddRange(candCmds); wfi.CandidateCommandList = ccl; return wfi; }
public WorkFlowInstance startWorkFlow(CommandInfo CommandInfo) { WorkFlowInstance wfi = new WorkFlowInstance(); try { string WFName = CommandInfo.WFName.Trim(); TrackingWorkFlowInteraction twfi = new TrackingWorkFlowInteraction(); string id = twfi.startProcess(WFName); CommandInteraction cmdInteraction = new CommandInteraction(); Dictionary<string, string> paras = new Dictionary<string, string>(); paras.Add("InstanceId", id); paras.Add("WFName", CommandInfo.WFName); if (CommandInfo.ParameterList != null) { foreach (Parameter p in CommandInfo.ParameterList) { paras.Add(p.Name, p.Value); } } TrackingWorkFlowInteraction II = new TrackingWorkFlowInteraction(); StateMachineDefinition statemachineDefinition = II.getStateMachineDefinition(CommandInfo.WFName); paras.Add("QFEStatus", statemachineDefinition.InitialState); cmdInteraction.executeCommand(CommandInfo.CommandName, paras); wfi.Id = id; List<string> candCmds = twfi.getCandidateCommands(WFName, id); CandidateCommandList ccl = new CandidateCommandList(); ccl.AddRange(candCmds); wfi.CandidateCommandList = ccl; } catch (Exception e) { throw new WebFaultException<string>(e.ToString(), HttpStatusCode.InternalServerError); // TrackingLog.Log(e.Message + "!!" + e.ToString()); } return wfi; }
static void testStartProcess() { TrackingService.TrackingService ts = new TrackingService.TrackingService(); CommandInfo ci = new CommandInfo(); ci.WFName = "SESample2TrackingWorkFlow"; //WorkFlowInstance wfi=ts.startWorkFlow(ci); //ci.InstanceId = "f3875fd4-8bf2-4774-a754-928fcef66e5c"; ci.CommandName = "ProcessStart"; ci.ParameterList = ts.GetParameters(ci.CommandName); ts.startWorkFlow(ci); WorkFlowInstance wfi = ts.GetWorkFlowInstance(ci.InstanceId); Console.WriteLine("shi"); }