AJH.CMS.Core.Data.FormRoleDataMapper.GetFormsRoles C# (CSharp) Method

GetFormsRoles() static private method

static private GetFormsRoles ( int FormID, int RoleID ) : List
FormID int
RoleID int
return List
        internal static List<FormRole> GetFormsRoles(int FormID, int RoleID)
        {
            List<FormRole> colFormRole = null;
            FormRole formRole = null;

            using (SqlConnection sqlConnection = new SqlConnection(CMSCoreBase.CMSCoreConnectionString))
            {
                SqlCommand sqlCommand = new SqlCommand(SN_FORM_ROLE_GET_BY_FORM_ROLE, sqlConnection);
                sqlCommand.CommandType = System.Data.CommandType.StoredProcedure;

                SqlParameter sqlParameter = null;

                sqlParameter = new SqlParameter(PN_FORM_ROLE_FORM_ID, System.Data.SqlDbType.Int);
                sqlParameter.Direction = System.Data.ParameterDirection.Input;
                sqlParameter.Value = FormID;
                sqlCommand.Parameters.Add(sqlParameter);

                sqlParameter = new SqlParameter(PN_FORM_ROLE_ROLE_ID, System.Data.SqlDbType.Int);
                sqlParameter.Direction = System.Data.ParameterDirection.Input;
                sqlParameter.Value = RoleID;
                sqlCommand.Parameters.Add(sqlParameter);

                sqlCommand.Connection.Open();
                using (SqlDataReader sqlDataReader = sqlCommand.ExecuteReader(System.Data.CommandBehavior.CloseConnection))
                {
                    colFormRole = new List<FormRole>();
                    while (sqlDataReader.Read())
                    {
                        formRole = GetFormRole(colFormRole, sqlDataReader);
                        FillFromReader(formRole, sqlDataReader);
                    }

                    sqlDataReader.Close();
                    sqlCommand.Connection.Close();
                }
            }
            return colFormRole;
        }