Beispiel #1
0
        public int Import(string _TableName, string _key_table, string strXMLFile, string strXSDFile)
        {
            ExportData   objExport   = new ExportData();
            CompressData objCompress = new CompressData();

            FileInfo fileInfoXMLFile = new FileInfo(strXMLFile);
            FileInfo fileInfoXSDFile = new FileInfo(strXSDFile);

            if ((!fileInfoXMLFile.Exists) || (!fileInfoXSDFile.Exists))
            {
                return(-1);
            }
            Common.Database.DBManager dbmanager = new Common.Database.DBManager();
            try
            {
                if (ImportFromXML(_TableName, _key_table, strXMLFile, strXSDFile, dbmanager.Sqlconnection) < 0)
                {
                    dbmanager.Close();
                    return(-2);
                }
                SqlCommand cmd = new SqlCommand(_TableName + "_Convert", dbmanager.Sqlconnection);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.ExecuteNonQuery();
                dbmanager.Close();
            }
            catch (Exception ex)
            {
                dbmanager.Close();
                return(-2);
            }
            return(0);
        }
Beispiel #2
0
 private void calculateCompressData(FibTreeNode node, Dictionary <FibTreeNode, CompressData> compressData)
 {
     if (node.Children.Count == 0)
     {
         compressData.Add(node, new CompressData()
         {
             Node          = node,
             Depth         = 0,
             OptimalStride = 0,
             PointerCount  = 0
         });
     }
     else
     {
         foreach (FibTreeNode child in node.Children.Values)
         {
             calculateCompressData(child, compressData);
         }
         CompressData nodeCompressData = new CompressData()
         {
             Node          = node,
             Depth         = node.GetDepth(),
             OptimalStride = -1,
             PointerCount  = -1
         };
         for (int k = 1; k <= nodeCompressData.Depth; k++)
         {
             int pointerCount = (int)Math.Pow(2, k);
             foreach (FibTreeNode child in node.GetChildrenAtLevel(k))
             {
                 pointerCount += compressData[child].PointerCount;
             }
             if ((nodeCompressData.PointerCount == -1) || (pointerCount < nodeCompressData.PointerCount))
             {
                 nodeCompressData.OptimalStride = k;
                 nodeCompressData.PointerCount  = pointerCount;
             }
         }
         compressData.Add(node, nodeCompressData);
     }
 }