private void button_Click(object sender, RoutedEventArgs e)
        {
            AddPeriod addPeriod = new AddPeriod();

            addPeriod.mode = 1;
            addPeriod.Show();
        }
        private void edit_Click(object sender, RoutedEventArgs e)
        {
            var       x         = ((Period)datagridview.SelectedItem);
            AddPeriod addPeriod = new AddPeriod();

            addPeriod.periodid = x.PeriodID;
            addPeriod.mode     = 2;
            addPeriod.Show();
        }