private void btnSave_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(txtPersonName.Text)) { MessageBox.Show("Please enter a Person's Name for the Birthday Entry."); return; } ; DateTime bday; if (DateTime.TryParse(dtDate.Text, out bday)) { dob.PersonName = txtPersonName.Text; dob.Date = bday; var op = BirthdayBLL.Update(dob); if (op.Code.ToLower() == "ok") { listWindow.ShowData(); MessageBox.Show(op.Message.FirstOrDefault()); this.Close(); } else { MessageBox.Show(op.Message.FirstOrDefault()); } } else { MessageBox.Show("Please enter a Valid Date for the Birthday Entry."); return; } }
public void ShowData() { var bdays = BirthdayBLL.Search((int)pageIndex, 10, txtSearchKeyword.Text); dgBirthdays.ItemsSource = bdays.Items; pageCount = bdays.PageCount; lblPage.Content = " Showing page " + pageIndex + " of " + pageCount; //Showing page 1 of 20 }
private void ShowBirthdays() { var birthdays = BirthdayBLL.CelebrantsToday(); foreach (var birthday in birthdays.Items) { lstBirthdays.Items.Add(birthday.PersonName); } }
private void btnDelete_Click(object sender, RoutedEventArgs e) { Birthday birthday = ((FrameworkElement)sender).DataContext as Birthday; if (MessageBox.Show("Do you want to delete birthday entry for " + birthday.PersonName + " on " + birthday.Date.ToString("dd/MM/yyyy") + " ?", "Are you sure?", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { var op = BirthdayBLL.Delete(birthday); if (op.Code.ToLower() == "ok") { ShowData(); MessageBox.Show(op.Message.FirstOrDefault()); this.Close(); } else { MessageBox.Show(op.Message.FirstOrDefault()); } } }