public string ErrorLogging(string ConString, string errorMsg, string application, int UserID) { string msg = string.Empty; Entity en = new Entity(); ClsUtility.Init_Hashtable(); errorMsg = errorMsg.Replace("'", "''"); String updateString = "insert into aa_errorLogs (UserID, Application, Message) values(" + UserID + ", '" + application + "', '" + errorMsg + "' )"; try { int i = (int)ReturnObject(ConString, ClsUtility.theParams, updateString, ClsUtility.ObjectEnum.ExecuteNonQuery, "mssql"); return(string.Empty); } catch (Exception ex) { return(ex.Message); } }
public static bool DropIQToolsObjects(string emrType, string serverType) { string connString = GetConnString(); try { DataTable theDt = new DataTable(); int i = 0; Entity theObject = new Entity(); ClsUtility.Init_Hashtable(); string toDrop = "Select Name FROM sys.synonyms"; theDt = (DataTable)theObject.ReturnObject(connString, ClsUtility.theParams , toDrop, ClsUtility.ObjectEnum.DataTable, serverType); DataTableReader dTr; dTr = theDt.CreateDataReader(); if (serverType.ToLower() == "mssql" || emrType.ToLower() == "" || emrType.ToLower() == "msaccess") { while (dTr.Read()) { try { i = (int)theObject.ReturnObject(connString, ClsUtility.theParams , "DROP Synonym [dbo].[" + dTr[0].ToString().Trim() + "]", ClsUtility.ObjectEnum.ExecuteNonQuery, "mssql"); } catch { } try { i = (int)theObject.ReturnObject(connString, ClsUtility.theParams , "DROP Table [" + dTr[0].ToString().Trim() + "]", ClsUtility.ObjectEnum.ExecuteNonQuery, "mssql"); } catch { } } try { i = (int)theObject.ReturnObject(connString, ClsUtility.theParams , "DROP TABLE mst_Patient_decoded", ClsUtility.ObjectEnum.ExecuteNonQuery, "mssql"); } catch { } try { i = (int)theObject.ReturnObject(connString, ClsUtility.theParams , "DROP TABLE dtl_PatientContacts", ClsUtility.ObjectEnum.ExecuteNonQuery, "mssql"); } catch { } try { i = (int)theObject.ReturnObject(connString, ClsUtility.theParams , "DROP TABLE Person_Decoded", ClsUtility.ObjectEnum.ExecuteNonQuery, "mssql"); } catch { } } return(true); } catch (Exception ex) { if (ex.Message.ToLower().Substring(0, 21) == "cannot use drop table") { //SqlConnection cnn = new SqlConnection(Entity.getconnString(clsGbl.xmlPath)); //cnn.Open(); //SqlCommand cmm = new SqlCommand("UPDATE aa_Database Set Connstring = '' WHERE DBName = 'IQTools'"); cmm.Connection = cnn; //int i = cmm.ExecuteNonQuery(); //cnn.Close(); cmm.Dispose(); cnn.Dispose(); } return(true); } }