Beispiel #1
0
        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);
            }
        }
Beispiel #2
0
 get => getHarvestDate(DatePlanted, DaysToHarvest);