Ejemplo n.º 1
0
        public async void OnClockInOutClicked(object sender, EventArgs e)
        {
            if ((sender as Button).Text.Contains("Clock In"))
            {
                ClockInDto clockInDto = new ClockInDto();
                clockInDto.JobId         = CurrentJob.JobId;         // long.Parse((sender as Button).CommandParameter.ToString());
                clockInDto.ActualClockIn = DateTime.Now;

                if (CurrentJob.JobRequiresWeighInOut)
                {
                    double weighInValue = 0.0;
                    if (double.TryParse(weighInEntry.Text, out weighInValue))
                    {
                        clockInDto.ActualWeightIn = weighInValue;
                    }
                    else
                    {
                        await DisplayAlert("Weigh In is Required", "Please Proceed directly to the scales and Weigh In before doing any work on the site.", "OK");

                        return;
                    }
                }
                bool clockedIn = await TripContext.ClockIn(clockInDto);

                if (clockedIn)
                {
                    SetClockOutDisplay(sender);
                }
                else
                {
                    (sender as Button).Text = "Clock In failed. Please re-try. \n (" + DateTime.Now + ")";
                }
            }
            else
            {
                SetSiteCompleteDisplay(sender);
            }
        }