internal static void removeTable(UserTablesMD ut, string name, SAPbouiCOM.Application app, SAPbobsCOM.Company company) { int ret; string errMsg; if (ut.GetByKey(name)) { ret = ut.Remove(); if (ret != 0) { company.GetLastError(out ret, out errMsg); app.SetStatusBarMessage("Error removing table " + name, SAPbouiCOM.BoMessageTime.bmt_Short, true); throw new Exception(errMsg); } app.StatusBar.SetSystemMessage("Removed table " + name, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success); } }
public void removeUserTable(string tableName) { int err = 0; string errMsg = ""; UserTablesMD userTable = null; try { userTable = ((UserTablesMD)(oConnection.Company.GetBusinessObject(BoObjectTypes.oUserTables))); System.Runtime.InteropServices.Marshal.ReleaseComObject(userTable); System.GC.Collect(); userTable = ((UserTablesMD)(oConnection.Company.GetBusinessObject(BoObjectTypes.oUserTables))); userTable.GetByKey(tableName); if (userTable.Remove() == 0) { logMessage = "Tabela de Usuário " + tableName + " removida."; logger.log(logMessage, Logger.LogType.INFO); } else { oConnection.Company.GetLastError(out err, out errMsg); logMessage = "Erro ao remover Tabela de Usuário: '" + tableName + "': " + errMsg + " : " + err; logger.log(logMessage, Logger.LogType.ERROR, null, false); } } catch (Exception e) { oConnection.Company.GetLastError(out err, out errMsg); logMessage = "Erro ao remover Tabela de Usuário: '" + tableName + "': " + errMsg + " : " + err + " : " + e.Message; logger.log(logMessage, Logger.LogType.ERROR, e); SB1ControlException.SB1ControlException.Save(e); } }
internal static void removeTable(UserTablesMD ut, string name, SAPbouiCOM.Application app, SAPbobsCOM.Company company) { int ret; string errMsg; if (ut.GetByKey(name)) { ret = ut.Remove(); if (ret != 0) { company.GetLastError(out ret, out errMsg); app.SetStatusBarMessage("Error removing table " + name, SAPbouiCOM.BoMessageTime.bmt_Short, true); throw new Exception(errMsg); } app.StatusBar.SetSystemMessage("Removed table " + name, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success); } }