Ejemplo n.º 1
0
        private void Btn_DeleteCemetery_Click(object sender, RoutedEventArgs e)
        {
            string selected;

            selected = Convert.ToString(ListBox_CemeteryDetails.SelectedValue);

            // Verify the user selected a record to delete
            if (!string.IsNullOrEmpty(selected))
            {
                MessageBoxResult result;
                result = MessageBox.Show(Tools.deleteMessage, Tools.deleteTitle, MessageBoxButton.YesNo);

                if (result == MessageBoxResult.Yes)
                {
                    foreach (CemeteryDBInfo cemetery in cemList)
                    {
                        if (cemetery.Details == selected)
                        {
                            // Remove from the database
                            cemetery.DeleteFromDatabase();
                        }
                    }

                    cemList = CemeteryDBInfo.LoadObjectList();

                    ListBox_CemeteryDetails.DataContext = cemList;
                }
            }
            else
            {
                MessageBox.Show(Tools.RecordDeleteMessage, Tools.RecordSelectTitle);
            }
        }
Ejemplo n.º 2
0
        public Cemeteries()
        {
            InitializeComponent();

            cemList = CemeteryDBInfo.LoadObjectList();

            ListBox_CemeteryDetails.DataContext = cemList;

            DataContext = this;
        }
Ejemplo n.º 3
0
        private void Save()
        {
            CurrentCemetery.WriteDataToDatabase();

            cemList = CemeteryDBInfo.LoadObjectList();

            ListBox_CemeteryDetails.DataContext = cemList;

            HideControls();

            CurrentCemetery = null;
        }