示例#1
0
 private void _resequenceTreeNumsBtn_Click(object sender, EventArgs e)
 {
     if (DialogService.AskYesNo("This will renumber all trees in the plot starting at 1"
                                , "Continue?"
                                , false))
     {
         Plot.ResequenceTreeNumbers();
         DialogResult = DialogResult.Cancel;
     }
 }
 public bool ResequenceTreeNumbers()
 {
     if (EnsureCurrentPlotWorkable() &&
         DialogService.AskYesNo("This will renumber all trees in the plot starting at 1"
                                , "Continue?"
                                , false))
     {
         CurrentPlot.ResequenceTreeNumbers();
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#3
0
        public bool HandleStratumChanging(StratumDO newStratum)
        {
            if (newStratum == null)
            {
                return(false);
            }
            if (Stratum != null &&
                Stratum.Stratum_CN == newStratum.Stratum_CN)
            {
                return(false);
            }

            if (Stratum != null)
            {
#if NetCF
                if (!DialogService.AskYesNo("You are changing the stratum of a tree" +
                                            ", are you sure you want to do this?"
                                            , "!"))
                {
                    return(false);//do not change stratum
                }
#endif

                //log stratum changed
                ((CruiseDatastore)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);
            }
        }
        void SaveData(IDataEntryDataService dataService, ISampleSelectorRepository sampleSelectorRepository)
        {
            try
            {
                sampleSelectorRepository.SaveSamplerStates();

                Exception ex;

                ex = dataService.SaveNonPlotData();
                ex = dataService.SavePlotData() ?? ex;
                if (ex != null)
                {
                    throw ex;
                }

                ApplicationController.OnLeavingCurrentUnit();
            }
            catch (FMSC.ORM.ReadOnlyException)
            {
                MessageBox.Show("File Is Read Only \r\n" + dataService.DataStore.Path);
            }
            catch (FMSC.ORM.ConstraintException ex)
            {
                MessageBox.Show("Data Constraint Failed\r\n" + ex.Message, "Error");
                if (DialogService.AskYesNo("Would you like to go back to data entry?", string.Empty))
                {
                    ShowDataEntry(dataService, sampleSelectorRepository);
                }
            }
            catch (Exception ex)
            {
                ReportException(ex);
                if (DialogService.AskYesNo("Would you like to go back to data entry?", string.Empty))
                {
                    ShowDataEntry(dataService, sampleSelectorRepository);
                }
            }
        }
示例#5
0
        public bool HandleSampleGroupChanging(SampleGroupDO newSG)
        {
            if (newSG == null)
            {
                return(false);
            }
            if (SampleGroup != null &&
                SampleGroup.SampleGroup_CN == newSG.SampleGroup_CN)
            {
                return(true);
            }

            if (SampleGroup != null)
            {
#if NetCF
                if (!DialogService.AskYesNo("You are changing the Sample Group of a tree, are you sure you want to do this?"
                                            , "!"
                                            , true))
                {
                    return(false);
                }
#endif

                ((CruiseDatastore)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);
            }
        }
        protected override void OnClosing(CancelEventArgs e)
        {
            base.OnClosing(e);
            this._dataGrid.EndEdit();

            if (!DataService.ValidateLogGrades())
            {
                if (!DialogService.AskYesNo("One or more logs have failed audits", "Continue? - Warning"))
                {
                    e.Cancel = true;
                    return;
                }
            }

            try
            {
                DataService.Save();
            }
            catch (Exception)
            {
                e.Cancel = !DialogService.AskYesNo("Oops, logs weren't saved. Would you like to abort?"
                                                   , String.Empty);
            }
        }
 public bool AskContinueOnCurrnetPlotTreeError()
 {
     return(DialogService.AskYesNo("Error(s) found on tree records in current plot, Would you like to continue?", "Continue?", true));
 }