Exemplo n.º 1
0
        public void Update(FormatObject formatObject)
        {
            if (LocalStore.Exists(_tableName))
            {
                var dt  = LocalStore.Read(_tableName);
                var row = dt.AsEnumerable().Single(x =>
                {
                    return((x.Field <string>("SourceName") == formatObject.SourceName));
                });

                UpdateRow(row, formatObject);

                LocalStore.Write(dt, true);
            }
            else
            {
                var dt = CreateDataTable();

                DataRow dr = dt.NewRow();
                UpdateRow(dr, formatObject);
                dt.Rows.Add(dr);

                LocalStore.Write(dt, false);
            }
        }
Exemplo n.º 2
0
 private void UpdateRow(DataRow row, FormatObject formatObject)
 {
     row.SetField <string>("SourceName", formatObject.SourceName);
     row.SetField <DateTime>("LocalDateTime", TimeZoneInfo.ConvertTime(formatObject.DateTime, Source.TimeZoneInfo).DateTime);
 }