public AddSoilViewModel(INavigation navigation, string selectedID)
        {
            _navigation     = navigation;
            _soil           = new SOIL();
            _soil.SOILID    = selectedID;
            _soilRepository = new SoilRepository();
            _fk             = selectedID;
            _soil.DEPTHFROM = 0;
            _soil.DEPTHTO   = 0;

            AddCommand            = new Command(async() => await Update());
            DeleteCommand         = new Command(async() => await Delete());
            ListPorePattern       = PickerService.PorePatternItems().ToList();
            SoilHorizonCommand    = new Command(async() => await ShowSoilHorizon());
            SoilStructureCommand  = new Command(async() => await ShowSoilStructure());
            ColourCommand         = new Command(async() => await ShowColour());
            MottleColourCommand   = new Command(async() => await ShowMottleColour());
            GleyColourCommand     = new Command(async() => await ShowGleyColour());
            TextureCommand        = new Command(async() => await ShowTexture());
            IsChanged             = false;
            OnAppearingCommand    = new Command(() => OnAppearing());
            OnDisappearingCommand = new Command(() => OnDisappearing());
            if (util.AllowAutoNumber)
            {
                _soil.HORIZONNUMBER = _soilRepository.GetNextNumber(_fk);
            }
        }
        public bool IsSoilNumUnique(SOIL _soil)
        {
            // for examinginif a unique tree number is being saved
            string qry;

            if (_soil.SOILID != null)
            {
                qry = "select count(SOILID) from SOIL where PLOTID = '" + _soil.PLOTID + "' and LAYER = " + _soil.LAYER + " and PLOTID <> '" + _soil.PLOTID + "'";
            }
            else
            {
                qry = "select count(SOILID) from SOIL where PLOTID = '" + _soil.PLOTID + "' and LAYER = " + _soil.LAYER;
            }

            try
            {
                var num = sqliteconnection.ExecuteScalar <int>(qry);
                if (num > 0)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            catch (Exception e)
            {
                var myerror = e.Message; // erro
                return(false);
            }
        }
示例#3
0
 public void DeleteSoil(SOIL _table)
 {
     _table.IsDeleted    = "Y";
     _table.LastModified = System.DateTime.UtcNow;
     _databaseHelper.UpdateSoil(_table);
     _databaseHelper.SetPlotSynch(_table.PLOTID);
 }
示例#4
0
 public void InsertSoil(SOIL soil, string fk)
 {
     soil.SOILID = Guid.NewGuid().ToString();
     soil.PLOTID = fk;
     _databaseHelper.InsertSoil(soil);
     _databaseHelper.SetPlotSynch(soil.PLOTID);
 }
 public SoilHorizonViewModel(INavigation navigation, SOIL _soil)
 {
     _navigation       = navigation;
     _thissoil         = _soil;
     ListHorizon       = PickerService.HorizonItems().ToList();
     ListHorizonSuffix = PickerService.HorizonSuffixItems().ToList();
     ClearCommand      = new Command(() => ClearItems());
     SetCalc();
 }
        public MottleColourViewModel(INavigation navigation, SOIL _soil)
        {
            _navigation = navigation;
            _thissoil   = _soil;

            ClearCommand = new Command(() => ClearItems());
            _tempcolour  = _thissoil.MOTTLE_COLOUR;
            SetCalc();
        }
 // Insert new to DB
 public void  InsertSoil(SOIL soil)
 {
     try
     {
         sqliteconnection.Insert(soil);
     }
     catch (Exception ex)
     { logger.LogWrite(ex.Message); }
 }
        public SoilColourViewModel(INavigation navigation, SOIL _soil, bool ischanged)
        {
            _navigation = navigation;
            _thissoil   = _soil;
            _ischanged  = ischanged;

            ClearCommand = new Command(() => ClearItems());
            _tempcolour  = _thissoil.MATRIXCOLOUR;
            SetCalc();
        }
示例#9
0
 public TextureViewModel(INavigation navigation, SOIL soil)
 {
     _navigation  = navigation;
     _issoil      = true;
     _soil        = new SOIL();
     _soil        = soil;
     TEXTURE      = _soil.MINERALTEXTURECODE;
     ClearCommand = new Command(() => ClearItems());
     _temp        = _thistexture;
     //       SetCalc();
 }
示例#10
0
 public SoilListViewModel(INavigation navigation, string fk)
 {
     _navigation         = navigation;
     _soilRepository     = new SoilRepository();
     _fk                 = fk;
     _soil               = new SOIL();
     AddCommand          = new Command(async() => await ShowAdd(_fk));
     DeleteAllCommand    = new Command(async() => await DeleteAll());
     ShowFilteredCommand = new Command <SOIL>(async(x) => await ShowSoil(x));
     FetchSoil();
 }
示例#11
0
        public SoilStructureViewModel(INavigation navigation, SOIL _soil)
        {
            _navigation = navigation;
            _thissoil   = _soil;
            ListGrade   = PickerService.GradeItems().ToList();
            ListKind    = PickerService.KindItems().ToList();
            ListClass   = PickerService.ClassItems().ToList();

            ClearCommand = new Command(() => ClearItems());
            SetCalc();
        }
 public AddSoilViewModel(INavigation navigation, string selectedID)
 {
     _navigation          = navigation;
     _soil                = new SOIL();
     _soil.SOILID         = selectedID;
     _soilRepository      = new SoilRepository();
     _fk                  = selectedID;
     AddCommand           = new Command(async() => await Update());
     DeleteCommand        = new Command(async() => await Delete());
     ListPorePattern      = PickerService.PorePatternItems().ToList();
     SoilHorizonCommand   = new Command(async() => await ShowSoilHorizon());
     SoilStructureCommand = new Command(async() => await ShowSoilStructure());
     ColourCommand        = new Command(async() => await ShowColour());
     MottleColourCommand  = new Command(async() => await ShowMottleColour());
 }
 public SoilDetailsViewModel(INavigation navigation, string selectedID)
 {
     _navigation     = navigation;
     _soil           = new SOIL();
     _soil.SOILID    = selectedID;
     _soilRepository = new SoilRepository();
     //_fk = selectedID;
     _selectedid          = selectedID;
     UpdateCommand        = new Command(async() => await Update());
     DeleteCommand        = new Command(async() => await Delete());
     ListPorePattern      = PickerService.PorePatternItems().ToList();
     SoilHorizonCommand   = new Command(async() => await ShowSoilHorizon());
     SoilStructureCommand = new Command(async() => await ShowSoilStructure());
     ColourCommand        = new Command(async() => await ShowColour());
     MottleColourCommand  = new Command(async() => await ShowMottleColour());
     GleyColourCommand    = new Command(async() => await ShowGleyColour());
     TextureCommand       = new Command(async() => await ShowTexture());
     ImageCommand         = new Command(async() => await ShowImage());
     // Get the soil
     FetchDetails(_selectedid);
     IsChanged             = false;
     OnAppearingCommand    = new Command(() => OnAppearing());
     OnDisappearingCommand = new Command(() => OnDisappearing());
 }
示例#14
0
        public string getPorePattern(SOIL _soil)
        {
            // return a pore pattern based on the mineral texture code
            List <string> porecode0 = new List <string> {
                "vcS", "cS", "LvcS", "LcS", "SivcS", "SicS"
            };
            List <string> porecode1 = new List <string> {
                "SimS", "vcSL", "cSL", "LmS", "mS"
            };
            List <string> porecode2 = new List <string> {
                "fS", "LfS", "SifS", "mSL"
            };
            List <string> porecode3 = new List <string> {
                "vfS", "LvfS", "SivfS", "fSL"
            };
            List <string> porecode4 = new List <string> {
                "L", "SiL", "SCL", "vfSL"
            };
            List <string> porecode5 = new List <string> {
                "Si", "CL", "SiCL", "SC"
            };
            List <string> porecode6 = new List <string> {
                "SiC", "C"
            };
            string porepattern = _soil.POREPATTERNCODE;

            string soil = _soil.MINERALTEXTURECODE;

            if (soil == null || soil == "")
            {
                return(null);
            }
            soil = _soil.MINERALTEXTURECODE.Replace("vgr", "");

            soil = soil.Replace("gr", "");
            soil = soil.Replace("vco", "");
            soil = soil.Replace("vst", "");
            soil = soil.Replace("vbo", "");
            soil = soil.Replace("co", "");
            soil = soil.Replace("st", "");
            soil = soil.Replace("bo", "");

            if (porecode0.Contains(soil))
            {
                porepattern = "0";
            }
            else if (porecode1.Contains(soil))
            {
                porepattern = "1";
            }
            else if (porecode2.Contains(soil))
            {
                porepattern = "2";
            }
            else if (porecode3.Contains(soil))
            {
                porepattern = "3";
            }
            else if (porecode4.Contains(soil))
            {
                porepattern = "4";
            }
            else if (porecode5.Contains(soil))
            {
                porepattern = "5";
            }
            else if (porecode6.Contains(soil))
            {
                porepattern = "6";
            }
            return(porepattern);
        }
示例#15
0
 async Task ShowSoil(SOIL _soil)
 {
     // launch the form - filtered to a specific projectid
     await _navigation.PushAsync(new SoilDetailsPage(_soil.SOILID));
 }
示例#16
0
 public SoilHorizon(SOIL _soil)
 {
     InitializeComponent();
     _viewmodel          = new SoilHorizonViewModel(Navigation, _soil);
     this.BindingContext = _viewmodel;
 }
 // Update Tree Data
 public void UpdateSoil(SOIL soil)
 {
     sqliteconnection.Update(soil);
 }
 public Task DeleteTaskAsync(SOIL item)
 {
     return(restService.DeleteAsync(tablename, item.SOILID));
 }
示例#19
0
 public SoilColour(SOIL _soil, bool ischanged)
 {
     InitializeComponent();
     _viewmodel          = new SoilColourViewModel(Navigation, _soil, ischanged);
     this.BindingContext = _viewmodel;
 }
 public Texture(SOIL soil)
 {
     InitializeComponent();
     _viewmodel          = new TextureViewModel(Navigation, soil);
     this.BindingContext = _viewmodel;
 }
 public void UpdateSoil(SOIL soil)
 {
     _databaseHelper.UpdateSoil(soil);
 }
示例#22
0
 public void UpdateSoil(SOIL soil)
 {
     _databaseHelper.UpdateSoil(soil);
     _databaseHelper.SetPlotSynch(soil.PLOTID);
 }
 public GleyColour(SOIL _soil)
 {
     InitializeComponent();
     _viewmodel          = new GleyColourViewModel(Navigation, _soil);
     this.BindingContext = _viewmodel;
 }