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();
        }
Exemple #2
0
        public DefaultViewModel(INavigation navigation)
        {
            _navigation = navigation;
            util        = new Utils();
            ListSpecies = PickerService.SpeciesItems().OrderBy(c => c.ID).ToList();
            ListPerson  = PickerService.FillPersonPicker(_plotRepository.GetPersonList()).OrderBy(c => c.NAME).ToList();
            //     databasehelper = new DatabaseHelper();

            //   FetchSettings();
        }
        public ForestHealthViewModel(INavigation navigation, PLOT _thisplot)
        {
            _navigation     = navigation;
            _plot           = new PLOT();
            _plot           = _thisplot;
            _plotRepository = new PlotRepository();
            if (_plot.FORESTHEALTHDATE == System.DateTime.MinValue)
            {
                _plot.FORESTHEALTHDATE = System.DateTime.Now;
            }

//            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());
        }
        public StandInfoViewModel(INavigation navigation, PLOT _thisplot)
        {
            _navigation     = navigation;
            _plot           = new PLOT();
            _plot           = _thisplot;
            _plotRepository = new PlotRepository();
            if (_plot.STANDINFODATE == System.DateTime.MinValue)
            {
                _plot.STANDINFODATE = System.DateTime.Now;
            }

//            ListPerson = FillPersonPicker().OrderBy(c => c.NAME).ToList();
            ListPerson                 = PickerService.FillPersonPicker(_plotRepository.GetPersonList(_plot.PROJECTID)).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();
            ListDisturbanceCode        = PickerService.DisturbanceItems().OrderBy(c => c.NAME).ToList();
            ListMaturityClassRationale = PickerService.MaturityClassRationaleItems().ToList();
            OnAppearingCommand         = new Command(() => OnAppearing());
            OnDisappearingCommand      = new Command(() => OnDisappearing());
        }
 public PlotCrewViewModel(INavigation navigation, PLOT _thisplot)
 {
     try
     {
         _navigation     = navigation;
         _plot           = new PLOT();
         _plot           = _thisplot;
         _plotRepository = new PlotRepository();
         Utils util = new Utils();
         // DO DEFAULTS
         if (_plot.SMALLTREESHRUBDATE == System.DateTime.MinValue)
         {
             _plot.SMALLTREESHRUBDATE = System.DateTime.Now;
         }
         if (_plot.DEFORMITYDATE == System.DateTime.MinValue)
         {
             _plot.DEFORMITYDATE = System.DateTime.Now;
         }
         if (_plot.DOWNWOODYDEBRISDATE == System.DateTime.MinValue)
         {
             _plot.DOWNWOODYDEBRISDATE = System.DateTime.Now;
         }
         if (_plot.UNDERSTORYVEGETATIONDATE == System.DateTime.MinValue)
         {
             _plot.UNDERSTORYVEGETATIONDATE = System.DateTime.Now;
         }
         if (_plot.UNDERSTORYCENSUSDATE == System.DateTime.MinValue)
         {
             _plot.UNDERSTORYCENSUSDATE = System.DateTime.Now;
         }
         if (_plot.AGEDATE == System.DateTime.MinValue)
         {
             _plot.AGEDATE = System.DateTime.Now;
         }
         if (_plot.UNDERSTORYVEGETATIONAREA == 0)
         {
             _plot.UNDERSTORYVEGETATIONAREA = Constants.DefaultUnderstoryVegArea;
         }
         if (_plot.SMALLTREESHRUBAREA == 0)
         {
             _plot.SMALLTREESHRUBAREA = Constants.DefaultSmallTreeArea;
         }
         if (_plot.LINELENGTH1 == 0 && _plot.VSNPLOTTYPECODE.Contains("C"))
         {
             _plot.LINELENGTH1 = Constants.DefaultDWDLineLength;
         }
         if (_plot.LINELENGTH2 == 0 && _plot.VSNPLOTTYPECODE.Contains("C"))
         {
             _plot.LINELENGTH2 = Constants.DefaultDWDLineLength;
         }
         if (util.UseDefaultPerson)
         {
             if (_plot.STANDINFOPERSON == null)
             {
                 _plot.STANDINFOPERSON = util.DefaultPerson;
             }
             if (_plot.SMALLTREEPERSON == null)
             {
                 _plot.SMALLTREEPERSON = util.DefaultPerson;
             }
             if (_plot.AGEPERSON == null)
             {
                 _plot.AGEPERSON = util.DefaultPerson;
             }
             if (_plot.FIELD_CREW1 == null)
             {
                 _plot.FIELD_CREW1 = util.DefaultPerson;
             }
             if (_plot.FORESTHEALTHPERSON == null)
             {
                 _plot.FORESTHEALTHPERSON = util.DefaultPerson;
             }
         }
         //   ListPerson = FillPersonPicker().OrderBy(c => c.NAME).ToList();
         ListPerson = PickerService.FillPersonPicker(_plotRepository.GetPersonList(_plot.PROJECTID)).OrderBy(c => c.NAME).ToList();
     }
     catch (System.Exception ex)
     {
         var msg = ex.Message;
     }
 }