private void saveButton_Click(object sender, RoutedEventArgs e) { int ProductionLimitID = GCIDB.AssociatePartToNewProductionLimit(SelectedPartName); if (ProductionLimitID != 0) { //List<LimitEntity> UserLimits = BuildLimitEntityList(); //foreach (LimitEntity entry in UserLimits) //{ // GCIDB.AddProductionLimit(LimitID, entry.PinID, entry.UCL, entry.LCL); //} foreach (int PinID in LearnResults.Keys) { int DutPinID = GCIToDUTMap[PinID]; Double Average = LearnResults[PinID].GetVoltageAverage(); Double StdDev = LearnResults[PinID].GetStandardDeviation(); int NumberOfSigmas = (int)numericSigma.pinValue(); Double UCL = Average + NumberOfSigmas * StdDev; Double LCL = Average - NumberOfSigmas * StdDev; GCIDB.AddProductionLimit(ProductionLimitID, DutPinID, UCL, LCL, Average, StdDev); } MessageBox.Show("Limits saved to the database", "Success", MessageBoxButton.OK); } // this.DialogResult = this.ShowDialog(); // this.Close(); }
private void SaveChanges() { if (PinsEdited == true || limitList1.HasEdits() == true) { SelectedProductionLimitID = GCIDB.AssociatePartToNewProductionLimit(SelectedPartName); List <LimitEntity> UserLimits = limitList1.BuildLimitEntityList(); foreach (LimitEntity entry in UserLimits) { GCIDB.AddProductionLimit(SelectedProductionLimitID, entry.PinID, entry.UCL, entry.LCL, entry.AverageVoltage, entry.StdDevVoltage); } PinsEdited = false; limitList1.ClearAllEdits(); buttonSaveChanges.IsEnabled = false; } if (lifetimeLimits1.Edited == true) { int LifetimeLimitID = GCIDB.AddNewLifetimeLimit(SelectedPartName, lifetimeLimits1.LCL, lifetimeLimits1.UCL); SelectedLifetimeLimitID = LifetimeLimitID; GCIDB.SetLifetimeLimit(SelectedPartName, SelectedLifetimeLimitID); lifetimeLimits1.Edited = false; buttonSaveChanges.IsEnabled = false; } MessageBox.Show("All changes saved!"); }