コード例 #1
0
        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;
            }
        }
コード例 #2
0
        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
        }
コード例 #3
0
        private void ShowBirthdays()
        {
            var birthdays = BirthdayBLL.CelebrantsToday();

            foreach (var birthday in birthdays.Items)
            {
                lstBirthdays.Items.Add(birthday.PersonName);
            }
        }
コード例 #4
0
        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());
                }
            }
        }