private void SetPlanSocialGetCommandOutputs(SqlCommand cmd, PlanSocialGetOutput output) { if (cmd.Parameters[1].Value != DBNull.Value) { output.ReturnValue = (PlanSocialGetOutput.Returns)cmd.Parameters[1].Value; } }
/// <summary> /// Queries dbo.PlanObraSocial table. /// SQL+ Routine: dbo.PlanSocialGet - Authored by Ivo Strficek /// </summary> public PlanSocialGetOutput PlanSocialGet(IPlanSocialGetInput input) { if (!input.IsValid()) { throw new ArgumentException("PlanSocialGetInput fails validation - use the PlanSocialGetInput.IsValid() method prior to passing the input argument to the PlanSocialGet method.", "input"); } PlanSocialGetOutput output = new PlanSocialGetOutput(); if (sqlConnection != null) { using (SqlCommand cmd = GetPlanSocialGetCommand(sqlConnection, input)) { cmd.Transaction = sqlTransaction; PlanSocialGetCommand(cmd, output); } return(output); } for (int idx = 0; idx <= retryOptions.RetryIntervals.Count; idx++) { if (idx > 0) { System.Threading.Thread.Sleep(retryOptions.RetryIntervals[idx - 1]); } try { using (SqlConnection cnn = new SqlConnection(connectionString)) using (SqlCommand cmd = GetPlanSocialGetCommand(cnn, input)) { cnn.Open(); PlanSocialGetCommand(cmd, output); cnn.Close(); } break; } catch (SqlException sqlException) { bool throwException = true; if (retryOptions.TransientErrorNumbers.Contains(sqlException.Number)) { throwException = (idx == retryOptions.RetryIntervals.Count); if (retryOptions.Logger != null) { retryOptions.Logger.Log(sqlException); } } if (throwException) { throw; } } } return(output); }
private void PlanSocialGetCommand(SqlCommand cmd, PlanSocialGetOutput output) { using (SqlDataReader rdr = cmd.ExecuteReader()) { output.ResultData = new List <PlanSocialGetResult>(); while (rdr.Read()) { output.ResultData.Add(GetPlanSocialGetResultFromReader(rdr)); } rdr.Close(); } SetPlanSocialGetCommandOutputs(cmd, output); }