public static void Update(Position pos) { using (DAC dac = new DAC()) { string statement = string.Format("UPDATE Location SET Latitude = {0}, Longitude = {1}, FetchedOn = '{2}' WHERE Key = '{3}';", pos.Latitude, pos.Longitude, pos.FetchedOn, pos.Key); dac.ExecuteCommand(statement); } }
public static void SetEnabled(Recipe recipe) { using (DAC dac = new DAC()) { string statement = string.Format("UPDATE Recipe SET IsEnabled = {0} WHERE Name = '{1}';", recipe.IsEnabled ? 1 : 0, recipe.Name); dac.ExecuteCommand(statement); } }
public static void Clear() { using (DAC dac = new DAC()) { string statement = string.Format("DELETE FROM News;"); dac.ExecuteCommand(statement); } }
public static void Insert(LocationEntry entry) { using (DAC dac = new DAC()) { string statement = string.Format("INSERT INTO LocationHistory (Latitude, Longitude, VisitedOn, IsKnown, KnownKey) VALUES ({0}, {1}, '{2}', {3}, '{4}');", entry.Latitude, entry.Longitude, entry.VisitedOn, entry.IsKnown ? 1 : 0, entry.KnownKey); dac.ExecuteCommand(statement); } }
public static void Insert(WeatherEntry entry) { using (DAC dac = new DAC()) { string statement = string.Format("INSERT INTO WeatherHistory (Latitude, Longitude, Temperature, Forecast, FetchedOn) VALUES ({0}, {1}, {2}, '{3}', '{4}');", entry.Latitude, entry.Longitude, entry.Temperature, entry.Forecast, entry.FetchedOn); dac.ExecuteCommand(statement); } }
public static int Set(string key, string value) { value = value.Replace("'", "''"); string statement = string.Format("UPDATE Settings SET SettingValue = '{0}', UpdatedOn = '{1}' WHERE [SettingKey] = '{2}';", value, DateTime.Now.ToString(), key); using (DAC dac = new DAC()) { return(dac.ExecuteCommand(statement)); } }
public static void Insert(NewsEntry entry) { entry.Title = entry.Title.Replace("'", "''"); entry.Summary = entry.Summary.Replace("'", "''"); using (DAC dac = new DAC()) { string statement = string.Format("INSERT INTO News (Provider, Title, Url, EmailId, EmailSent) VALUES ('{0}', '{1}', '{2}', '{3}', {4});", entry.Provider, entry.Title, entry.Url, entry.EmailId, entry.EmailSent ? 1 : 0); dac.ExecuteCommand(statement); } }