private void BtnConfirm_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrWhiteSpace(Tb.Text)) { popup = ConfigurePopup.Configure(popup, "Enter country name first!", BtnConfirm, PlacementMode.Top); popup.IsOpen = true; return; } else { Country = new Country() { CountryName = Tb.Text }; try { AdminInterface.Add(Country); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void BtnConfirm_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrWhiteSpace(picLink)) { try { Picture = new Picture() { Picture1 = picLink }; adminInterfacePictures.Add(Picture); this.Close(); } catch (Exception ex) { popup = ConfigurePopup.Configure(popup, ex.Message, BtnConfirm, PlacementMode.Top); popup.IsOpen = true; } } else { popup = ConfigurePopup.Configure(popup, "No picture was selected", BtnConfirm, PlacementMode.Top); popup.IsOpen = true; } }
private async void BtnAddPicture_Click(object sender, RoutedEventArgs e) { OpenFileDialog od = new OpenFileDialog(); popup.IsOpen = false; od.Filter = "Image Files|*.jpg;*.jpeg;*.png;*.bmp;"; if ((bool)od.ShowDialog()) { Picture pic = new Picture() { Picture1 = od.FileName }; try { AdminInterfacePictures.Add(pic); var p = await(AdminInterfacePictures as AdminInterfacePictures).GetByReferenceAsync(od.FileName); hotel.Pictures.Add(p); } catch (Exception ex) { popup = ConfigurePopup.Configure(popup, ex.Message, BtnConfirm, PlacementMode.Top); popup.IsOpen = true; } } }
private void BtnConfirm_Click(object sender, RoutedEventArgs e) { popup = ConfigurePopup.Configure(popup, "Fill all fields first and select picture!", BtnConfirm, PlacementMode.Top); popup.IsOpen = false; texts.Clear(); texts.Add((SP.Children[0] as TextBox).Text); if (!ListTextBoxesHelper.StringsNotEmpty(texts) || !hotel.Pictures.Any()) { popup.IsOpen = true; } else { if (CB.SelectedItem == null) { popup = ConfigurePopup.Configure(popup, "Select an item!", CB, PlacementMode.Right); popup.IsOpen = true; } else { City c = CB.SelectedItem as City; hotel.City = c; try { AdminInterface.Add(hotel); this.Close(); } catch (Exception ex) { popup = ConfigurePopup.Configure(popup, ex.Message, BtnConfirm, PlacementMode.Top); popup.IsOpen = true; } } } }
private void BtnConfirm_Click(object sender, RoutedEventArgs e) { popup.IsOpen = false; texts = ListTextBoxesHelper.GetText(SP.Children); if (ListTextBoxesHelper.StringsNotEmpty(texts)) { if (!DecimalNumberChecker.Check(texts[1])) { popup = ConfigurePopup.Configure(popup, "Only decimal numbers in price are allowed in price field!", BtnConfirm, PlacementMode.Top); popup.IsOpen = true; return; } AdminInterface.Add(Attraction); this.Close(); } else { popup.IsOpen = true; } }