Blackbaud.CustomFx.Currency.Catalog.ExchangeRateRefreshBusinessProcess.LoadProperties C# (CSharp) Method

LoadProperties() private method

private LoadProperties ( SqlConnection conn ) : void
conn SqlConnection
return void
        private void LoadProperties(SqlConnection conn)
        {
            StringBuilder sql = new StringBuilder();
            sql.AppendLine("select");
            sql.AppendLine("  FIXERAPIACCESSKEY,");
            sql.AppendLine("  DATECODE,");
            sql.AppendLine("  HISTORICALDATE");
            sql.AppendLine("from dbo.USR_EXCHANGERATEREFRESHPROCESS");
            sql.AppendLine("where ID = @ID;");

            using (SqlCommand cmd = conn.CreateCommand())
            {
                cmd.CommandType = CommandType.Text;
                cmd.CommandTimeout = this.ProcessCommandTimeout;
                cmd.CommandText = sql.ToString();

                cmd.Parameters.AddWithValue("@ID", this.ProcessContext.ParameterSetID);

                using (SqlDataReader reader = cmd.ExecuteReader())
                {
                    if (reader.Read())
                    {
                        _accessKey = reader.GetString(0);
                        _dateCode = (Common.DateCode)reader.GetByte(1);

                        if (_dateCode == Common.DateCode.Historical)
                        {
                            _date = reader.GetDateTime(2);
                        }
                    }
                    else
                    {
                        throw new ServiceException("Could not retrieve process properties.");
                    }
                }
            }
        }