/// <summary> /// Converts form BE.address to an XML element /// </summary> /// <param name="address"></param> /// <returns></returns> public XElement ConvertAddress(BE.Address address) { XElement addressElement = new XElement("Address"); XElement street = new XElement("Street", address.Street); XElement city = new XElement("City", address.City); XElement number = new XElement("Number", address.Number); addressElement.Add(street, city, number); return(addressElement); }
private void updateAddress_Click(object sender, RoutedEventArgs e) { Address address = new Address(); BE.Address myaddress = nanny.Address; address.DataContext = myaddress; bool?result = address.ShowDialog(); if (result != false) { nanny.Address = address.myaddress; } }
private void CheckingValidAddress2(object sender, TextChangedEventArgs e) { tester = bl.GetTesters().FirstOrDefault(T => T.ID == (string)testerIDComboBox.SelectedValue); BE.Address address = new BE.Address(city: City.Text, street: Street.Text, buildingNumber: Number.Text); if (Functions.IsAddress(address) && tester != null) { Thread thread = new Thread(() => VerifyRange(address, tester)); thread.Start(); } else IsTesterCloseEnough = true; }
private void updateBAddress_Click(object sender, RoutedEventArgs e) { Address address = new Address(); BE.Address myaddress = mother.BabbySitterAdress; address.DataContext = myaddress; bool?result = address.ShowDialog(); if (result != false) { mother.BabbySitterAdress = address.myaddress; } }
private void btnOK_Click(object sender, RoutedEventArgs e) { TestMenu mytestMenu = new TestMenu(); try { if ((string)btnOK.Content == "Add") { myTester = bl.getTestersList().FirstOrDefault(x => x.ID == Convert.ToInt32(textTesterID.Text)); BE.Address address = new BE.Address(myCity: textCity.Text, Street: textStreet.Text, Building: textBuilding.Text); if (myTester != null && address != null) { Thread thread = new Thread(() => checkRange(address, myTester)); thread.Start(); } int numId1 = Convert.ToInt32(textTesterID.Text); if (numId1 < 100000000 || numId1 > 999999999)//9 numbers for id { throw new Exception("Non-valid Id of tester. Please enter a valid Id."); } int numId = Convert.ToInt32(txTtraineeID.Text); if (numId < 100000000 || numId > 999999999)//9 numbers for id { throw new Exception("Non-valid Id of trainee. Please enter a valid Id."); } if ((textTesterID.Text == "") || (txTtraineeID.Text == "") || (textCity.Text == "") || (textBuilding.Text == "") || (textStreet.Text == "") || (cmbgearBox.Text == "") || (cmbkindOfvehicle.Text == "")) // empty checkBox { throw new Exception("Not all fields are filled in."); } bl.addTest(MyTest); MyTest = new Test(); this.Close(); mytestMenu.Show(); } else if ((string)btnOK.Content == "Update") { var mbResult = MessageBox.Show("Are you sure you want to update this test?", "", MessageBoxButton.OKCancel, MessageBoxImage.Question, MessageBoxResult.Yes); if (mbResult == MessageBoxResult.OK) { MyTest.Reverse = chReverse.IsChecked.Value; MyTest.Parking = chParking.IsChecked.Value; MyTest.Mirror = chMirrors.IsChecked.Value; MyTest.priority = chPriority.IsChecked.Value; MyTest.Parking = chParking.IsChecked.Value; MyTest.Signaling = chSignaling.IsChecked.Value; bl.updateTest(MyTest); MyTest = new Test(); this.DataContext = MyTest; this.Close(); MessageBox.Show("Test updated"); mytestMenu.Show(); } else { this.Close(); mytestMenu.Show(); } } else { MyTest = new Test(); this.DataContext = MyTest; this.Close(); mytestMenu.Show(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }