private void CloseDispatch(int intIdDispatch, string ResponseData) { ConnectionBroker.DataManagerClient lobjDispatch = null /* TODO Change to default(_) if this is not a reference type */; string lstrSQL = ""; try { int lintDispatchId = 0; lobjDispatch = new ConnectionBroker.DataManagerClient(); lobjDispatch.Open(); lobjDispatch.setConnectionString(System.Configuration.ConfigurationManager.ConnectionStrings["MainConnection"].ConnectionString); lobjDispatch.setReturnIdentity(true); lstrSQL = "UPDATE WCF_REFI_Log SET Process_Status = 1, Response_Date = GETDATE(), Response_Data= '" + ResponseData + "' WHERE Id_Services = " + intIdDispatch; lobjDispatch.ExecuteCommand(lstrSQL); lintDispatchId = lobjDispatch.getIdentityValue(); lobjDispatch.Finalize(); lobjDispatch.Close(); } catch (Exception ex) { throw new Exception(ex.Message); } finally { if (lobjDispatch != null) { lobjDispatch = null; } } }
private int InitDispatch(string ServiceName, string xmlData) { ConnectionBroker.DataManagerClient lobjDispatch = null /* TODO Change to default(_) if this is not a reference type */; string lstrSQL = ""; lobjDispatch = new ConnectionBroker.DataManagerClient(); try { int lintIdServices = 0; lobjDispatch.Open(); lobjDispatch.setConnectionString(System.Configuration.ConfigurationManager.ConnectionStrings["MainConnection"].ConnectionString); lobjDispatch.setReturnIdentity(true); lstrSQL = "INSERT INTO WCF_REFI_Log (Service_Name, XML_Data) VALUES ('" + ServiceName + "','" + xmlData.Replace("'", "''") + "')"; lobjDispatch.ExecuteCommand(lstrSQL); lintIdServices = lobjDispatch.getIdentityValue(); lobjDispatch.Finalize(); lobjDispatch.Close(); return(lintIdServices); } catch (Exception ex) { throw new Exception(ex.Message); } finally { if (lobjDispatch != null) { lobjDispatch = null; } /* TODO Change to default(_) if this is not a reference type */; } }