Beispiel #1
0
        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!");
        }
Beispiel #2
0
        private void buttonAddNewPart_Click(object sender, EventArgs e)
        {
            AddPartName AddPart = new AddPartName();

            //AddPart partWindow = new AddPart();
            AddPart.ShowDialog();

            if (AddPart.closed)
            {
                int PartId = GCIDB.GetPartID(AddPart.PartName);
                if (PartId == 0)
                {
                    GCIDB.AddPartID(AddPart.PartName);

                    int LifetimeLimitID = GCIDB.AddNewLifetimeLimit(AddPart.PartName, Properties.Settings.Default.LifetimeLimit_DefaultLowerRange, Properties.Settings.Default.LifetimeLimit_DefaultUpperRange);
                    GCIDB.SetLifetimeLimit(AddPart.PartName, LifetimeLimitID);
                    PopulatePartList();
                }
                // else
                //MessageBox.Show("Error partname already exists in database.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            //Console.Write(AddPart.PartName);
        }