Exemplo n.º 1
0
 bool LoadFromWeb(List <TableInfo> tables)
 {
     bool[] needload = new bool[3];
     for (int i = 0; i < needload.Length; i++)
     {
         needload[i] = false;
     }
     foreach (TableInfo t in tables)
     {
         if (t.index > 0 && t.index < needload.Length)
         {
             needload[t.index] = true;
         }
     }
     ClTable[] cts = new ClTable[needload.Length];
     CIPS.Dictionary.WebDict.Service web;
     web = new CIPS.Dictionary.WebDict.Service(weburl);
     for (int i = 0; i < cts.Length; i++)
     {
         if (!needload[i])
         {
             continue;
         }
         try
         {
             byte[] buf = web.GetClTable("DM_SA_DC_MODIFY", "", i);
             if (buf != null)
             {
                 cts[i] = new ClTable(buf);
             }
         }
         catch { }
     }
     foreach (TableInfo t in tables)
     {
         t.modified = false;
         //DateTime time = GetLastModifyTime(web, t.tablename, t.index);
         if (t.index == 0)
         {
             continue;
         }
         DateTime time = GetLastModifyTime(cts, t.tablename, t.index);
         if (time > t.lastModifyTime)
         {
             LoadTableFromWeb(web, t);
             if (t.tablename == "DC_NC_TERM")
             {
                 ClTable   ct_test = new ClTable(t.buf);
                 DataTable dt_test = ct_test.GetDataTable();
             }
             if (t.key && t.buf == null)
             {
                 return(false);
             }
         }
     }
     return(true);
     //return Tables2DataSet(tables);
 }
Exemplo n.º 2
0
 /// <summary>
 /// 以CLTABLE格式读表
 /// </summary>
 /// <param name="web">WEB地址</param>
 /// <param name="tablename">表名</param>
 /// <param name="param">参数</param>
 /// <param name="index">数据库索引</param>
 /// <returns>成功返回CLTABLE格式的表</returns>
 public static CIPS.ClTable LoadClTable(CIPS.Dictionary.WebDict.Service web, string tablename, string param, int index)
 {
     CIPS.ClTable dt = null;
     try
     {
         web.Timeout = 300000;
         byte[] b = web.GetClTable(tablename, param, index);
         dt = new ClTable(b);
         System.Console.WriteLine(tablename + "读WEB:成功(CL)");
     }
     catch (Exception ex)
     {
         System.Console.WriteLine(tablename + "读WEB失败(CL):" + ex.ToString());
     }
     return(dt);
 }
Exemplo n.º 3
0
 void LoadTableFromWeb(CIPS.Dictionary.WebDict.Service web, TableInfo table)
 {
     try
     {
         table.modified = false;
         byte[] buf = web.GetClTable(table.tablename, table.param, table.index);
         if (buf != null)
         {
             table.lastModifyTime = DateTime.Now;
             if (!MemCmp(buf, table.buf))
             {
                 table.buf      = buf;
                 table.modified = true;
             }
         }
     }
     catch (Exception ex)
     {
         System.Console.WriteLine(table.tablename + "读WEB失败" + ex.ToString());
     }
 }