예제 #1
0
        private void btBrowserDatabaseFile_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "Database files (*.db)|*.db|All files (*.*)|*.*";
            if (openFileDialog.ShowDialog() == true)
            {
                this.tbDatabaseFilePath.Text = openFileDialog.FileName;
            }
            if (this.tbDatabaseFilePath.Text == string.Empty)
            {
                return;
            }
            if (this.tbDatabaseFilePath.Text.Split('\\').Last().Contains("JagwarPlus"))
            {
                projectName = "JagwarPlus";
            }
            else
            {
                projectName = "Jagwar";
            }

            myDatabase = new MTEDatabaseSetup(this.tbDatabaseFilePath.Text);
            myDatabase.ConnectDatabase();
            this.cmbStations.Items.Clear();
            this.cmbStations.Items.Add("FCT");
            this.cmbStations.Items.Add("SFG");
            this.cmbStations.Items.Add("FG00");
            this.cmbStations.Items.Add("FG24");
            this.cmbStations.IsEnabled = true;

            this.dtpStartDateForYield.IsEnabled = true;
            this.dtpEndDateForYield.IsEnabled   = true;
            string[] interestedTables = new string[] { $"{projectName}_FCT_Summary", $"{ projectName}_SFG_Summary", $"{projectName}_FG00", $"{projectName}_FG24" };
            DateTime MaxStartDate     = new DateTime(1990, 1, 1);
            DateTime MinEndDate       = new DateTime(2030, 1, 1);

            for (int index = 0; index < interestedTables.Length; index++)
            {
                string[] dateRange = myDatabase.GetDateTimeRange(interestedTables[index]);
                DateTime start     = DateTime.ParseExact(dateRange[0], "yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture);
                DateTime end       = DateTime.ParseExact(dateRange[1], "yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture);
                MaxStartDate = MaxStartDate > start ? MaxStartDate : start;
                MinEndDate   = MinEndDate < end ? MinEndDate : end;
            }
            this.dtpStartDateForYield.DisplayDateStart = MaxStartDate;
            this.dtpStartDateForYield.DisplayDateEnd   = MinEndDate;
            this.dtpEndDateForYield.DisplayDateStart   = MaxStartDate;
            this.dtpEndDateForYield.DisplayDateEnd     = MinEndDate;
            this.cmbReworkLine.IsEnabled = true;
        }
예제 #2
0
        private void cmbStation_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            this.activeTableName = projectName + "_" + this.cmbStations.SelectedValue;
            if (this.cmbStations.SelectedValue.ToString() == "SFG" || this.cmbStations.SelectedValue.ToString() == "FCT")
            {
                this.activeTableName += "_Summary";
            }
            string[] DateTimeRange = myDatabase.GetDateTimeRange(this.activeTableName);
            if (DateTimeRange[0] == "" || DateTimeRange[1] == "")
            {
                return;
            }
            DateTime dtStart, dtEnd;

            dtStart = DateTime.ParseExact(DateTimeRange[0], "yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture);
            dtEnd   = DateTime.ParseExact(DateTimeRange[1], "yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture);
            this.dtpStartDateForPareto.DisplayDateStart = dtStart;
            this.dtpEndDateForPareto.DisplayDateStart   = dtStart;
            this.dtpStartDateForPareto.DisplayDateEnd   = dtEnd;
            this.dtpEndDateForPareto.DisplayDateEnd     = dtEnd;
            this.dtpStartDateForPareto.IsEnabled        = true;
            this.dtpEndDateForPareto.IsEnabled          = true;
        }