public void SetValues(LogDO obj)
		{
			if(obj == null) { return; }
			Log_GUID = obj.Log_GUID;
			LogNumber = obj.LogNumber;
			Grade = obj.Grade;
			SeenDefect = obj.SeenDefect;
			PercentRecoverable = obj.PercentRecoverable;
			Length = obj.Length;
			ExportGrade = obj.ExportGrade;
			SmallEndDiameter = obj.SmallEndDiameter;
			LargeEndDiameter = obj.LargeEndDiameter;
			GrossBoardFoot = obj.GrossBoardFoot;
			NetBoardFoot = obj.NetBoardFoot;
			GrossCubicFoot = obj.GrossCubicFoot;
			NetCubicFoot = obj.NetCubicFoot;
			BoardFootRemoved = obj.BoardFootRemoved;
			CubicFootRemoved = obj.CubicFootRemoved;
			DIBClass = obj.DIBClass;
			BarkThickness = obj.BarkThickness;
		}
		public LogDO(LogDO obj) : this()
		{
		    SetValues(obj);
		}
        public int getReconData(StratumStatsDO curStrStats, SampleGroupStatsDO curSgStats, DAL rDAL, DAL fsDAL, List<PlotDO> myPlots, List<TreeDO> myTree, List<LogDO> myLogs, long? sampleGroupCN, bool first, int measHit)
        {
            TreeDO fsTree;
             LogDO fsLog;
             long? plotCN = 0;
             var myTreeList = myTree;
             var myLogList = myLogs;
             int treeCnt = 1;

             curStrStats.Stratum.CuttingUnits.Populate();
             curSgStats.TreeDefaultValueStats.Populate();
             // loop through design units
             foreach (CuttingUnitDO curUnit in curStrStats.Stratum.CuttingUnits)
             {
            // get number of plots for stratum and cutting unit
            var myPlotList = (from plt in myPlots
                              where plt.CuttingUnit_CN == curUnit.CuttingUnit_CN
                              select plt).ToList();
            // loop through plots
            foreach (PlotDO curPlot in myPlotList)
            {
               // if first time for stratum, save plots
               plotCN = savePlots(curPlot, curStrStats.Stratum_CN, first);

               foreach (TreeDefaultValueDO curTdv in curSgStats.TreeDefaultValueStats)
               {
                  if (curSgStats.MinDbh > 0 && curSgStats.MaxDbh > 0)
                  {
                     double maxDbh = curSgStats.MaxDbh + 0.0499;
                     double minDbh = curSgStats.MinDbh - 0.0500;
                     myTreeList = (from tcv in myTree
                                       where tcv.SampleGroup.PrimaryProduct == curSgStats.PrimaryProduct
                                       && tcv.Plot_CN == curPlot.Plot_CN
                                       && tcv.Species == curTdv.Species
                                       && tcv.LiveDead == curTdv.LiveDead
                                       && tcv.DBH >= minDbh
                                       && tcv.DBH <= maxDbh
                                       select tcv).ToList();
                  }
                  else
                  {
                     myTreeList = (from tcv in myTree
                                       where tcv.SampleGroup.PrimaryProduct == curSgStats.PrimaryProduct
                                       && tcv.Plot_CN == curPlot.Plot_CN
                                       && tcv.Species == curTdv.Species
                                       && tcv.LiveDead == curTdv.LiveDead
                                       select tcv).ToList();
                  }

                  foreach (TreeDO rTree in myTreeList)
                  {
                     fsTree = new TreeDO(fsDAL);
                     fsTree.Stratum_CN = thisStrCN;
                     fsTree.TreeDefaultValue_CN = curTdv.TreeDefaultValue_CN;
                     fsTree.SampleGroup_CN = sampleGroupCN;
                     fsTree.Plot_CN = plotCN;
                     fsTree.CuttingUnit_CN = curUnit.CuttingUnit_CN;
                     fsTree.TreeNumber = rTree.TreeNumber;
                     fsTree.Species = rTree.Species;
                     if (curStrStats.Method == "PCM" || curStrStats.Method == "FCM")
                     {
                        if (radioButton1.Checked)
                        {
                           // use frequency
                           // check hit
                           if (treeCnt == measHit)
                           {
                              fsTree.CountOrMeasure = "M";
                              measHit += (int)curSgStats.SamplingFrequency;
                           }
                           else
                              fsTree.CountOrMeasure = "C";

                        }
                        else if (radioButton2.Checked)
                        {
                           fsTree.CountOrMeasure = "C";
                        }
                        else
                           fsTree.CountOrMeasure = "M";
                     }
                     else
                        fsTree.CountOrMeasure = rTree.CountOrMeasure;
                     treeCnt++;
                     fsTree.TreeCount = 1;
                     fsTree.SeenDefectPrimary = rTree.SeenDefectPrimary;
                     fsTree.SeenDefectSecondary = rTree.SeenDefectSecondary;
                     fsTree.RecoverablePrimary = rTree.RecoverablePrimary;
                     fsTree.Initials = rTree.Initials;
                     fsTree.LiveDead = rTree.LiveDead;
                     fsTree.Grade = rTree.Grade;
                     fsTree.HeightToFirstLiveLimb = rTree.HeightToFirstLiveLimb;
                     fsTree.DBH = rTree.DBH;
                     fsTree.DRC = rTree.DRC;
                     fsTree.TotalHeight = rTree.TotalHeight;
                     fsTree.MerchHeightPrimary = rTree.MerchHeightPrimary;
                     fsTree.MerchHeightSecondary = rTree.MerchHeightSecondary;
                     fsTree.FormClass = rTree.FormClass;
                     fsTree.UpperStemHeight = rTree.UpperStemHeight;
                     fsTree.TopDIBPrimary = rTree.TopDIBPrimary;
                     fsTree.TopDIBSecondary = rTree.TopDIBSecondary;
                     //fsTree.CreatedBy = rTree.CreatedBy;
                     //fsTree.CreatedDate = rTree.CreatedDate;

                     fsTree.Save();
                     // save logs
                     myLogList = (from lcv in myLogs
                                  where lcv.Tree_CN == rTree.Tree_CN
                                  select lcv).ToList();

                     foreach (LogDO rLog in myLogList)
                     {
                        fsLog = new LogDO(fsDAL);
                        fsLog.Tree_CN = rLog.Tree_CN;
                        fsLog.LogNumber = rLog.LogNumber;
                        fsLog.Grade = rLog.Grade;
                        fsLog.SeenDefect = rLog.SeenDefect;
                        fsLog.PercentRecoverable = rLog.PercentRecoverable;
                        fsLog.Length = rLog.Length;
                        fsLog.ExportGrade = rLog.ExportGrade;
                        fsLog.SmallEndDiameter = rLog.SmallEndDiameter;
                        fsLog.LargeEndDiameter = rLog.LargeEndDiameter;
                        fsLog.GrossBoardFoot = rLog.GrossBoardFoot;
                        fsLog.NetBoardFoot = rLog.NetBoardFoot;
                        fsLog.GrossCubicFoot = rLog.GrossCubicFoot;
                        fsLog.NetCubicFoot = rLog.NetCubicFoot;
                        fsLog.DIBClass = rLog.DIBClass;
                        fsLog.BarkThickness = rLog.BarkThickness;
                        fsLog.Save();
                    }
                  }
               }
            }
             }
             return (0);
        }
