Ejemplo n.º 1
0
        private void ButtonAdd_Click(object sender, RoutedEventArgs e)
        {
            ClassOffice             office = new ClassOffice();
            WindowOfficeDataEdition windowOfficeDataEdition = new WindowOfficeDataEdition(office);

            windowOfficeDataEdition.AddNew = true;
            bool update = (bool)windowOfficeDataEdition.ShowDialog();

            if (update)
            {
                UpdateOffice(office, windowOfficeDataEdition.AddNew);
                LoadDataToDataGrid();
            }
        }
Ejemplo n.º 2
0
        private void ButtonEdit_Click(object sender, RoutedEventArgs e)
        {
            if (DataGridListOfOffice.SelectedIndex == -1)
            {
                MessageBox.Show("Select the row corresponding to the office", "No row selected");
                return;
            }
            //Open a new window editing existing doctor
            ClassOffice             office = (ClassOffice)DataGridListOfOffice.SelectedItem;
            WindowOfficeDataEdition windowOfficeDataEdition = new WindowOfficeDataEdition(office);

            windowOfficeDataEdition.AddNew = false;
            bool update = (bool)windowOfficeDataEdition.ShowDialog();

            if (update)
            {
                UpdateOffice(office, windowOfficeDataEdition.AddNew);
                LoadDataToDataGrid();
            }
        }