private async void CheckBox_Checked(object sender, RoutedEventArgs e)
        {
            CheckBox cb = sender as CheckBox;

            foreach (Depth tempDepth in depths)
            {
                string test0 = cb.Name.Substring(5);
                string test2 = tempDepth.DepthID.ToString();
                if (cb.Name.Substring(5) == tempDepth.DepthID.ToString())
                {
                    Depth temp = tempDepth;
                    temp.RepaidAmount = tempDepth.Amount;
                    depthsUpdate.Add(temp);
                }
            }
        }
        private async void ButtonSave_Click(object sender, RoutedEventArgs e)
        {
            //Create Shift Object
            Shift newshift = new Shift();

            try
            {
                newshift.PersonID = Int32.Parse(cmbDriver.SelectedValue.ToString());
            }
            catch
            {
                MessageBox.Show("You Must select a Driver");
                return;
            }
            try
            {
                newshift.TaxiID = Int32.Parse(cmbTaxi.SelectedValue.ToString());
            }
            catch
            {
                MessageBox.Show("You Must select a Taxi");
                return;
            }

            if (!DatePicker1.Value.HasValue)
            {
                newshift.ShiftDate = DateTime.Today;
            }
            else
            {
                newshift.ShiftDate = DatePicker1.Value.Value;
            }
            if (TxtXZ.Text != "")
            {
                newshift.XZ = Convert.ToDecimal(TxtXZ.Text);
            }
            if (TxtOil.Text != "")
            {
                newshift.Oil = Convert.ToDecimal(TxtOil.Text);
            }
            if (TxtXZFpa.Text != "")
            {
                newshift.XZFPA = Convert.ToDecimal(TxtXZFpa.Text);
            }
            if (TxtOilFpa.Text != "")
            {
                newshift.OilFPA = Convert.ToDecimal(TxtOilFpa.Text);
            }
            if (TxtShift.Text != "")
            {
                newshift.ShiftPayment = Convert.ToDecimal(TxtShift.Text);
            }
            if (TxtIka.Text != "")
            {
                newshift.Insurance = Convert.ToDecimal(TxtIka.Text);
            }
            if (TxtFpa.Text != "")
            {
                newshift.FPA = Convert.ToDecimal(TxtFpa.Text);
            }
            if (TxtComment.Text != "")
            {
                newshift.Comment = TxtComment.Text;
            }

            shifts.Add(newshift);
            //Create kilometer object
            Kilometer newkilometer = new Kilometer();

            if (TxtKmlFrom.Text != "")
            {
                newkilometer.KlmStart = Int32.Parse(TxtKmlFrom.Text);
            }
            if (TxtKmlTo.Text != "")
            {
                newkilometer.KlmFinish = Int32.Parse(TxtKmlTo.Text);
            }
            if (TxtKmlDifference.Text != "")
            {
                newkilometer.KlmShift = Int32.Parse(TxtKmlDifference.Text);
            }

            if (!DatePicker1.Value.HasValue)
            {
                newkilometer.ShiftDate = DateTime.Today;
            }
            else
            {
                newkilometer.ShiftDate = DatePicker1.Value.Value;
            }
            try
            {
                newkilometer.PersonID = Int32.Parse(cmbDriver.SelectedValue.ToString());
            }
            catch
            {
                MessageBox.Show("You Must select a Driver");
                return;
            }
            try
            {
                newkilometer.TaxiID = Int32.Parse(cmbTaxi.SelectedValue.ToString());
            }
            catch
            {
                MessageBox.Show("You Must select a Taxi");
                return;
            }
            kilometers.Add(newkilometer);
            //Create Depth object
            Depth newdepth = new Depth();

            try
            {
                newdepth.Amount = Convert.ToDecimal(TxtAmount.Text);
            }
            catch
            {
                MessageBox.Show("The Total must be a decimal xxxx.xx ");
                return;
            }
            if (TxtComment.Text != "")
            {
                newdepth.Comment = TxtComment.Text;
            }
            newdepth.RepaidAmount = 0;
            newdepth.Paid         = null;
            if (!DatePicker1.Value.HasValue)
            {
                newdepth.DepthDate = DateTime.Today;
            }
            else
            {
                newdepth.DepthDate = DatePicker1.Value.Value;
            }
            try
            {
                newdepth.PersonID = Int32.Parse(cmbDriver.SelectedValue.ToString());
            }
            catch
            {
                MessageBox.Show("You Must select a Driver");
                return;
            }
            try
            {
                newdepth.TaxiID = Int32.Parse(cmbTaxi.SelectedValue.ToString());
            }
            catch
            {
                MessageBox.Show("You Must select a Taxi");
                return;
            }
            List <PrimaryDriver> primedr = new List <PrimaryDriver>();

            primedr.Add(new PrimaryDriver {
                TaxiID = Int32.Parse(cmbTaxi.SelectedValue.ToString()), PersonID = Int32.Parse(cmbDriver.SelectedValue.ToString())
            });
            depths.Add(newdepth);



            CreateDatatableStrings strings = new CreateDatatableStrings();
            SQLExecute             sqlexec = new SQLExecute();
            await sqlexec.SQLCommand(Properties.Settings.Default.DBName, strings.FOREIGN_KEY(0));

            await Task.Run(() => SaveKilometer());

            await Task.Run(() => SaveShift());

            await Task.Run(() => SaveDepth());

            await Task.Run(() => SaveIfPrimaryDriver(primedr));

            await sqlexec.SQLCommand(Properties.Settings.Default.DBName, strings.FOREIGN_KEY(1));

            ClearAll();
        }