public DialogResult ShowDialog(TreeVM tree)
        {
            _logicController.Tree = tree;
            this.Enabled = true;

            return DialogResult.OK;
        }
 public TreeValidationWorker(ICollection<TreeVM> trees)
 {
     Debug.Assert(trees != null);
     lock (((System.Collections.ICollection)trees).SyncRoot)
     {
         TreeVM[] copy = new TreeVM[trees.Count];
         trees.CopyTo(copy, 0);
         this._treesLocal = copy;
     }
 }
        public SaveTreesWorker(DAL datastore, ICollection<TreeVM> trees)
        {
            Debug.Assert(datastore != null);
            Debug.Assert(trees != null);

            _datastore = datastore;
            lock (((System.Collections.ICollection)trees).SyncRoot)
            {
                //create a local copy of tree collection
                TreeVM[] a = new TreeVM[trees.Count];
                trees.CopyTo(a, 0);
                _trees = a;
            }
        }
예제 #4
0
        public DialogResult ShowDialog(TreeVM tree)
        {
            if (tree == null) { throw new ArgumentNullException("tree"); }

            this._logs = new BindingList<LogDO>(tree.LoadLogs());

            this._currentTree = tree;
            this._treeDesLbl.Text = tree.LogLevelDiscription;

            this._dataGrid.DataSource = this._logs;
            this._dataGrid.Focus();

            var result = ShowDialog();
            tree.LogCountDirty = true;
            return result;
        }
 public double GetTreeFieldValue(TreeVM tree)
 {
     if (this.Field == FixCNTTallyField.DBH)
     {
         return tree.DBH;
     }
     else if (Field == FixCNTTallyField.TotalHeight)
     {
         return tree.TotalHeight;
     }
     else if (Field == FixCNTTallyField.DRC)
     {
         return tree.DRC;
     }
     else
     {
         throw new NotImplementedException();
     }
 }
예제 #6
0
 public void AddTree(TreeVM tree)
 {
     lock (((System.Collections.ICollection)Trees).SyncRoot)
     {
         this.Trees.Add(tree);
     }
 }
예제 #7
0
 public void DeleteTree(TreeVM tree)
 {
     tree.Delete();
     //TreeDO.RecursiveDeleteTree(tree);
     //this.CuttingUnit.TreeList.Remove(tree);
     this.Trees.Remove(tree);
 }
 protected void UpdateSpeciesColumn(TreeVM tree, DataGridViewComboBoxCell cell)
 {
     if (cell == null) { return; }
     cell.DataSource = tree.ReadValidTDVs();
 }
 public void UpdateSampleGroupColumn(TreeVM tree)
 {
     if (_sgColumn != null)
     {
         _sgColumn.DataSource = tree.ReadValidSampleGroups();
     }
 }
예제 #10
0
 public void HandleCurrentTreeChanged(TreeVM tree)
 {
     /*Do nothing*/
 }
예제 #11
0
 //protected bool ProcessSampleGroupChanging(TreeVM tree, SampleGroupVM newSG)
 //{
 //    if (tree == null || newSG == null) { return false; }
 //    if (tree.SampleGroup != null)
 //    {
 //        if (MessageBox.Show("You are changing the Sample Group of a tree, are you sure you want to do this?", "!", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button2)
 //            == DialogResult.No)
 //        {
 //            return false;
 //        }
 //        else
 //        {
 //            this.AppController._cDal.LogMessage(String.Format("Tree Sample Group Changed (Cu:{0} St:{1} Sg:{2} -> {3} Tdv_CN:{4} T#: {5}",
 //                tree.CuttingUnit.Code,
 //                tree.Stratum.Code,
 //                (tree.SampleGroup != null) ? tree.SampleGroup.Code : "?",
 //                newSG.Code,
 //                (tree.TreeDefaultValue != null) ? tree.TreeDefaultValue.TreeDefaultValue_CN.ToString() : "?",
 //                tree.TreeNumber), "high");
 //            tree.SampleGroup = newSG;
 //        }
 //    }
 //    else
 //    {
 //        tree.SampleGroup = newSG;
 //    }
 //    if (tree.TreeDefaultValue != null)
 //    {
 //        var hasTDV = tree.DAL.ExecuteScalar<bool>("SELECT count(1) " +
 //            "FROM SampleGroupTreeDefaultValue " +
 //            "WHERE TreeDefaultValue_CN = ? AND SampleGroup_CN"
 //            , tree.TreeDefaultValue_CN, newSG.SampleGroup_CN);
 //        if (!hasTDV)
 //        {
 //            tree.SetTreeTDV(null);
 //        }
 //    }
 //    return tree.TrySave();
 //}
 protected bool ProcessSpeciesChanged(TreeVM tree, TreeDefaultValueDO tdv)
 {
     if (tree == null) { return true; }
     if (tree.TreeDefaultValue == tdv) { return true; }
     tree.SetTreeTDV(tdv);
     return tree.TrySave();
 }
 public System.Windows.Forms.DialogResult ShowLimitingDistanceDialog(float baf, bool isVariableRadius, TreeVM optTree, out string logMessage)
 {
     throw new NotImplementedException();
 }
 public void ShowLogsView(StratumModel stratum, TreeVM tree)
 {
     throw new NotImplementedException();
 }
