public void Execute(IJobExecutionContext context) { string output; ZzaService.ZzaServiceClient client = new ZzaServiceClient(); JobDataMap dataMap = context.JobDetail.JobDataMap; Console.WriteLine(string.Format("{0} is executing.", dataMap.GetString("taskname"))); ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); startInfo.UseShellExecute = false; startInfo.Arguments = dataMap.GetString("remotepc") + " -u " + dataMap.GetString("username") + " -p " + dataMap.GetString("password") + " -d -i " + dataMap.GetString("command"); startInfo.FileName = "PsExec "; startInfo.WorkingDirectory = @"c:\windows\system32\"; startInfo.RedirectStandardError = true; startInfo.RedirectStandardOutput = true; using (Process process = Process.Start(startInfo)) { using (StreamReader reader1 = process.StandardOutput) { output= reader1.ReadToEnd(); } using (StreamReader reader2 = process.StandardError) { output += reader2.ReadToEnd(); } } if (string.IsNullOrEmpty(output)) output = "Job Ran Successfully"; dataMap.Add("Output",output); client.TaskDone(dataMap.GetIntValue("TaskId"),output); }
private void OnSubmitOrder() { if (_CurrentOrder.CustomerId != Guid.Empty && _CurrentOrder.OrderItems.Count > 0) { ZzaServiceClient proxy = new ZzaServiceClient("NetTcpBinding_IZzaService"); try { proxy.SubmitOrder(_CurrentOrder); CurrentOrder = new Order(); CurrentOrder.OrderDate = DateTime.Now; CurrentOrder.OrderStatusId = 1; Items = new ObservableCollection <OrderItemModel>(); } catch (Exception ex) { MessageBox.Show("Error saving order, please try again later."); } finally { proxy.Close(); } } else { MessageBox.Show("You must select a customer and add order items to submit an order"); } }
private async void LoadProductsAndCustomers() { var proxy = new ZzaServiceClient("NetTcpBinding_IZzaService"); try { Products = await proxy.GetProductsAsync(); Customers = await proxy.GetCustomersAsync(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { proxy.Close(); } }
public void Execute(IJobExecutionContext context) { string output; ZzaService.ZzaServiceClient client = new ZzaServiceClient(); JobDataMap dataMap = context.JobDetail.JobDataMap; Console.WriteLine(string.Format("{0} is executing.", dataMap.GetString("taskname"))); ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); startInfo.UseShellExecute = false; startInfo.Arguments = dataMap.GetString("remotepc") + " -u " + dataMap.GetString("username") + " -p " + dataMap.GetString("password") + " -d -i " + dataMap.GetString("command"); startInfo.FileName = "PsExec "; startInfo.WorkingDirectory = @"c:\windows\system32\"; startInfo.RedirectStandardError = true; startInfo.RedirectStandardOutput = true; using (Process process = Process.Start(startInfo)) { using (StreamReader reader1 = process.StandardOutput) { output = reader1.ReadToEnd(); } using (StreamReader reader2 = process.StandardError) { output += reader2.ReadToEnd(); } } if (string.IsNullOrEmpty(output)) { output = "Job Ran Successfully"; } dataMap.Add("Output", output); client.TaskDone(dataMap.GetIntValue("TaskId"), output); }
private static void GetSchedules() { ZzaService.ZzaServiceClient client = new ZzaServiceClient(); Schedules = client.GetSchedules(null).ToList(); }
private static void GetJobs() { ZzaService.ZzaServiceClient client = new ZzaServiceClient(); Jobs = client.GetTaskInfo(null).ToList(); }
private static void GetMachines() { ZzaService.ZzaServiceClient client = new ZzaServiceClient(); Machines = client.GetMachineInfo(null).ToList(); }
private void OnSubmitOrder() { if(_CurrentOrder.CustomerId != Guid.Empty && _CurrentOrder.OrderItems.Count > 0) { ZzaServiceClient proxy = new ZzaServiceClient("NetTcpBinding_IZzaService"); try { proxy.SubmitOrder(_CurrentOrder); CurrentOrder = new Order(); CurrentOrder.OrderDate = DateTime.Now; CurrentOrder.OrderStatusId = 1; Items = new ObservableCollection<OrderItemModel>(); } catch (Exception ex) { MessageBox.Show("Error saving order, please try again later."); } finally { proxy.Close(); } } else { MessageBox.Show("You must select a customer and add order items to submit an order"); } }