DAL SetupDataStore() { var dataStore = new DAL(_pathToFile, true); var sale = new SaleDO(dataStore) { LogGradingEnabled = false, SaleNumber = "12345", Region = "01", Forest = "01", District = "01" }; sale.Save(); var unit = new CuttingUnitDO(dataStore) { Code = "01" }; unit.Save(); var stratum = new StratumDO(dataStore) { Code = "01", Method = CruiseMethods.STR }; stratum.Save(); unit.Strata.Add(stratum); unit.Strata.Save(); var sg = new SampleGroupDO(dataStore) { Code = "01", CutLeave = "C", UOM = "1", PrimaryProduct = "01" }; sg.Stratum = stratum; sg.SamplingFrequency = 5; sg.InsuranceFrequency = 0; sg.Save(); var countTree = new CountTreeDO(dataStore) { SampleGroup = sg, CuttingUnit = unit }; countTree.Save(); return(dataStore); }
private CruiseDAL.DAL CreateDatastore(string cruiseMethod, int freqORkz, int insuranceFreq) { var ds = new CruiseDAL.DAL(); try { var sale = new SaleDO() { DAL = ds, SaleNumber = "12345", Region = "1", Forest = "1", District = "1", Purpose = "something", LogGradingEnabled = true }; sale.Save(); var stratum = new StratumDO() { DAL = ds, Code = "01", Method = cruiseMethod }; stratum.Save(); var cuttingUnit = new CuttingUnitDO() { DAL = ds, Code = "01" }; cuttingUnit.Save(); var cust = new CuttingUnitStratumDO() { DAL = ds, CuttingUnit = cuttingUnit, Stratum = stratum }; cust.Save(); var sampleGroup = new SampleGroupDO() { DAL = ds, Stratum = stratum, Code = "01", PrimaryProduct = "01", UOM = "something", CutLeave = "something", InsuranceFrequency = insuranceFreq }; if (CruiseMethods.THREE_P_METHODS.Contains(cruiseMethod)) { sampleGroup.KZ = freqORkz; } else { sampleGroup.SamplingFrequency = freqORkz; } sampleGroup.Save(); var tally = new TallyDO() { DAL = ds, Hotkey = "A", Description = "something" }; tally.Save(); var count = new CountTreeDO() { DAL = ds, CuttingUnit = cuttingUnit, SampleGroup = sampleGroup, Tally = tally }; count.Save(); return(ds); } catch { ds.Dispose(); throw; } }