Exemple #1
0
 public SettingsView(Settings settings)
 {
     InitializeComponent();
     this.DataContext = this;
     this.settings    = settings;
     this.dbWorker    = new DbWorker();
     this.dbWorker.CheckDbConnectionComplitted += onCheckDbConnectionComplitted;
     loadMainSettings();
     loadKaskadSettings();
     this.pbPassword.Password = "******";
     this.KaskadSqlPasswordPasswordBox.Password         = "******";
     this.pbPassword.PasswordChanged                   += PbPassword_PasswordChanged;
     this.KaskadSqlPasswordPasswordBox.PasswordChanged += KaskadSqlPasswordPasswordBox_PasswordChanged;
     this.tbDatabaseName.TextChanged                   += settingChanged;
     this.tbSqlServer.TextChanged += settingChanged;
     this.tbLogin.TextChanged     += settingChanged;
     this.KaskadSqlDatabaseNameTextBox.TextChanged += settingChanged;
     this.KaskadSqlServerTextBox.TextChanged       += settingChanged;
     this.KaskadSqlLoginTextBox.TextChanged        += settingChanged;
     this.IsKaskadDbUsedCheckBox.Unchecked         += IsKaskadDbUsedCheckBox_Changed;
     this.IsKaskadDbUsedCheckBox.Checked           += IsKaskadDbUsedCheckBox_Changed;
     //this.tbIndex.TextChanged += settingChanged;
     WindowsLog.LogOpenSettingsWindow();
     this.btSave.IsEnabled = false;
     //this.isMainWindowShowed = isMainWindowShowed;
 }
Exemple #2
0
 public MainWindow(Settings settings, DbWorker dbWorker)
 {
     InitializeComponent();
     this.settings = settings;
     this.dbWorker = dbWorker;
     loadApplicationTheme();
     date_end.SelectedDate   = DateTime.Today;
     date_start.SelectedDate = DateTime.Today.AddDays(-1);
     date_end.DisplayDate    = DateTime.Today;
     date_start.DisplayDate  = DateTime.Today.AddDays(-1);
     WindowsLog.LogAppStart();
 }
Exemple #3
0
 private void ButtonSave_Click(object sender, RoutedEventArgs e)
 {
     setSettings();
     if (settings.IsCorrect)
     {
         settings.Save();
         settings.SetGlobal();
         WindowsLog.LogSaveSettings();
         this.DialogResult = true;
     }
     else
     {
         MessageBox.Show("Введенные данные некорректны", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Exemple #4
0
        private void vGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (this.currentPerson != null)
            {
                //WindowsLog.LogOpenCompareWindow(this.currentPerson.Row["Fullname"].ToString());
                WindowsLog.LogOpenCompareWindow(this.currentPerson.PassengerFio);

                PersonView personForm = new PersonView(this.currentPerson);
                personForm.Owner = this;
                //personForm.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                personForm.ShowDialog();
            }

            /*
             * Settings settings = new Settings();
             * settings.SqlServer = "UFO\\SQL2008";
             * settings.DataBaseName = "ufo";
             * settings.Login = "******";
             * settings.Password = "******";
             * try
             * {
             *  byte[] array = DBWork.GetPersonPhotoStatic(17600, settings);
             *  BitmapImage bitmap = ImageHelper.GetImageFromArray(array);
             *  personForm.ImgNowCrossing.Source = bitmap;
             *
             *  array = DBWork.GetPersonPhotoStatic(26565, settings);
             *  BitmapImage bitmap2 = ImageHelper.GetImageFromArray(array);
             *  personForm.ImgLastCrossing.Source = bitmap2;
             *
             *  personForm.ShowDialog();
             * }
             * catch (Exception error)
             * {
             *  MessageBox.Show(error.Message, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
             * }
             */
        }
Exemple #5
0
        private void BSearch_Click(object sender, RoutedEventArgs e)
        {
            DateTime ds, de;

            if (!DateTime.TryParse(date_start.Text, out ds))
            {
                MessageBox.Show(date_start.Text + " не является датой", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
                date_start.Text = Convert.ToString(date_start.SelectedDate);
                return;
            }
            else
            {
                date_start.SelectedDate = ds;
            }

            if (!DateTime.TryParse(date_end.Text, out de))
            {
                MessageBox.Show(date_end.Text + " не является датой", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
                date_end.Text = Convert.ToString(date_end.SelectedDate);
                return;
            }
            else
            {
                date_end.SelectedDate = de;
            }


            //MessageBox.Show(date_start.Text+" "+date_start.SelectedDate+" "+date_start.DisplayDate, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
            WindowsLog.LogPersonSearch(tbFamily.Text, tbName.Text, date_start.SelectedDate, date_end.SelectedDate);


            //DataTable table = DBWork.GetPassengersQuery(date_start.SelectedDate, date_end.SelectedDate, tbFamily.Text, tbName.Text);
            //if(table != null) vGrid.DataContext = table.DefaultView;

            vGrid.ItemsSource = this.dbWorker.GetPassengersQuery(date_start.SelectedDate, date_end.SelectedDate, tbFamily.Text, tbName.Text, cbNdb.SelectedIndex, settings.Index);
        }
Exemple #6
0
 private void App_Exit(object sender, ExitEventArgs e)
 {
     WindowsLog.LogAppExit();
 }