Example #1
0
        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");
     }
 }
Example #3
0
        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();
            }
        }
Example #4
0
        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);
        }
Example #5
0
 private static void GetSchedules()
 {
     ZzaService.ZzaServiceClient client = new ZzaServiceClient();
     Schedules = client.GetSchedules(null).ToList();
 }
Example #6
0
 private static void GetJobs()
 {
     ZzaService.ZzaServiceClient client = new ZzaServiceClient();
     Jobs = client.GetTaskInfo(null).ToList();
 }
Example #7
0
 private static void GetMachines()
 {
     ZzaService.ZzaServiceClient client = new ZzaServiceClient();
     Machines = client.GetMachineInfo(null).ToList();
 }
Example #8
0
 private static void GetJobs()
 {
     ZzaService.ZzaServiceClient client = new ZzaServiceClient();
     Jobs = client.GetTaskInfo(null).ToList();
 }
Example #9
0
 private static void GetSchedules()
 {
     ZzaService.ZzaServiceClient client = new ZzaServiceClient();
     Schedules = client.GetSchedules(null).ToList();
 }
Example #10
0
 private static void GetMachines()
 {
     ZzaService.ZzaServiceClient client = new ZzaServiceClient();
     Machines = client.GetMachineInfo(null).ToList();
 }
Example #11
0
 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");
     }
 }