Exemplo n.º 1
0
        private void EditWorkDay_Click(object sender, RoutedEventArgs e)
        {
            DateTime SelectedDate;

            if (wCalendar.SelectedDate.HasValue)
            {
                SelectedDate = wCalendar.SelectedDate.Value;
            }
            else
            {
                SelectedDate = DateTime.Today;
            }
            DayInfo SelectedDayInfo = new DayInfo();

            SelectedDayInfo.FillDayInfo(SelectedDate, iPS.Text, iAddr.Text, iWorkTime.Text, Convert.ToInt32(iCost.Text), Convert.ToBoolean(IsGSM.IsChecked));
            NewWorkDayForm NewPage = new NewWorkDayForm(SelectedDayInfo);

            this.NavigationService.Navigate(NewPage);
        }
Exemplo n.º 2
0
        private void UpdWorkDay_Click(object sender, RoutedEventArgs e)
        {
            DayInfo NewValues = new DayInfo();

            NewValues.FillDayInfo(Convert.ToDateTime(wDateBlock.Text), wPSnameBox.Text, wPSaddressBox.Text, wPSworkTimeBox.Text,
                                  Convert.ToInt32(wCostBox.Text), Convert.ToBoolean(wIsSubUrbFlag.IsChecked));
            try
            {
                DataBaseConnection.UpdateWorkDay(NewValues);
                MessageBox.Show("Смена сохранена", "", MessageBoxButton.OK);
                NavigationService.Navigate(new Uri("StartWindow.xaml", UriKind.Relative));
            }
            catch (Exception error)
            {
                MessageBox.Show(error.Message, "Ошибка при сохранении смены в БД", MessageBoxButton.OK);
            }
            finally
            {
                DataBaseConnection.CloseConnection();
            }
        }