Пример #1
0
 private void comboPartName_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         if (comboPartName.Items.Count > 0)
         {
             if (comboPartName.SelectedItem == null)
             {
                 return;
             }
             SelectedPartName = comboPartName.SelectedItem.ToString();
             PopulateBoardList();
             listLifetimeInfo1.Clear();
             LifetimePartLimits    = GCIDB.GetLifetimeLimits(SelectedPartName);
             LoadedLifetimeLimitID = LifetimePartLimits.LifetimeLimitID;
             if (LifetimePartLimits.LifetimeLimitID > 0)
             {
                 LoadedPartID          = GCIDB.GetPartID(SelectedPartName);
                 ExistingSerialNumbers = GCIDB.GetSerialNumberList(SelectedPartName);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("comboPartName_SelectedIndexChanged(): " + ex.ToString());
     }
 }
Пример #2
0
        private void listParts_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (PinsEdited == true || limitList1.HasEdits() == true || lifetimeLimits1.Edited == true)
            {
                // if (MessageBox.Show("There were changes made to the part.\nWould you like to save these changes to the database?", "Edits detected", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                // {
                SaveChanges();
                //}
            }
            PinsEdited = false;
            limitList1.ClearAllEdits();
            lifetimeLimits1.Edited      = false;
            buttonSaveChanges.IsEnabled = false;

            if (listParts.Items.Count > 0)
            {
                if (listParts.SelectedItem == null)
                {
                    return;
                }
                SelectedPartName        = listParts.SelectedItem.ToString();
                SelectedLifetimeLimitID = GCIDB.GetLifetimeLimitID(SelectedPartName);
                LoadedLimitData         = GCIDB.GetProductionLimits(SelectedPartName);
                lifetimeLimits1.SetEnabled(true);

                if (SelectedLifetimeLimitID > 0)
                {
                    LoadedLifetimeLimitData = GCIDB.GetLifetimeLimits(SelectedPartName);
                    lifetimeLimits1.LCL     = LoadedLifetimeLimitData.LowerRange;
                    lifetimeLimits1.UCL     = LoadedLifetimeLimitData.UpperRange;
                }
                else
                {
                    lifetimeLimits1.LCL = Properties.Settings.Default.LifetimeLimit_DefaultLowerRange;
                    lifetimeLimits1.UCL = Properties.Settings.Default.LifetimeLimit_DefaultUpperRange;
                }

                if (LoadedLimitData.Count > 0)
                {
                    SelectedPartID            = LoadedLimitData[0].PartID;
                    SelectedProductionLimitID = LoadedLimitData[0].ProductionLimitID;
                }
                else
                {
                    SelectedPartID            = GCIDB.GetPartID(SelectedPartName);
                    SelectedProductionLimitID = 0;
                }
                limitList1.ClearLimits();
                foreach (LimitEntity Limit in LoadedLimitData)
                {
                    limitList1.AddLimit(Limit);
                }
                buttonEditTestPins.IsEnabled = true;
                //buttonSaveChanges.IsEnabled = true;
            }
        }
 public LifeTimeReportData(DataTable dtInput, LifetimeLimitEntity LimitData)
 {
     this.LimitData   = LimitData;
     RawData          = dtInput;
     AllSerialNumbers = new List <string>();
     AllTestHours     = new List <int>();
     AllTestPins      = new List <byte>();
     ParsedData       = new Dictionary <string, Dictionary <int, LifeTimeReportHourData> >();
     GetUniqueSerialNumbers();
     GetUniqueTestHours();
     PopulateData();
 }
        private void generateReort_button_Click(object sender, RoutedEventArgs e)
        {
            List <String> SerialNumbers = GetSelectedSerialNumbers();

            if (SerialNumbers.Count == 0)
            {
                MessageBox.Show("Please select serial numbers.");
                return;
            }
            DataTable           dtResult       = GCIDB.GetLifetimeData(SelectedPartName, SelectedBatchName, SerialNumbers);
            LifetimeLimitEntity Limits         = GCIDB.GetLifetimeLimits(SelectedPartName);
            LifeTimeReportData  LifetimeReport = new LifeTimeReportData(dtResult, Limits);

            LifetimeReport.GenerateExcelOutput(customerName_textBox.Text, PO_textBox.Text, prodDesc_textBox.Text, SelectedPartName, SelectedBatchName);
            //ExportToExcel.FastExportToExcel(dtResult);
        }
        private void serialNumbers_listBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            // List<string> SerialNumbers = GetSelectedSerialNumbers();
            //Show that the Button is functioning
            //MessageBox.Show(string.Format("Pulling Legacy Report for Part ID: {0}  Batch ID: {1} and Serial Number: {2}", SelectedPartName, SelectedBatchName, SelectedSerialNumbers));
            GCIDB.Initialize();
            GCIDB.OpenConnection();

            List <String> SerialNumbers = GetSelectedSerialNumbers();

            if (SerialNumbers.Count == 0)
            {
                MessageBox.Show("Please select serial numbers.");
                return;
            }
            DataTable           dtResult       = GCIDB.GetLifetimeData(SelectedPartName, SelectedBatchName, SerialNumbers);
            LifetimeLimitEntity Limits         = GCIDB.GetLifetimeLimits(SelectedPartName);
            LifeTimeReportData  LifetimeReport = new LifeTimeReportData(dtResult, Limits);

            //dt = GCIDB.GetLifetimeData(SelectedPartName, SelectedBatchName, SelectedSerialNumbers);
            dataGrid.DataContext = dtResult;
        }
Пример #6
0
        public static LifetimeLimitEntity GetLifetimeLimits(string PartName)
        {
            LifetimeLimitEntity Results = new LifetimeLimitEntity();
            int PartID = GetPartID(PartName);

            if (PartID != 0)
            {
                int LifetimeLimitID = GetLifetimeLimitID(PartName);
                if (LifetimeLimitID != 0)
                {
                    string query = @"SELECT LowerRange, UpperRange FROM GCI.LifetimeLimit
                                    WHERE LifetimeLimitID = " + LifetimeLimitID.ToString();
                    if (OpenConnection() == true)
                    {
                        //Create Command
                        MySqlCommand cmd = new MySqlCommand(query, connection);
                        //Create a data reader and Execute the command
                        MySqlDataReader dataReader = cmd.ExecuteReader();

                        //Read the data and store them in the list
                        while (dataReader.Read())
                        {
                            double LowerRange = Convert.ToDouble(dataReader["LowerRange"]);
                            double UpperRange = Convert.ToDouble(dataReader["UpperRange"]);

                            Results = new LifetimeLimitEntity(LifetimeLimitID, UpperRange, LowerRange);
                        }
                        dataReader.Close();

                        //close Connection
                        CloseConnection();
                    }
                }
            }
            return(Results);
        }