Ejemplo n.º 1
0
        private async Task <bool> DoClockOut(string actualServicePerformed)
        {
            ClockOutDto clockOutDto = new ClockOutDto();

            clockOutDto.JobId                  = long.Parse(this.btnClockInClick.CommandParameter.ToString());
            clockOutDto.ActualClockOut         = DateTime.Now;
            clockOutDto.ActualServicePerformed = actualServicePerformed;
            double weight = 0.0;

            if (CurrentJob.JobRequiresWeighInOut && !actualServicePerformed.StartsWith("Skipped"))
            {
                if (double.TryParse(txtWeightOut.Text, out weight))
                {
                    clockOutDto.ActualWeightOut = weight;
                }
                else
                {
                    await DisplayAlert("Weigh Out is Required", "Before you clock out and leave the site, you must Weigh Out.", "OK");

                    SetSiteCompleteDisplay(btnClockInClick);
                    return(false);
                }
            }
            bool success = await TripContext.ClockOut(clockOutDto);

            return(success);
        }