public FormDataEntryLogic(CuttingUnitVM unit
            , IApplicationController controller
            , IDataEntryView view)
        {
            this.Unit = unit;
            this.Controller = controller;
            this.View = view;

            this.Unit.InitializeStrata();
            //this.Counts = this.Database.Read<CountTreeVM>((string)null);
        }
Esempio n. 2
0
        public FormDataEntryLogic(IApplicationController controller,
                                  IDialogService dialogService,
                                  ISoundService soundService,
                                  IDataEntryDataService dataService,
                                  IApplicationSettings settings,
                                  IDataEntryView view,
                                  ISampleSelectorRepository sampleSelectorRepository)
        {
            this.Controller = controller;
            this.View       = view;

            _dialogService      = dialogService;
            _soundService       = soundService;
            _dataService        = dataService;
            _appSettings        = settings;
            _sampleSelectorRepo = sampleSelectorRepository;
        }
Esempio n. 3
0
        public static void OnTally(CountTree count,
                                   IDataEntryDataService dataService, ICollection <TallyAction> tallyHistory,
                                   IApplicationSettings appSettings, IDataEntryView view,
                                   IDialogService dialogService, ISoundService soundService,
                                   ISampleSelectorRepository sampleSelectorRepository)
        {
            TallyAction action  = null;
            SampleGroup sg      = count.SampleGroup;
            var         sampler = sampleSelectorRepository.GetSamplerBySampleGroupCode(sg.Stratum.Code, sg.Code);


            if (sampler == null)
            {
            }
            // if doing a manual tally create a tree and jump out
            else if (sampler is ExternalSampleSelectorPlaceholder)
            {
                try
                {
                    action = new TallyAction(count);
                    var newTree = dataService.CreateNewTreeEntry(count, true); //create measure tree
                    newTree.TreeCount = sg.SamplingFrequency;                  //increment tree count on tally
                    action.TreeRecord = newTree;
                }
                catch (FMSC.ORM.SQLException) //count save fail
                {
                    dialogService.ShowMessage("File error");
                }
            }
            else if (count.SampleGroup.Stratum.Is3P)//threeP sampling
            {
                action = TallyThreeP(count, sampler, sg, dataService, dialogService);
            }
            else//non 3P sampling (STR)
            {
                action = TallyStandard(count, sampler, dataService, dialogService);
            }

            //action may be null if cruising 3P and user doesn't enter a kpi
            if (action != null)
            {
                dataService.SaveTallyAction(action);
                soundService.SignalTally();

                var tree = action.TreeRecord;
                if (tree != null)
                {
                    if (tree.CountOrMeasure == "M")
                    {
                        soundService.SignalMeasureTree();
                    }
                    else if (tree.CountOrMeasure == "I")
                    {
                        soundService.SignalInsuranceTree();
                    }

                    if (appSettings.EnableCruiserPopup)
                    {
                        dialogService.AskCruiser(tree);
                        tree.TrySave();
                    }
                    else
                    {
                        var sampleType = (tree.CountOrMeasure == "M") ? "Measure Tree" :
                                         (tree.CountOrMeasure == "I") ? "Insurance Tree" : String.Empty;
                        dialogService.ShowMessage("Tree #" + tree.TreeNumber.ToString(), sampleType);
                    }

                    if (tree.CountOrMeasure == "M" && AskEnterMeasureTreeData(appSettings, dialogService))
                    {
                        view.GotoTreePage();
                        //this.View.TreeViewMoveLast();
                    }
                }
                tallyHistory.Add(action);
            }
        }