示例#1
0
        public bool HandleStratumChanging(StratumDO newStratum, IView view)
        {
            if (newStratum == null) { return false; }
            if (Stratum != null
                && Stratum.Stratum_CN == newStratum.Stratum_CN)
            { return false; }

            if (Stratum != null)
            {
                if (!view.AskYesNo("You are changing the stratum of a tree" +
                    ", are you sure you want to do this?"
                    , "!", System.Windows.Forms.MessageBoxIcon.Asterisk))
                {
                    return false;//do not change stratum
                }
                else
                {
                    //log stratum changed
                    DAL.LogMessage(String.Format("Tree Stratum Changed (Cu:{0} St:{1} -> {2} Sg:{3} Tdv_CN:{4} T#: {5} P#:{6}"
                        , CuttingUnit.Code
                        , Stratum.Code
                        , newStratum.Code
                        , (SampleGroup != null) ? SampleGroup.Code : "?"
                        , (TreeDefaultValue != null) ? TreeDefaultValue.TreeDefaultValue_CN.ToString() : "?"
                        , TreeNumber
                        , (Plot != null) ? Plot.PlotNumber.ToString() : "-"), "I");
                    return true;
                }
            }
            else
            {
                return true;
            }
        }
示例#2
0
        public bool HandleSampleGroupChanging(SampleGroupDO newSG, IView view)
        {
            if (newSG == null) { return false; }
            if (SampleGroup != null
                && SampleGroup.SampleGroup_CN == newSG.SampleGroup_CN) { return true; }

            if (SampleGroup != null)
            {
                if (!view.AskYesNo("You are changing the Sample Group of a tree, are you sure you want to do this?"
                    , "!"
                    , System.Windows.Forms.MessageBoxIcon.Asterisk
                    , true))
                {
                    return false;
                }
                else
                {
                    DAL.LogMessage(String.Format("Tree Sample Group Changed (Cu:{0} St:{1} Sg:{2} -> {3} Tdv_CN:{4} T#: {5}",
                        CuttingUnit.Code,
                        Stratum.Code,
                        (SampleGroup != null) ? SampleGroup.Code : "?",
                        newSG.Code,
                        (TreeDefaultValue != null) ? TreeDefaultValue.TreeDefaultValue_CN.ToString() : "?",
                        TreeNumber), "high");
                    return true;
                }
            }
            else
            {
                return true;
            }
        }