public HostingUnitUserControl(HostingUnit hostingUnit, bool isWriteHostdetails = false) { InitializeComponent(); UserControlGird.DataContext = hostingUnit; txbName.Text = hostingUnit.HostingUnitName; tbxHostingUnit.Text = hostingUnit.ToString(); calendar.Margin = new Thickness(161, 0, 0, 0); if (isWriteHostdetails) { tbxHost.Text = hostingUnit.Owner.ToString(); calendar.Margin = new Thickness(322, 0, 0, 0); } calendar.DisplayDateStart = DateTime.Now.AddMonths(-1); calendar.DisplayDateEnd = DateTime.Now.AddMonths(11); calendar.DisplayDate = DateTime.Now; foreach (DateTime d in hostingUnit.AllDates) { calendar.BlackoutDates.Add(new CalendarDateRange(d)); } }
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 Worker_DoWork(object sender, DoWorkEventArgs e) { for (int i = 0; i < 5; i++) { MailMessage mail = new MailMessage(); mail.To.Add(guestRequest.MailAddress); mail.From = new MailAddress(host.MailAddress); mail.Subject = "הצעת נופש ממארח"; mail.Body = "פירטי יחידת האירוח:\n" + hostingUnit.ToString() + "\n\nפירטי מארח:" + host.ToString() + "\nיש לאשר במייל חוזר למארח בכתובת: " + host.MailAddress + "\nהצעות שלא יענו תוך 30 יום יסגרו אוטומטית"; mail.IsBodyHtml = false; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Credentials = new System.Net.NetworkCredential(host.MailAddress, pass); smtp.EnableSsl = true; try { smtp.Send(mail); e.Result = true; break; } catch (Exception) { } System.Threading.Thread.Sleep(2000); e.Result = false; } }
private void Button_Click_1(object sender, RoutedEventArgs e) { try { 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)) { MessageBox.Show("Oops! You forgot to fill some of the details", "שגיאה", MessageBoxButton.OK, MessageBoxImage.Stop, MessageBoxResult.Cancel, MessageBoxOptions.RightAlign); return; } else { myBL.addHostingUnit(hu); } } catch (Exception ex) { MessageBox.Show(ex.Message, "שגיאה", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.Cancel, MessageBoxOptions.RightAlign); } MessageBox.Show(hu.ToString()); }
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(); }