예제 #14
0
        public TreeVM UserAddTree(TreeVM templateTree, IViewController viewController)
        {
            TreeVM newTree;
            SampleGroupModel assumedSG = null;
            TreeDefaultValueDO assumedTDV = null;

            if (templateTree != null)
            {
                assumedSG = templateTree.SampleGroup; ;
                assumedTDV = templateTree.TreeDefaultValue;
            }

            //extrapolate sample group
            if (assumedSG == null)//if we have a stratum but no sample group, pick the first one
            {
                List<SampleGroupModel> samplegroups = this.DAL.From<SampleGroupModel>()
                    .Where("Stratum_CN = ?")
                    .Read(this.Stratum.Stratum_CN).ToList();
                if (samplegroups.Count == 1)
                {
                    assumedSG = samplegroups[0];
                }
            }

            newTree = this.CreateNewTreeEntry(assumedSG, assumedTDV, true);

            viewController.ShowCruiserSelection(newTree);

            //if a 3P plot method set Count Measure to empty.
            if (Array.IndexOf(CruiseDAL.Schema.CruiseMethods.THREE_P_METHODS,
                this.Stratum.Method) >= 0)
            {
                newTree.CountOrMeasure = string.Empty;
            }

            newTree.TreeCount = 1; //user added trees need a tree count of one because they aren't being tallied
            newTree.TrySave();
            this.AddTree(newTree);

            return newTree;
        }
예제 #15
0
 public TallyAction(TreeVM treeRecord, CountTreeVM count)
 {
     TreeRecord = treeRecord;
 }
예제 #16
0
 public void PopulateData(CruiseDAL.DAL dal)
 {
     if (this._countCN != 0L)
     {
         this.Count = dal.ReadSingleRow<CountTreeVM>(this._countCN);
     }
     if (this._treeCN != 0L)
     {
         this.TreeRecord = dal.ReadSingleRow<TreeVM>(this._treeCN);
     }
     if (this._treeEstCN != 0L)
     {
         this.TreeEstimate = dal.ReadSingleRow<TreeEstimateDO>(this._treeEstCN);
     }
 }
 public override void ShowCruiserSelection(TreeVM tree)
 {
     if (this.ApplicationController.Settings.EnableCruiserPopup)
     {
         if (_cruiserSelectionView == null)
         {
             _cruiserSelectionView = new FormCruiserSelection(ApplicationController);
         }
         _cruiserSelectionView.ShowDialog(tree);
     }
 }
 public void UpdateSpeciesColumn(TreeVM tree)
 {
     if (_speciesColumn != null)
     {
         _speciesColumn.DataSource = tree.ReadValidTDVs();
     }
 }
 public void ShowCruiserSelection(TreeVM tree)
 {
     throw new NotImplementedException();
 }
 public void AddNonPlotTree(TreeVM tree)
 {
     lock (((System.Collections.ICollection)this.NonPlotTrees).SyncRoot)
     {
         this.NonPlotTrees.Add(tree);
     }
     _treesAddedSinceLastSave++;
     if (_treesAddedSinceLastSave >= TREE_SAVE_INTERVAL)
     {
         this.TrySaveTreesAsync();
     }
 }
 public void ShowLogsView(CruiseDAL.DataObjects.StratumDO stratum, TreeVM tree)
 {
     throw new NotImplementedException();
 }
 public void DeleteTree(TreeVM tree)
 {
     tree.Delete();
     this.NonPlotTrees.Remove(tree);
 }
 public void UpdateSampleGroupColumn(TreeVM tree)
 {
     this.UpdateSampleGroupColumn(tree, this.CurrentCell as DataGridViewComboBoxCell);
 }
        internal TreeVM CreateNewTreeEntryInternal(StratumModel stratum
            , SampleGroupModel sg
            , TreeDefaultValueDO tdv
            , bool isMeasure)
        {
            TreeVM newTree = new TreeVM(this.DAL);
            newTree.TreeCount = 0;
            newTree.CountOrMeasure = (isMeasure) ? "M" : "C";
            newTree.CuttingUnit = this;

            if (sg != null)
            {
                newTree.SampleGroup = sg;
                if (tdv == null)
                {
                    if (sg.TreeDefaultValues.IsPopulated == false)
                    {
                        sg.TreeDefaultValues.Populate();
                    }
                    if (sg.TreeDefaultValues.Count == 1)
                    {
                        tdv = sg.TreeDefaultValues[0];
                    }
                }
            }
            if (stratum != null) { newTree.Stratum = stratum; }
            if (tdv != null)
            {
                newTree.SetTreeTDV(tdv);
            }

            newTree.Validate();
            //newTree.Save();

            return newTree;
        }
예제 #25
0
 public void UpdateSpeciesColumn(TreeVM tree)
 {
     this.UpdateSpeciesColumn(tree, this._dataGrid.CurrentCell as DataGridViewComboBoxCell);
 }
예제 #26
0
        public DialogResult ShowDialog(TreeVM tree)
        {
            this._currentTree = tree;

            this._logs = new BindingList<LogDO>(tree.LoadLogs());

            this._treeDesLbl.Text = tree.LogLevelDiscription;

            this._BS_Logs.DataSource = this._logs;
            this._dataGrid.DataSource = this._BS_Logs;
            this._dataGrid.Focus();
            tree.LogCountDirty = true;
            return this.ShowDialog();
        }
예제 #27
0
 protected void UpdateSampleGroupColumn(TreeVM tree, DataGridViewComboBoxCell cell)
 {
     if (cell == null) { return; }
     cell.DataSource = tree.ReadValidSampleGroups();
 }
 public virtual void ShowCruiserSelection(TreeVM tree)
 {
 }
        public DialogResult ShowDialog(TreeVM tree)
        {
            _logicController.Tree = tree;

            return base.ShowDialog();
        }
 public void ShowLogsView(StratumModel stratum, TreeVM tree)
 {
     if (stratum == null)
     {
         MessageBox.Show("Invalid Action. Stratum not set.");
     }
     this.GetLogsView(stratum).ShowDialog(tree);
 }