public void getLogFieldSetup(DAL cDAL, DAL fsDAL, StratumStatsDO myStStats) { List<LogFieldSetupDefaultDO> logFieldDefaults = new List<LogFieldSetupDefaultDO>(cDAL.Read<LogFieldSetupDefaultDO>("LogFieldSetupDefault", null, null)); foreach (LogFieldSetupDefaultDO lfd in logFieldDefaults) { LogFieldSetupDO lfs = new LogFieldSetupDO(); lfs.Stratum_CN = thisStrCN; lfs.Field = lfd.Field; lfs.FieldOrder = lfd.FieldOrder; lfs.ColumnType = lfd.ColumnType; lfs.Heading = lfd.Heading; lfs.Width = lfd.Width; lfs.Format = lfd.Format; lfs.Behavior = lfd.Behavior; logFields.Add(lfs); } fsDAL.Save(logFields); }
public void getTreeFieldSetup(DAL cDAL, DAL fsDAL, StratumStatsDO myStStats) { //select from TreeFieldSetupDefault where method = stratum.method List<TreeFieldSetupDefaultDO> treeFieldDefaults = new List<TreeFieldSetupDefaultDO>(cDAL.Read < TreeFieldSetupDefaultDO >("TreeFieldSetupDefault", "WHERE Method = ? ORDER BY FieldOrder", myStStats.Method)); foreach (TreeFieldSetupDefaultDO tfd in treeFieldDefaults) { TreeFieldSetupDO tfs = new TreeFieldSetupDO(); tfs.Stratum_CN = thisStrCN; tfs.Field = tfd.Field; tfs.FieldOrder = tfd.FieldOrder; tfs.ColumnType = tfd.ColumnType; tfs.Heading = tfd.Heading; tfs.Width = tfd.Width; tfs.Format = tfd.Format; tfs.Behavior = tfd.Behavior; treeFields.Add(tfs); } fsDAL.Save(treeFields); }
private void copyPopulations(DAL cDAL, DAL rDAL, DAL fsDAL, bool reconData, string[] stRecCode) { TreeDefaultValueDO currentTDV = new TreeDefaultValueDO(); List<StratumStatsDO> cdStratumStats = new List<StratumStatsDO>(cDAL.Read<StratumStatsDO>("StratumStats", "JOIN Stratum ON StratumStats.Stratum_CN = Stratum.Stratum_CN AND StratumStats.Method = Stratum.Method AND StratumStats.Used = 1 ORDER BY Stratum.Code", null)); List<PlotDO> myPlots = new List<PlotDO>(); List<TreeDO> myTree = new List<TreeDO>(); BindingList<TreeFieldSetupDO> treeFields = new BindingList<TreeFieldSetupDO>(); bool first; string method = ""; foreach (StratumStatsDO myStStats in cdStratumStats) { setRecData = false; first = true; // check if recon data is to be saved if (reconData) { string strCode = myStStats.Code; if (myStStats.Method == "PNT" || myStStats.Method == "PCM") method = "PNT"; else if (myStStats.Method == "FIX" || myStStats.Method == "FCM") method = "FIX"; foreach (string stRec in stRecCode) { if (stRec == strCode) { setRecData = true; myPlots = (rDAL.Read<PlotDO>("Plot", "JOIN Stratum ON Plot.Stratum_CN = Stratum.Stratum_CN WHERE Stratum.Method = ?", method)); if(myTree.Count == 0) myTree = (rDAL.Read<TreeDO>("Tree", null, null)); } } } // get fsDAl stratum record List<SampleGroupStatsDO> mySgStats = new List<SampleGroupStatsDO>(cDAL.Read<SampleGroupStatsDO>("SampleGroupStats", "Where StratumStats_CN = ?", myStStats.StratumStats_CN)); // loop through sample groups foreach (SampleGroupStatsDO sgStats in mySgStats) { SampleGroupDO fsSg = new SampleGroupDO(fsDAL); // save sample group information fsSg.Stratum_CN = sgStats.StratumStats.Stratum_CN; fsSg.Code = sgStats.Code; fsSg.Description = sgStats.Description; fsSg.CutLeave = sgStats.CutLeave; fsSg.UOM = sgStats.UOM; fsSg.PrimaryProduct = sgStats.PrimaryProduct; fsSg.SecondaryProduct = sgStats.SecondaryProduct; fsSg.DefaultLiveDead = sgStats.DefaultLiveDead; fsSg.KZ = sgStats.KZ; fsSg.InsuranceFrequency = sgStats.InsuranceFrequency; if (myStStats.Method == "PCM" || myStStats.Method == "FCM") { if (checkBoxFreq.Checked) { fsSg.SamplingFrequency = sgStats.SamplingFrequency; fsSg.BigBAF = 0; } else { fsSg.SamplingFrequency = 0; fsSg.BigBAF = Convert.ToInt32(sgStats.BigBAF); } } else { fsSg.SamplingFrequency = sgStats.SamplingFrequency; fsSg.BigBAF = Convert.ToInt32(sgStats.BigBAF); } // find treedefaultvalues sgStats.TreeDefaultValueStats.Populate(); foreach (TreeDefaultValueDO tdv in sgStats.TreeDefaultValueStats) { fsSg.TreeDefaultValues.Add(tdv); } fsSg.Save(); fsSg.TreeDefaultValues.Save(); // if recon can be saved if (setRecData) { getReconData(myStStats, sgStats, rDAL, fsDAL, myPlots, myTree, fsSg.SampleGroup_CN, first); // get plot data first = false; // get tree data // get log data } } //select from TreeFieldSetupDefault where method = stratum.method List<TreeFieldSetupDefaultDO> treeFieldDefaults = new List<TreeFieldSetupDefaultDO>(cDAL.Read < TreeFieldSetupDefaultDO >("TreeFieldSetupDefault", "WHERE Method = ? ORDER BY FieldOrder", myStStats.Method)); foreach (TreeFieldSetupDefaultDO tfd in treeFieldDefaults) { TreeFieldSetupDO tfs = new TreeFieldSetupDO(); tfs.Stratum_CN = myStStats.Stratum_CN; tfs.Field = tfd.Field; tfs.FieldOrder = tfd.FieldOrder; tfs.ColumnType = tfd.ColumnType; tfs.Heading = tfd.Heading; tfs.Width = tfd.Width; tfs.Format = tfd.Format; tfs.Behavior = tfd.Behavior; treeFields.Add(tfs); } } fsDAL.Save(treeFields); }