// ---------------------------------------------------------------------------------------- /// <!-- GetRaceFromBits --> /// <summary> /// Converts the race indicators from CANVaS into the raceId in VABHAS /// </summary> /// <param name="field"></param> /// <returns></returns> public static SqlInt32 GetRaceFromBits(DataRow field) { // ------------------------------------------------------------------ // Get the bits // ------------------------------------------------------------------ SqlBoolean black = InData.GetSqlBoolean(field, "Race_Black_Ind"); SqlBoolean yellow = InData.GetSqlBoolean(field, "Race_Asian_Ind"); SqlBoolean brown = InData.GetSqlBoolean(field, "Race_Hawaiian_Ind"); SqlBoolean red = InData.GetSqlBoolean(field, "Race_Native_Am_Ind"); SqlBoolean white = InData.GetSqlBoolean(field, "Race_White_Ind"); // ------------------------------------------------------------------ // Add the bits // ------------------------------------------------------------------ int total = 0 + (int)black.ToSqlInt32() + (int)yellow.ToSqlInt32() + (int)brown.ToSqlInt32() + (int)red.ToSqlInt32() + (int)white.ToSqlInt32(); // ------------------------------------------------------------------ // Use the bits // ------------------------------------------------------------------ SqlInt32 raceId = SqlInt32.Null; if (total > 1) { raceId = 13; // 13. Two or more races. } else if (black) { raceId = 1; // 1. African American } else if (yellow) { raceId = 2; // 2. Asian } else if (brown) { raceId = 3; // 3. Native Hawaiian } else if (red) { raceId = 4; // 4. American Indian } else if (white) { raceId = 5; // 5. Caucasian } else { raceId = 14; // 14. Decline to Identify } return(raceId); }
public void ToSqlInt32() { SqlInt32 sqlTestInt32; sqlTestInt32 = _sqlTrue.ToSqlInt32(); Assert.Equal(1, sqlTestInt32.Value); sqlTestInt32 = _sqlFalse.ToSqlInt32(); Assert.Equal(0, sqlTestInt32.Value); }
public void ToSqlInt32() { SqlInt32 SqlTestInt32; String error = "ToSqlInt32 method does not work correctly "; SqlTestInt32 = SqlTrue.ToSqlInt32(); Assert.AreEqual((int)1, SqlTestInt32.Value, error); SqlTestInt32 = SqlFalse.ToSqlInt32(); Assert.AreEqual((int)0, SqlTestInt32.Value, error); }
public void ToSqlInt32() { SqlInt32 SqlTestInt32; string error = "ToSqlInt32 method does not work correctly "; SqlTestInt32 = _sqlTrue.ToSqlInt32(); Assert.Equal(1, SqlTestInt32.Value); SqlTestInt32 = _sqlFalse.ToSqlInt32(); Assert.Equal(0, SqlTestInt32.Value); }