Ejemplo n.º 1
0
        public static Dictionary <string, DB.TableInfo> GetTableID(SqlConnection conn)
        {
            var adapter = new SyncCloud.DamaiDataSetTableAdapters.SyncTableTableAdapter();

            adapter.Connection = conn;
            var table = new SyncCloud.DamaiDataSet.SyncTableDataTable();
            var dic   = new Dictionary <string, DB.TableInfo>();

            try
            {
                adapter.Fill(table);
                foreach (var row in table)
                {
                    var tableInfo = new TableInfo();
                    tableInfo.Name   = row.Name;
                    tableInfo.Childs = null;

                    if (!row.IsMD5Null())
                    {
                        tableInfo.MD5 = row.MD5;
                    }
                    if (!row.IsRecordCountNull())
                    {
                        tableInfo.RecordCount = row.RecordCount;
                    }
                    tableInfo.TableID = row.TableID;
                    dic.Add(row.Name, tableInfo);
                }
                return(dic);
            }
            catch {  }
            return(null);
        }
Ejemplo n.º 2
0
        public static void UpdateSyncTable(Dictionary <string, DB.TableInfo> dic, SqlConnection conn)
        {
            var adapter = new SyncCloud.DamaiDataSetTableAdapters.SyncTableTableAdapter();

            adapter.Connection = conn;
            var table = new SyncCloud.DamaiDataSet.SyncTableDataTable();

            try
            {
                adapter.Fill(table);
                foreach (var row in table)
                {
                    DB.TableInfo ti = null;
                    if (dic.TryGetValue(row.Name, out ti))
                    {
                        row.RecordCount = ti.RecordCount;
                        row.MD5         = ti.MD5;
                    }
                }
                adapter.Update(table);
            }
            catch { }
        }