Ejemplo n.º 1
0
 public static string getQueryUpdateWeather(Weather weather)
 {
     return string.Format("UPDATE {0} SET {1}='{2}', {3}='{4}',{5}='{6}'::timestamp without time zone WHERE {7}='{8}' AND {9}='{10}' AND {11}='{12}' AND {13}='{14}'::timestamp without time zone AND {15}={16}",
         ID_TABLE_WEATHER,
         ID_VALUE_WEATHER, weather.Value, ID_UPDATEUSER_WEATHER, weather.UpdateUser, ID_UPDATETIME_WEATHER, weather.UpdateLocalDateTime,
         ID_MACROCELL_WEATHER, weather.MacrocellId,
         ID_UNITTYPE_WEATHER, weather.UnitTypeId,
         ID_LOCALDATETIME_WEATHER, weather.LocalDateTime.ToString(DATETIMEFORMAT_WEATHER),
         ID_INSERTTIME_WEATHER, weather.LocalInsertTime,
         ID_INSERTUSER_WEATHER, weather.InsertUser);
 }
Ejemplo n.º 2
0
 public void Update(Weather weather)
 {
     _repositoryHelper.UpdateWeather(weather);
 }
Ejemplo n.º 3
0
 public void Save(Weather weather)
 {
     _weatherValidator.Validate(weather);
      _repositoryHelper.SaveWeather(weather);
 }
Ejemplo n.º 4
0
 public bool Exists(Weather weather)
 {
     return Get(weather.MacrocellId,weather.MeasureTypeId,weather.LocalDateTime) != null;
 }
Ejemplo n.º 5
0
 public void UpdateWeather(Weather weather)
 {
     string query = WeatherQuery.getQueryUpdateWeather(weather);
     WeatherQuery.ParseDataSetToWeather(_provider.queryExecute(query,UPDATE_TYPE));
 }
Ejemplo n.º 6
0
 public void SaveWeather(Weather weather)
 {
     string query = WeatherQuery.getQuerySaveWeather(weather);
     WeatherQuery.ParseDataSetToWeather(_provider.queryExecute(query,INSERT_TYPE));
 }
Ejemplo n.º 7
0
        public static IList<Weather> ParseDataSetToWeather(DataTable dataTable)
        {
            IList<Weather> weatherList = new List<Weather>();
            foreach (DataRow row in dataTable.Rows)
            {
                Weather weather = new Weather()
                {
                    LocalDateTime = getDateTime(row[POSITION_LOCALDATETIME_WEATHER].ToString(), DATETIMEFORMAT_WEATHER),
                    MacrocellId = row[POSITION_MACROCELL_WEATHER].ToString(),
                    UnitTypeId = row[POSITION_UNITTYPE_WEATHER].ToString(),
                    MeasureTypeId = row[POSITION_MEASURETYPE_WEATHER].ToString(),
                    Value = Double.Parse(row[POSITION_VALUE_WEATHER].ToString()),
                    LocalInsertTime = getDateTime(row[POSITION_INSERTTIME_WEATHER].ToString(), DATETIMEFORMATINSERT_WEATHER),
                    InsertUser = row[POSITION_INSERTUSER_WEATHER].ToString(),
                    UpdateLocalDateTime = getDateTime(row[POSITION_UPDATETIME_WEATHER].ToString(), DATETIMEFORMATINSERT_WEATHER),
                    UpdateUser = row[POSITION_UPDATEUSER_WEATHER].ToString()
                };
                weatherList.Add(weather);
            }

            return weatherList;
        }
Ejemplo n.º 8
0
 public static string getQuerySaveWeather(Weather weather)
 {
     return string.Format("INSERT INTO {0} VALUES('{1}','{2}','{3}','{4}','{5}','{6}'::timestamp without time zone,'{7}','{8}'::timestamp without time zone,'{9}')", ID_TABLE_WEATHER, weather.LocalDateTime.ToString(DATETIMEFORMAT_WEATHER),
         weather.Value,weather.UnitTypeId, weather.MeasureTypeId, weather.MacrocellId, weather.LocalInsertTime,
         weather.InsertUser, weather.UpdateLocalDateTime, weather.UpdateUser);
 }
Ejemplo n.º 9
0
 public void Validate(Weather weather)
 {
     validateUtcHour(weather.LocalDateTime.Hour);
     validateUtcMinute((weather.LocalDateTime.Minute));
     validateUtcSecond((weather.LocalDateTime.Second));
 }