コード例 #1
0
ファイル: AppTableUnite.cs プロジェクト: weimingtom/pap2
        private static object[] GetTableIDs(string tblname, object[] ids, string[] dbnames)
        {
            DataTable[] tables = new DataTable[dbnames.Length];
            int         index  = 0;

            foreach (string db in dbnames)
            {
                TableUnitManager tm   = TableHelper.GetTableUnitManangerByDbname(db);
                TableUnit        unit = tm.GetTableUnit(tblname);
                tables[index] = unit.GetTable();
                index++;
            }

            bool bRet = false;

            while (!bRet)
            {
                bRet = true;
                foreach (DataTable table in tables)
                {
                    if (ExistID(table, ids))
                    {
                        bRet = false;
                        break;
                    }
                }
                if (!bRet)
                {
                    ids[0] = (int)(ids[0]) + 1;
                }
            }

            return(ids);
        }
コード例 #2
0
ファイル: AppTableUnite.cs プロジェクト: weimingtom/pap2
 public static void ReloadRemoteTable()
 {
     string[] dbnames = TableHelper.GetAllDBNames();
     foreach (string dbname in dbnames)
     {
         TableUnitManager mgr = TableHelper.GetTableUnitManangerByDbname(dbname);
         mgr.ReleaseTable("sys_TableRemoting");
         mRemoteTables[dbname] = mgr.GetTableUnit("sys_TableRemoting").GetTable();
     }
 }
コード例 #3
0
ファイル: AppTableUnite.cs プロジェクト: weimingtom/pap2
        public static int[] UniteTables(string tblname, string todbname, string[] dblist)
        {
            DataTable[] tables   = new DataTable[dblist.Length - 1];
            DataTable   totable  = null;
            DataTable   untable  = null;
            int         nInsert  = 0;
            int         nModify  = 0;
            int         index    = 0;
            bool        priority = true;

            foreach (string db in dblist)
            {
                TableUnitManager tm   = TableHelper.GetTableUnitManangerByDbname(db);
                TableUnit        unit = tm.GetTableUnit(tblname);
                if (db != todbname)
                {
                    tables[index] = unit.GetTable();
                    index++;
                }
                else
                {
                    priority = false;
                    totable  = unit.GetTable();
                }

                DataTable tbl = unit.GetTable();
                tbl.ExtendedProperties["dbname"] = priority;
            }

            int count = 0;

            foreach (DataTable table in tables)
            {
                if (table != null)
                {
                    bool  cover  = Convert.ToBoolean(table.ExtendedProperties["dbname"]);
                    int[] result = UniteTables(totable, table, cover);
                    nInsert += result[0];
                    nModify += result[1];
                }
            }

            TableUnitManager totm = TableHelper.GetTableUnitManangerByDbname(todbname);

            totm.SaveTable(tblname);

            return(new int[] { nInsert, nModify });
        }