* @param viewStatic Description of the Parameter
* @param deleteCompanyDef Description of the Parameter
*/
public static void RemoveCompanyFromDatabase(int companyId, JFrame viewStatic, boolean deleteCompanyDef) {
try {
DataConnection dcc = DataConnection.getInstance(viewStatic);
if (dcc == null || !dcc.bIsConnectionMade) {
return;
}
Statement st = dcc.con.createStatement();
st.executeUpdate(dcc.filterSQL("DELETE FROM Activity2 WHERE CompId=" + companyId));
st = dcc.con.createStatement();
st.executeUpdate(dcc.filterSQL("DELETE FROM Amount WHERE CompId=" + companyId));
st = dcc.con.createStatement();
st.executeUpdate(dcc.filterSQL("DELETE FROM APP.Account WHERE CompId=" + companyId));
st = dcc.con.createStatement();
st.executeUpdate(dcc.filterSQL("DELETE FROM Customer2 WHERE CompId=" + companyId));
st = dcc.con.createStatement();
st.executeUpdate(dcc.filterSQL("DELETE FROM UniqNum WHERE CompId=" + companyId));
st = dcc.con.createStatement();
st.executeUpdate(dcc.filterSQL("DELETE FROM AccountingPeriods WHERE CompId=" + companyId));
st = dcc.con.createStatement();
st.executeUpdate(dcc.filterSQL("DELETE FROM AccountType WHERE CompId=" + companyId));
if (deleteCompanyDef) {
st = dcc.con.createStatement();
st.executeUpdate(dcc.filterSQL("DELETE FROM Company WHERE CompId=" + companyId));
}
EditBus.send(new CompanyListChanged(null, "no parameters"));
} catch (Exception e) {
Log.log(Log.DEBUG, null, "Error in RemoveCompanyFromDatabase= " + e);
}