public DeleteFirmResponse DeleteFirm(DeleteFirmRequest request) { var response = new DeleteFirmResponse { ResponseStatus = ResponseStatus.Success }; var settingsProvider = new SettingsProvider(); try { if (request.ActionType == ActionType.Delete) { response.isSuccessful = settingsProvider.DeleteFirm(request); } else { response.ResponseStatus = ResponseStatus.Failure; response.ResponseDescription = "Not update action"; } } catch (Exception ex) { response.ResponseStatus = ResponseStatus.Failure; response.ResponseDescription = ex.Message; } return(response); }
public bool DeleteFirm(DeleteFirmRequest request) { var conn = GetConnection(ConnectionNames.CSPSqlDatabase); var commandWrapper = GetStoredProcCommand("dbo.Delete_Firm", conn); AddInParameter(commandWrapper, "@FirmId", DbType.Int16, request.FirmId); AddInParameter(commandWrapper, "@ERROR", DbType.String, 1000); AddInParameter(commandWrapper, "@ERROR_CODE", DbType.String, 4); try { conn.Open(); int results = commandWrapper.ExecuteNonQuery(); var isProcedureSucced = Convert.ToBoolean(results); MakeDboLog(request.ToString(), isProcedureSucced.ToString(), "dbo.Delete_Firm"); var errorObject = GetParameterValue(commandWrapper, "@ERROR"); var errorCodeObject = GetParameterValue(commandWrapper, "@ERROR_CODE"); return(Convert.ToBoolean(results)); } finally { commandWrapper.Dispose(); conn.Close(); } }
public DeleteFirmRequest GetDeleteFirmRequest(int firmId) { var request = new DeleteFirmRequest() { ActionType = Requests.ActionType.Delete, FirmId = firmId }; return(request); }