private void LoadStatus_Click(object sender, RoutedEventArgs e) { EmplWorkflows ew = (EmplWorkflows)emplWorkflowsDataGrid.CurrentItem; Button b = (Button)sender; try { EmployeeOnBoarding.OnBoardingServiceClient cli = new EmployeeOnBoarding.OnBoardingServiceClient(); string[] ret = cli.getWorkflowStatus(new Guid(ew.wfID)); string t = ""; foreach (string r in ret) { t += r + Environment.NewLine; } ew.wfStatus = t; entities.SaveChanges(); } catch (Exception ex) { b.Tag = ex.Message; } finally { b.Visibility = Visibility.Collapsed; } }
// Wenn durch die Aktivität ein Wert zurückgegeben wird, erfolgt eine Ableitung von CodeActivity<TResult> // und der Wert von der Ausführmethode zurückgegeben. protected override void Execute(CodeActivityContext context) { HRONEntities dbcontext = new HRONEntities(); // Cerco parent WF EmplWorkflows ewf = null; if (parentWFId.Get(context) != null) { ewf = dbcontext.EmplWorkflows.Where(w => w.wfID == parentWFId.ToString()).FirstOrDefault(); } WFApprovals approval = new WFApprovals(); approval.approverWFID = WFId.Get(context); approval.approverActivityID = ActivityId.Get(context); approval.body = body.Get(context); approval.mail = to.Get(context); approval.subject = subject.Get(context); approval.starttime = DateTime.Now; if (ewf != null) { approval.Parent = ewf; } dbcontext.WFApprovals.Add(approval); dbcontext.SaveChanges(); }
private void startWorkflow_Click(object sender, RoutedEventArgs e) { Button button = (Button)sender; int id = (int)button.Tag; baWorkflows workflow = entities.baWorkflows.Where(b => b.wfID == id).First(); EmployeeOnBoarding.OnBoardingServiceClient client = new EmployeeOnBoarding.OnBoardingServiceClient(); Guid wfid = client.StartProcess(actualEmployee.UnProxy <Employee>(entities), workflow.WorkFlowXAML); EmplWorkflows w = new EmplWorkflows(); w.wfEmplID = actualEmployee.emplID; w.wfID = wfid.ToString(); w.wfStartingDate = DateTime.Now; w.wfStartingDate = w.wfStartingDate.AddMilliseconds(-1 * w.wfStartingDate.Millisecond); w.wfType = workflow; entities.EmplWorkflows.Add(w); entities.SaveChanges(); }