Update() public method

public Update ( ) : void
return void
Ejemplo n.º 1
0
        public ActionResult Edit(JobInfo model, int jobid)
        {
            JobInfo jobinfo = Job.GetModelByJobID(jobid);

            if (jobinfo == null)
            {
                return(PromptView("信息不存在"));
            }

            if (ModelState.IsValid)
            {
                jobinfo.JobTitle = model.JobTitle;
                jobinfo.PubDate  = model.PubDate;
                jobinfo.EndDate  = model.EndDate;
                jobinfo.Number   = model.Number;
                jobinfo.State    = model.State;
                jobinfo.Body     = model.Body;
                jobinfo.City     = model.City;

                Job.Update(jobinfo);

                return(PromptView("信息修改成功!"));
            }

            return(View(model));
        }
Ejemplo n.º 2
0
    private IEnumerator ExecuteCoroutine(Job job, float duration)
    {
        if (job.OnStart != null)
        {
            job.OnStart();
        }

        float startTime = Time.realtimeSinceStartup;
        float endTime   = startTime + duration;

        do
        {
            yield return(null);

            float t = Time.realtimeSinceStartup > endTime ? 1f : (Time.realtimeSinceStartup - startTime) / duration;
            if (!job.Update(Time.deltaTime, t))
            {
                break;
            }
        } while (Time.realtimeSinceStartup <= endTime);

        if (job.OnEnd != null)
        {
            job.OnEnd();
        }
    }
Ejemplo n.º 3
0
    bool Update()
    {
        objJob         = new Job();
        objJob.JobID   = Convert.ToInt32(txtID.Text.Trim());
        objJob.JobName = txtJobName.Text.Trim();

        return(objJob.Update(p => p.JobID == objJob.JobID));
    }
Ejemplo n.º 4
0
        public void Throw_Exception_If_Repeat_End_Strategy_With_No_Interval()
        {
            var job = new Job("sub name", "ident", "test");

            Action act = () => job.Update(null, DateTime.Now.AddMinutes(30), DateTime.Now.AddHours(30), RepeatEndStrategy.OnEndDate, RepeatInterval.Never, 0, "test");

            act.Should()
            .Throw <ArgumentException>()
            .WithMessage($"a {nameof(Job.RepeatEndStrategy)} with no {nameof(Job.RepeatInterval)} doesn't make sense");
        }
Ejemplo n.º 5
0
 public HttpResponseMessage Save([FromBody] Job job)
 {
     if (job.ID > 0)
     {
         return(Request.CreateResponse(HttpStatusCode.OK, job.Update()));
     }
     else
     {
         return(Request.CreateResponse(HttpStatusCode.OK, job.Save()));
     }
 }
Ejemplo n.º 6
0
 void Update()
 {
     if (myJob != null)
     {
         if (myJob.Update())
         {
             // Alternative to the OnFinished callback
             myJob = null;
         }
     }
 }
Ejemplo n.º 7
0
    void Update()
    {
        //Se existir alguma simulação em andamento
        if (gameJobThread != null)
        {
            //Verifica se acabou o processo a cada frame
            if (gameJobThread.Update())
            {
                gameJobThread = null;

                //Volta ao estado inicial do jogo
                onStartClick();
            }
        }
    }
