Exemplo n.º 1
0
 private static void SaveColumns(string key, IEnumerable <ColumnInfo> infos)
 {
     try
     {
         var array = infos.ToArray();
         var store = new SettingsStoreSource().GetCustomSettingsStore();
         store.Save(key, array);
     }
     catch (Exception e)
     {
         var log = LogFactory.Create(typeof(GridHelper));
         log.Error(e);
     }
 }
Exemplo n.º 2
0
 private static IEnumerable <ColumnInfo> GetColumns(string key)
 {
     try
     {
         var store = new SettingsStoreSource().GetCustomSettingsStore();
         var data  = store.Load <ColumnInfo[]>(key);
         return(data);
     }
     catch (Exception e)
     {
         var log = LogFactory.Create(typeof(GridHelper));
         log.Error(e);
         return(null);
     }
 }
Exemplo n.º 3
0
        private static void SaveColumns(string key, IEnumerable <ColumnInfo> infos)
        {
            try
            {
                var array = infos.ToArray();
                var store = new SettingsStoreSource().GetCustomSettingsStore();
                var ser   = new XmlSerializer(typeof(ColumnInfo[]));

                var sb = new StringBuilder();

                using (var sw = new StringWriter(sb))
                {
                    ser.Serialize(sw, array);
                }

                store.Save(key, sb.ToString());
            }
            catch (Exception e)
            {
                var log = LogFactory.Create(typeof(GridHelper));
                log.Error(e);
            }
        }
Exemplo n.º 4
0
 private static IEnumerable <ColumnInfo> GetColumns(string key)
 {
     try
     {
         var store = new SettingsStoreSource().GetCustomSettingsStore();
         var data  = store.Load(key);
         if (string.IsNullOrEmpty(data))
         {
             return(null);
         }
         var ser = new XmlSerializer(typeof(ColumnInfo[]));
         using (var sr = new StringReader(data))
         {
             return(ser.Deserialize(sr) as ColumnInfo[]);
         }
     }
     catch (Exception e)
     {
         var log = LogFactory.Create(typeof(GridHelper));
         log.Error(e);
         return(null);
     }
 }