示例#4
0
        LogDO AddLogRec()
        {
            LogDO newLog = new LogDO(this.Controller._cDal);
            newLog.Tree_CN = _currentTree.Tree_CN;
            newLog.LogNumber = (GetHighestLogNum() + 1).ToString();

            this._logs.Add(newLog);
            this._dataGrid.CurrentRowIndex = this._dataGrid.RowCount - 1;
            this._dataGrid.MoveFirstEmptyCell();
            return newLog;
        }
 //private void _DGV_Logs_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
 //{
 //    var log = e.Row.DataBoundItem as LogDO;
 //    if (log == null) { e.Cancel = true; return; }
 //    e.Cancel = !this.TryDeleteLog(log);
 //}
 protected bool TryDeleteLog(LogDO log)
 {
     try
     {
         log.Delete();
         return true;
     }
     catch
     {
         return false;
     }
 }
示例#6
0
        private LogDO AddLogRec()
        {
            LogDO newLog = new LogDO(this.Controller._cDal);
            newLog.Tree_CN = _currentTree.Tree_CN;
            newLog.LogNumber = (GetHighestLogNum() + 1).ToString();

            this._logs.Add(newLog);
            this._dataGrid.GoToLastRow();
            this._dataGrid.GoToFirstColumn();
            return newLog;
        }