public static bool CheckImbaseConnection() { ImApplication = new ImbaseApplicationClass(); bool Done = false; try { // Создаем новое подключение, если указатель нулевой // //if (ImApplication == null) ImApplication = CoImbaseApplication.Create(); // Проверяем состояние сервера while (!Done) { // Опрос состояния switch (ImApplication.Status) { case ImBaseLoadStatus.IST_READY: Done = true; break; // Система готова case ImBaseLoadStatus.IST_WAITFORLOGIN: case ImBaseLoadStatus.IST_INTERNALLOADING: // Система ожидает ввода пароля или загружается. Надо подождать. System.Threading.Thread.Sleep(10); break; } // switch } // while } // try catch (Exception e) { Debug.WriteLine("Exception: " + e.Message); // System.Windows.Forms.MessageBox.(e); return(false); } Debug.WriteLine(ImApplication.Status); return(true); }
public static string CheckByImbaseKey(string ImCode) { ImDataBase.GetKeyInfo(ImCode, out string TableRecord, out string CatalogRecord, out string KeysList); // Debug.WriteLine(TableRecord); // Debug.WriteLine(CatalogRecord); // Debug.WriteLine(KeysList); int startIndex = CatalogRecord.IndexOf("\"ПОЛНОЕ ОБОЗНАЧЕНИЕ=") + 20; // Debug.WriteLine(startIndex); int endIndex = CatalogRecord.IndexOf("\",КЛАСС="); // Debug.WriteLine(endIndex); var FullDesignation = CatalogRecord.Substring(startIndex, endIndex - startIndex); Debug.WriteLine(FullDesignation); Debug.WriteLine(DateTime.Now - TimeStart); // Console.ReadLine(); ImbApplication = null; ImDataBase = null; return(FullDesignation); }
public static void CloseImbaseConnection() { ImApplication = null; ImDataBase = null; }