private void Button_Click(object sender, RoutedEventArgs e) { try { hu1.Jacuzzi = jac.IsChecked.Value; if ((hu1.HostingUnitName.Length == 0) || !(hu1.HostingUnitName.All(x => x == ' ' || char.IsLetter(x)) || (adults1.Text.Length == 0)) || (children1.Text.Length == 0)) { MessageBox.Show("Oops! You forgot to fill some of the details", "שגיאה", MessageBoxButton.OK, MessageBoxImage.Stop, MessageBoxResult.Cancel, MessageBoxOptions.RightAlign); return; } else { myBL.updateHostingUnit(hu1); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.Cancel, MessageBoxOptions.RightAlign); } MessageBox.Show(hu1.ToString()); PrivateArea p = new PrivateArea(myBL.FindHost(hu1.Owner.password)); this.Close(); p.ShowDialog(); }
private void Button_Click_1(object sender, RoutedEventArgs e) { myPassword = pass.Password; if (myID.Text.Length != 9) { MessageBox.Show("ID may contain nine numbers", "Error", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.Cancel, MessageBoxOptions.RightAlign); return; } int id; if (!int.TryParse(myID.Text, out id)) { MessageBox.Show("ID may contain ONLY numbers", "Error", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.Cancel, MessageBoxOptions.RightAlign); return; } else { int index = myBL.FindHost(myPassword); if (index == -1 || (Convert.ToInt32(myID.Text)) != myBL.getHostingUnits()[index].Owner.ID) //not existed { Exception ex = new KeyNotFoundException("Unexisted host"); MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.Cancel, MessageBoxOptions.RightAlign); } else { PrivateArea pa = new PrivateArea(index); this.Close(); pa.Show(); } } }
private void Button_Click_1(object sender, RoutedEventArgs e) { PrivateArea p = new PrivateArea(myBL.FindHost(hu1.Owner.password)); this.Close(); p.ShowDialog(); }
private void Button_Click_1(object sender, RoutedEventArgs e) { PrivateArea p = new PrivateArea(index2); this.Close(); p.ShowDialog(); }
private void Button_Click(object sender, RoutedEventArgs e) { if (index2 == -1) { HostWindow hw = new HostWindow(); this.Close(); hw.ShowDialog(); } else { PrivateArea p = new PrivateArea(index2); this.Close(); p.ShowDialog(); } }
private void Button_Click(object sender, RoutedEventArgs e) { try { hu1.Jacuzzi = jac.IsChecked.Value; int hostKey = myBL.FindHost(hu1.Owner.password); myBL.deleteHostingUnit(hu1); MessageBox.Show("Hosting unit was deleted", "Information", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK, MessageBoxOptions.RightAlign); PrivateArea p = new PrivateArea(hostKey); this.Close(); p.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message, "שגיאה", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.Cancel, MessageBoxOptions.RightAlign); } }
private void Button_Click_1(object sender, RoutedEventArgs e) { try { //BankNumber = int.Parse(element.Element("BankNumber").Value), //BankName = element.Element("BankName").Value, //BranchNumber = int.Parse(element.Element("BranchNumber").Value), //BranchAddress = element.Element("BranchAddress").Value, //BranchCity = element.Element("BranchCity").Value hu.Jacuzzi = jac.IsChecked.Value; if ((h.PrivateName.Length == 0) || !(h.PrivateName.All(x => x == ' ' || char.IsLetter(x))) || (h.FamilyName.Length == 0) || !(h.FamilyName.All(x => x == ' ' || char.IsLetter(x))) || (hu.HostingUnitName.Length == 0) || !(hu.HostingUnitName.All(x => x == ' ' || char.IsLetter(x))) || (h.password.Length == 0) || (h.MailAddress.Length == 0) || (id.Text == "0") || (phone2.Text.Length == 0) || (adults1.Text.Length == 0) || (children1.Text.Length == 0) || (accuont.Text.Length == 0) || (Convert.ToInt32(price1.Text) <= 0)) { MessageBox.Show("Oops! You forgot to fill some of the details", "Error", MessageBoxButton.OK, MessageBoxImage.Stop, MessageBoxResult.Cancel, MessageBoxOptions.RightAlign); return; } else { if (!mailAddress.Text.EndsWith("@gmail.com") && !mailAddress.Text.EndsWith("@walla.com")) { MessageBox.Show("Mail address is uncorrect", "Error", MessageBoxButton.OK, MessageBoxImage.Stop, MessageBoxResult.Cancel, MessageBoxOptions.RightAlign); return; } if (id.Text.Length != 9) { MessageBox.Show("ID is too short", "Error", MessageBoxButton.OK, MessageBoxImage.Stop, MessageBoxResult.Cancel, MessageBoxOptions.RightAlign); return; } else { if (myBL.checkHostID(h)) { List <BankBranch> banks2 = myBL.getBankBranches(); var v = from n in myBL.getBankBranches() where n.BankName == bank.SelectedItem.ToString() select n; b = v.FirstOrDefault(); h.BankBranchDetails = b; hu.Owner = h; myBL.addHostingUnit(hu); MessageBox.Show(hu.ToString(), "Information", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.Cancel, MessageBoxOptions.RightAlign); } else { throw new ArgumentException("Uncorrect ID"); } } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.Cancel, MessageBoxOptions.RightAlign); } PrivateArea p = new PrivateArea(myBL.FindHost(h.password)); this.Close(); p.ShowDialog(); }