public static void LoadReesters(ExtExternalProcessing processing, string fileName)
 {
     try
     {
         System.IO.FileInfo info = new System.IO.FileInfo(fileName);
         if (!System.IO.File.Exists(info.get_FullName()))
         {
             throw new System.Exception(string.Format("Файл [{0}] не существует", fileName));
         }
         if (info.get_Extension().ToLower() == ".dbf")
         {
             System.Data.DataTable table = DALOdbc.ExecuteDataTable(DbfFormat.dBaseIV, info.get_DirectoryName(), "select * from " + info.get_Name());
             if (table.Rows.get_Count() > 0)
             {
                 System.Data.DataTable insertData = new System.Data.DataTable();
                 insertData.Columns.Add("processingId", System.Type.GetType("System.Int64"));
                 insertData.Columns.Add("field", System.Type.GetType("System.String"));
                 insertData.Columns.Add("statusId", System.Type.GetType("System.Int64"));
                 int id = FasetItem.FindByName(FasetsEnum.PaymentReestrStatus, "Загружен").Id;
                 foreach (System.Data.DataRow row in table.Rows)
                 {
                     System.Data.DataRow row2 = insertData.NewRow();
                     row2.set_Item("processingId", (long) processing.Id);
                     row2.set_Item("statusId", (int) id);
                     string str = "";
                     foreach (System.Data.DataColumn column in table.Columns)
                     {
                         string str2 = row.get_Item(column).ToString();
                         if (processing.Encoding != "")
                         {
                             System.Text.Encoding encoding = System.Text.Encoding.GetEncoding(processing.Encoding);
                             str2 = System.Text.Encoding.GetEncoding(0x4e3).GetString(encoding.GetBytes(str2));
                         }
                         str2 = str2.Replace(";", "").Replace("=", "");
                         str = str + column.get_Caption();
                         str = str + "=";
                         str = str + str2;
                         str = str + ';';
                     }
                     row2.set_Item("field", str);
                     insertData.Rows.Add(row2);
                 }
                 DALSql.BulkCopy("[ext].[ExternalProcessingFileRecords]", insertData);
             }
         }
         if (info.get_Extension().ToLower() == ".txt")
         {
             System.Data.DataTable table3 = new System.Data.DataTable();
             table3.Columns.Add("processingId", System.Type.GetType("System.Int64"));
             table3.Columns.Add("field", System.Type.GetType("System.String"));
             table3.Columns.Add("statusId", System.Type.GetType("System.Int64"));
             System.Text.Encoding encoding3 = System.Text.Encoding.GetEncoding(0x362);
             if (processing.Encoding != "")
             {
                 encoding3 = System.Text.Encoding.GetEncoding(processing.Encoding);
             }
             System.IO.StreamReader reader = new System.IO.StreamReader(fileName, encoding3);
             int num2 = FasetItem.FindByName(FasetsEnum.PaymentReestrStatus, "Загружен").Id;
             while (!reader.get_EndOfStream())
             {
                 string str3 = reader.ReadLine();
                 System.Data.DataRow row3 = table3.NewRow();
                 row3.set_Item("processingId", (long) processing.Id);
                 row3.set_Item("statusId", (int) num2);
                 row3.set_Item("field", str3);
                 table3.Rows.Add(row3);
             }
             DALSql.BulkCopy("[ext].[ExternalProcessingFileRecords]", table3);
         }
         if (info.get_Extension().ToLower() == ".csv")
         {
             System.Data.DataTable table4 = new System.Data.DataTable();
             table4.Columns.Add("processingId", System.Type.GetType("System.Int64"));
             table4.Columns.Add("field", System.Type.GetType("System.String"));
             table4.Columns.Add("statusId", System.Type.GetType("System.Int64"));
             System.IO.StreamReader reader2 = new System.IO.StreamReader(fileName, System.Text.Encoding.GetEncoding(0x4e3));
             int num3 = FasetItem.FindByName(FasetsEnum.PaymentReestrStatus, "Загружен").Id;
             while (!reader2.get_EndOfStream())
             {
                 string str4 = reader2.ReadLine();
                 System.Data.DataRow row4 = table4.NewRow();
                 row4.set_Item("processingId", (long) processing.Id);
                 row4.set_Item("statusId", (int) num3);
                 row4.set_Item("field", str4);
                 table4.Rows.Add(row4);
             }
             DALSql.BulkCopy("[ext].[ExternalProcessingFileRecords]", table4);
         }
         if (info.get_Extension() == ".xml")
         {
             System.Data.DataTable table5 = new System.Data.DataTable();
             table5.Columns.Add("processingId", System.Type.GetType("System.Int64"));
             table5.Columns.Add("field", System.Type.GetType("System.String"));
             table5.Columns.Add("statusId", System.Type.GetType("System.Int64"));
             System.IO.StreamReader reader3 = new System.IO.StreamReader(fileName, System.Text.Encoding.GetEncoding(0x4e3));
             int num4 = FasetItem.FindByName(FasetsEnum.PaymentReestrStatus, "Загружен").Id;
             string str5 = reader3.ReadToEnd();
             System.Data.DataRow row5 = table5.NewRow();
             row5.set_Item("processingId", (long) processing.Id);
             row5.set_Item("statusId", (int) num4);
             row5.set_Item("field", str5);
             table5.Rows.Add(row5);
             DALSql.BulkCopy("[ext].[ExternalProcessingFileRecords]", table5);
         }
     }
     catch (System.Exception exception)
     {
         throw new System.ApplicationException("Ошибка при загрузке файла реестра, возможно данные реестры уже были загружены" + fileName, exception);
     }
 }