public bool Update() { const string UpdatePlantSql = "Update Plant set Name =?, DatePlanted=?, ProjectedVegCycle=?, VegCycleStarted=?, ProjectedFlowerCycle=?, FlowerCycleStarted=?, ProjectedHarvest=?, HarvestDate=?, StrainId=?, ScheduleId=?, GardenId=?" + "WHERE Id =?"; try { ProjectedVegCycle = DatePlanted.AddDays(7); using (SQLiteConnection connection = Data.DataBaseAccess.DbConnection) { SQLiteCommand command = connection.CreateCommand(UpdatePlantSql, new object[] { Name, DatePlanted, ProjectedVegCycle, VegCycleStarted, ProjectedFlowerCycle, FlowerCycleStarted, ProjectedHarvest, HarvestDate, StrainId, ScheduleId, GardenId, Id }); int result = command.ExecuteNonQuery(); return(result > 0); } } catch (SQLiteException) { return(false); } }
get => getHarvestDate(DatePlanted, DaysToHarvest);