Exemple #1
0
        public PlotDetailsViewModel(INavigation navigation, string selectedPlotID)
        {
            _navigation     = navigation;
            _plot           = new PLOT();
            _plot.PLOTID    = selectedPlotID;
            _plotRepository = new PlotRepository();

            UpdatePlotCommand   = new Command(async() => await UpdatePlot());
            DeletePlotCommand   = new Command(async() => await DeletePlot());
            ListFMU             = PickerService.ForestItems().OrderBy(c => c.NAME).ToList();
            CommentsCommand     = new Command(async() => await ShowComments());
            ListSpecies         = PickerService.SpeciesItems().OrderBy(c => c.NAME).ToList();
            ListCanopyOrigin    = PickerService.CanopyOriginItems().OrderBy(c => c.NAME).ToList();
            ListCanopyStructure = PickerService.CanopyStructureItems().OrderBy(c => c.NAME).ToList();
            ListMaturityClass   = PickerService.MaturityClassItems().OrderBy(c => c.NAME).ToList();
            ListMeasurementType = PickerService.MeasurementTypeItems().OrderBy(c => c.NAME).ToList();
            ListNonStandardType = PickerService.NonStandardTypeItems().OrderBy(c => c.NAME).ToList();
            ListAccessCondition = PickerService.AccessConditionItems().OrderBy(c => c.NAME).ToList();
            StandInfoCommand    = new Command(async() => await ShowStandInfo());
            ForestHealthCommand = new Command(async() => await ShowForestHealth());
            PlotCrewCommand     = new Command(async() => await ShowPlotCrew());
            PhotoCommand        = new Command(async() => await ShowPhoto());
            LocationCommand     = new Command(async() => await DoLocation());
            ValidateCommand     = new Command(async() => await DoValidate());

            ListGrowthPlot     = PickerService.GrowthPlotItems().OrderBy(c => c.NAME).ToList();
            ListGrowthPlotType = PickerService.GrowthPlotTypeItems().OrderBy(c => c.NAME).ToList();
            FetchPlotDetails();
            IsChanged             = false;
            OnAppearingCommand    = new Command(() => OnAppearing());
            OnDisappearingCommand = new Command(() => OnDisappearing());
//            ListPerson = FillPersonPicker().OrderBy(c => c.NAME).ToList();
            ListPerson = PickerService.FillPersonPicker(_plotRepository.GetPersonList(_plot.PROJECTID)).OrderBy(c => c.NAME).ToList();
        }
        public AddPlotViewModel(INavigation navigation, string fk)
        {
            _navigation        = navigation;
            _plotValidator     = new PlotValidator();
            _plot              = new PLOT();
            _plotRepository    = new PlotRepository();
            _selectedprojectid = fk;
            Utils util = new Utils();

            //Do defaults
            _plot.VSNPLOTNAME             = "VSN";
            _plot.IsDeleted               = "N";
            _plot.DATUM                   = "NAD83";
            _plot.PROJECTID               = fk;
            _plot.ACCESSCONDITIONCODE     = 1;
            _plot.PLOTOVERVIEWDATE        = System.DateTime.Now;
            _plot.MEASUREYEAR             = _plot.PLOTOVERVIEWDATE.Year;
            _plot.CANOPYSTRUCTURECODE1    = "S";
            _plot.MATURITYCLASSCODE1      = "S";
            _plot.MATURITYCLASSRATIONALE1 = "Dominant cohort has achieved crown closure";
            _plot.FOLLOWUPREQUIRED        = "N";



            if (util.UseDefaultDeclination)
            {
                _plot.DECLINATION = util.DefaultDeclination;
            }

            AddCommand          = new Command(async() => await AddPlot(_selectedprojectid));
            ViewAllCommand      = new Command(async() => await ShowList());
            ListFMU             = PickerService.ForestItems().OrderBy(c => c.NAME).ToList();
            ListSpecies         = PickerService.SpeciesItems().OrderBy(c => c.NAME).ToList();
            ListMeasurementType = PickerService.MeasurementTypeItems().OrderBy(c => c.NAME).ToList();
            ListNonStandardType = PickerService.NonStandardTypeItems().OrderBy(c => c.NAME).ToList();
            //   ListPerson = FillPersonPicker().OrderBy(c => c.NAME).ToList();
            ListPerson            = PickerService.FillPersonPicker(_plotRepository.GetPersonList(_selectedprojectid)).OrderBy(c => c.NAME).ToList();
            ListGrowthPlot        = PickerService.GrowthPlotItems().OrderBy(c => c.NAME).ToList();
            ListGrowthPlotType    = PickerService.GrowthPlotTypeItems().OrderBy(c => c.NAME).ToList();
            ListAccessCondition   = PickerService.AccessConditionItems().OrderBy(c => c.NAME).ToList();
            CommentsCommand       = new Command(async() => await ShowComments());
            StandInfoCommand      = new Command(async() => await ShowStandInfo());
            ForestHealthCommand   = new Command(async() => await ShowForestHealth());
            PlotCrewCommand       = new Command(async() => await ShowPlotCrew());
            PhotoCommand          = new Command(async() => await ShowPhoto());
            OnAppearingCommand    = new Command(() => OnAppearing());
            OnDisappearingCommand = new Command(() => OnDisappearing());
            LocationCommand       = new Command(async() => await DoLocation());
        }