コード例 #1
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            double distanceValue = 0.0;


            if (!bothSet)
            {
                Toast.MakeText(this, "Both times must be set, you silly billy!", ToastLength.Long).Show();
                return;
            }

            var v = distanceText.Text;

            v = v.Trim();
            if (string.IsNullOrEmpty(v))
            {
                Toast.MakeText(this, "How faarrr did ye go!", ToastLength.Long).Show();
                return;
            }

            distanceValue = Convert.ToDouble(v);

            var k = endLocationText.Text;

            k = k.Trim();
            if (string.IsNullOrEmpty(k))
            {
                Toast.MakeText(this, "FFS, I place, I need a place!", ToastLength.Long).Show();
                return;
            }

            if (SelectedTripId == int.MinValue)
            {
                Toast.MakeText(this, "We do need an active trip we do!", ToastLength.Long).Show();
                return;
            }

            // Now we do the magic saving bit.
            journeyRepository.ManuallyInsertNewJourney(SelectedDriverId, SelectedTripId, selectedStartTime, selectedEndTime, distanceValue, k);
        }