private int GetCountSum(CountTreeDO masterCopy)
        {
            int countSum = 0;
            foreach (ComponentFileVM comp in this.ActiveComponents)
            {
                CountTreeDO compCount = comp.Database.ReadSingleRow<CountTreeDO>
                    ("CountTree", masterCopy.CountTree_CN);

                countSum += (int)compCount.TreeCount;
            }
            return countSum;
        }
		public void SetValues(CountTreeDO obj)
		{
			if(obj == null) { return; }
			TreeCount = obj.TreeCount;
			SumKPI = obj.SumKPI;
		}
		public CountTreeDO(CountTreeDO obj) : this()
		{
		    SetValues(obj);
		}
        public DialogResult ShowDialog(CountTreeVM count)
        {
            var method = count.SampleGroup.Stratum.Method;
            bool isPlot = Array.IndexOf(CruiseDAL.Schema.CruiseMethods.PLOT_METHODS, method) >= 0;
            bool isThreep = count.SampleGroup.Stratum.Is3P;

            this.EnableTallyCount = !isPlot;
            this.EnableBigBAF = isPlot;
            this.EnableIFrequency = !isPlot;
            this.EnableTotalTreeCount = !isPlot;

            this.EnableFrequency = !isThreep;
            this.EnableKZ = isThreep;
            this.EnableSumKPI = (isThreep && !isPlot);

            //this.comboBox1.SelectedItem = (count.Tag is BlockSelecter) ? TallyMode.Block.ToString() : (count.Tag is SRSSelecter) ? TallyMode.SRS.ToString() : (count.Tag is SystematicSelecter) ? TallyMode.Systematic.ToString() : "???";
            this._tallyDescription_TB.Text = count.Tally.Description;
            this._SGDescription_TB.Text = count.SampleGroup.Description;
            this._frequencyTB.Text = count.SampleGroup.ToString("1 in [SamplingFrequency]", null);
            this._kzTB.Text = count.SampleGroup.KZ.ToString();
            this._SumKPI_TB.Text = count.SumKPI.ToString();
            this._bigBAFTB.Text = count.SampleGroup.BigBAF.ToString();
            this._iFreqTB.Text = count.SampleGroup.InsuranceFrequency.ToString();
            this._tallyCount_TB.Text = count.TreeCount.ToString();
            long countsFromTrees = count.GetCountsFromTrees();
            this._countsFromTrees_TB.Text = countsFromTrees.ToString();
            this._totalTreeCount_TB.Text = (countsFromTrees + count.TreeCount).ToString();
            this._measureTrees_TB.Text = count.GetMeasureTreeCount().ToString();

            String samplingMethod = "Manual";
            SampleSelecter sampler = count.SampleGroup.Sampler;
            if (sampler != null)
            {
                if (sampler is SystematicSelecter)
                {
                    samplingMethod = "Systematic with random start";
                }
                else if (sampler is BlockSelecter)
                {
                    samplingMethod = "Blocked";
                }
                else if (sampler is ThreePSelecter)
                {
                    samplingMethod = "Three P";
                }
            }
            this._samplingMethod_TB.Text = samplingMethod;

            _count = count;
            DialogResult result = this.ShowDialog();
            _count = null;
            return result;
        }
 public void LogTreeCountEdit(CountTreeDO countTree, long oldValue, long newValue)
 {
     this._cDal.LogMessage(String.Format("Tree Count Edit: CT_CN={0}; PrevVal={1}; NewVal={2}", countTree.CountTree_CN, oldValue, newValue), "I");
 }
 public void LogTreeCountEdit(CountTreeDO countTree, long oldValue, long newValue)
 {
     throw new NotImplementedException();
 }