Ejemplo n.º 1
0
        /// <summary>
        /// Create a new process and disable it
        /// </summary>
        private static void AddAndEditProcess()
        {
            string processName               = "My New Process";
            string processParetName          = "Agile";
            string processDescription        = "My New Process";
            string processDescriptionUpdated = "My New Updated Process";

            var processes = ProcessHttpClient.GetListOfProcessesAsync().Result;

            var parentProcessId = (from p in processes where p.Name == processParetName select p.TypeId).FirstOrDefault();

            if (parentProcessId != null)
            {
                var newProcess = ProcessHttpClient.CreateNewProcessAsync(new CreateProcessModel()
                {
                    Name = processName, Description = processDescription, ParentProcessTypeId = parentProcessId
                }).Result;

                Console.WriteLine("New process: " + newProcess.Name);
                Console.WriteLine("New process Id: " + newProcess.TypeId);

                ProcessHttpClient.EditProcessAsync(new UpdateProcessModel {
                    Description = processDescriptionUpdated, IsEnabled = false
                }, newProcess.TypeId);
            }
            else
            {
                Console.WriteLine("Can not find parent project");
            }
        }