Ejemplo n.º 8
0
        private static async Task TestSchedulingApi(ISchedulingApiService apiService, string subscriptionName)
        {
            Console.WriteLine(@"
| *************************************************************************************************|
| Enter one of the following keys to test the scheduler:                                           |
| *************************************************************************************************|
| a - Add or Update a job (will start in 1 minute and will run every minute)                       |
| d - Delete a job                                                                                 |
| g - Get a job                                                                                    |
| l - Load test by calling Add Or Update X number of times                                         |
| p - Pause an existing job                                                                        |
| r - Resume an existing job                                                                       |
| q - Quit                                                                                         |
| -------------------------------------------------------------------------------------------------|
");
            // TODO: Right now this is quick and dirty, it could be refactored and enhanced in many ways
            await Task.Run(async() =>
            {
                while (true)
                {
                    try
                    {
                        Job job;
                        string jobIdentifier;
                        var key = Console.ReadKey(true);

                        switch (key.KeyChar)
                        {
                        case 'q':
                        case 'Q':
                            return;

                        case 'a':
                        case 'A':
                            Console.Write("[UPSERT] Enter Job Identifier: ");
                            jobIdentifier = Console.ReadLine();
                            Console.Write("[UPSERT] How many times to run?: ");
                            var numberOfTimesToRunInput = Console.ReadLine();
                            if (!int.TryParse(numberOfTimesToRunInput, out var numberOfRuns) || numberOfRuns < 1)
                            {
                                Console.WriteLine("[UPSERT] Must be a valid and positive integer. Aborting command");
                            }
                            else
                            {
                                job = new Job(subscriptionName, jobIdentifier, "tester");
                                job.Update("testing domain", DateTime.Now.AddMinutes(1), null, RepeatEndStrategy.NotUsed, RepeatInterval.NotUsed, numberOfRuns, "test", "0 * * ? * *");
                                job.SetActivationStatus(true, "tester");
                                await apiService.AddOrUpdateJob(job);
                            }

                            break;

                        case 'd':
                        case 'D':
                            Console.Write("[DELETE] Enter Job Identifier: ");
                            jobIdentifier = Console.ReadLine();
                            await apiService.DeleteJob(new JobLocator(subscriptionName, jobIdentifier));
                            break;

                        case 'g':
                        case 'G':
                            Console.Write("[GET] Enter Job Identifier: ");
                            jobIdentifier = Console.ReadLine();
                            job           = await apiService.GetJob(new JobLocator(subscriptionName, jobIdentifier));
                            Console.WriteLine($"Job: {(job == null ? "Does not exist" : JsonConvert.SerializeObject(job))}");
                            break;

                        case 'l':
                        case 'L':
                            Console.Write("[LOAD] Enter Base for Identifier: ");
                            jobIdentifier = Console.ReadLine();
                            Console.Write("[LOAD] How many Add Or Update calls to make? ");
                            var numberOfCallsInput = Console.ReadLine();
                            if (!int.TryParse(numberOfCallsInput, out var numberOfCalls) || numberOfCalls < 1)
                            {
                                Console.WriteLine("[LOAD] Must be a valid and positive integer. Aborting command");
                            }
                            else
                            {
                                while (numberOfCalls > 0)
                                {
                                    job = new Job(subscriptionName, $"{jobIdentifier}-{numberOfCalls--}", "tester");
                                    job.Update($"load testing domain - {numberOfCalls}", DateTime.Now.AddMinutes(1), null, RepeatEndStrategy.NotUsed, RepeatInterval.NotUsed, 0, "load test");
                                    job.SetActivationStatus(true, "load tester");
                                    await apiService.AddOrUpdateJob(job);
                                }
                            }

                            break;

                        case 'p':
                        case 'P':
                            Console.Write("[PAUSE] Enter Job Identifier: ");
                            jobIdentifier = Console.ReadLine();
                            job           = await apiService.GetJob(new JobLocator(subscriptionName, jobIdentifier));
                            job.SetActivationStatus(false, "tester pause");
                            await apiService.AddOrUpdateJob(job);
                            break;

                        case 'r':
                        case 'R':
                            Console.Write("[RESUME] Enter Job Identifier: ");
                            jobIdentifier = Console.ReadLine();
                            job           = await apiService.GetJob(new JobLocator(subscriptionName, jobIdentifier));
                            job.SetActivationStatus(true, "tester resume");
                            await apiService.AddOrUpdateJob(job);
                            break;
                        }
                    }
                    catch (ArgumentException e)
                    {
                        Console.WriteLine($"Bad parameter(s) supplied when creating Job or JobLocator: {e.Message}");
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine($"Unknown Error: {e.Message}");
                    }
                }
            });
        }