private void button1_Click(object sender, RoutedEventArgs e) { try { mother.AddressMom = addressMomTextBox.Text; mother.AddressForNanny = addressForNannyTextBox.Text; bl.addMom(mother); mother = null; addMomTab.DataContext = mother; MessageBox.Show("אם נוספה בהצלחה"); } catch (Exception Ex) { MessageBox.Show(Ex.Message); } }
private void button_Click(object sender, RoutedEventArgs e) { try { if ((bool)(SunCheck.IsChecked == true)) { momToAdd.DaysRequestMom[0] = true; var start = SunStart.Value; var end = SunEnd.Value; momToAdd.startHour[0] = Convert.ToDateTime(start); momToAdd.endHour[0] = Convert.ToDateTime(end); } if ((bool)(MonCheck.IsChecked == true)) { momToAdd.DaysRequestMom[1] = true; var start = MonStart.Value; var end = MonEnd.Value; momToAdd.startHour[1] = Convert.ToDateTime(start); momToAdd.endHour[1] = Convert.ToDateTime(end); } if ((bool)(TueCheck.IsChecked == true)) { momToAdd.DaysRequestMom[2] = true; var start = TueStart.Value; var end = TueEnd.Value; momToAdd.startHour[2] = Convert.ToDateTime(start); momToAdd.endHour[2] = Convert.ToDateTime(end); } if ((bool)(WedCheck.IsChecked == true)) { momToAdd.DaysRequestMom[3] = true; var start = WedStart.Value; var end = WedEnd.Value; momToAdd.startHour[3] = Convert.ToDateTime(start); momToAdd.endHour[3] = Convert.ToDateTime(end); } if ((bool)(ThuCheck.IsChecked == true)) { momToAdd.DaysRequestMom[4] = true; var start = ThuStart.Value; var end = ThuEnd.Value; momToAdd.startHour[4] = Convert.ToDateTime(start); momToAdd.endHour[4] = Convert.ToDateTime(end); } if ((bool)(FriCheck.IsChecked == true)) { momToAdd.DaysRequestMom[5] = true; var start = FriStart.Value; var end = FriEnd.Value; momToAdd.startHour[5] = Convert.ToDateTime(start); momToAdd.endHour[5] = Convert.ToDateTime(end); } bl.addMom(momToAdd); momToAdd = new BE.Mother(); AddMomGrid.DataContext = momToAdd; MessageBox.Show("אם נוספה בהצלחה!"); this.Close(); } catch (FormatException) { MessageBox.Show("check your input and try again"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }