Example #1
0
 public static void UpdateWorkDay(DayInfo values)
 {
     cmd_update.Parameters["@Date"].Value       = values.getDate();
     cmd_update.Parameters["@PSname"].Value     = values.getPSname();
     cmd_update.Parameters["@PSaddr"].Value     = values.getPSaddress();
     cmd_update.Parameters["@PSworktime"].Value = values.getPSworkTime();
     cmd_update.Parameters["@Сost"].Value       = values.getCost();
     cmd_update.Parameters["@IsSubUrban"].Value = values.getSubUrbFlag();
     DBconnection.Open();
     cmd_update.ExecuteNonQuery();
     DBconnection.Close();
 }
Example #2
0
 public NewWorkDayForm(DayInfo SelectedDateInfo)     //Форма редактирования смены
 {
     InitializeComponent();
     wDateBlock.Text             = SelectedDateInfo.getDate().GetDateTimeFormats('D')[1];
     wPSnameBox.Text             = SelectedDateInfo.getPSname();
     wPSaddressBox.Text          = SelectedDateInfo.getPSaddress();
     wPSworkTimeBox.Text         = SelectedDateInfo.getPSworkTime();
     wCostBox.Text               = SelectedDateInfo.getCost().ToString();
     wIsSubUrbFlag.IsChecked     = SelectedDateInfo.getSubUrbFlag();
     UpdWorkDayButton.Visibility = System.Windows.Visibility.Visible;
     wTitle.Content              = "Редактирование смены";
 }
Example #3
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);
        }
Example #4
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();
            }
        }