private void AdjustTestCount() { // Do we now have too many tests? If so, chop off the extras while (PCSTests.Count > SampleSize) { PCSTests.RemoveAt(PCSTests.Count - 1); } // Not enough tests? Add more while (PCSTests.Count < SampleSize) { var pcsTest = new PCSTest(); if (PackageType.Standard == PackType) { pcsTest.MarkedWeight = Marked; } pcsTest.Pack_ID = Pack_ID; pcsTest.Test = (short)(pcsTests.Count + 1); pcsTest.Parent = this; PCSTests.Add(pcsTest); } }
private void LoadPackTests() { PCSTest pcsTest; pcsTests = new ObservableCollection<PCSTest>(); string sql = "Select Pack_ID, Test from PackTest where insp_id ='" + this.InspId + "' and Pack_ID = "+ this.Pack_ID + " order by Pack_ID, Test"; DbDataReader rdr = WWD.GetReader(sql); while (rdr.Read()) { pcsTest = new PCSTest(); pcsTest.Load(this.InspId, rdr.GetInt16NoNull(0), rdr.GetInt16NoNull(1)); pcsTest.Parent = this; pcsTest.PCSTareUpdate += TareUpdated; pcsTest.PCSUpdateRequired += FullUpdate; pcsTests.Add(pcsTest); } pcsTestLoaded = true; }