Пример #1
0
 internal static DateTime? Retrieve( Int32 subjectTag, LinksDataSet.tblSubjectDetailsDataTable dt )
 {
     LinksDataSet.tblSubjectDetailsRow dr = dt.FindBySubjectTag(subjectTag);
     if ( dr.IsMobNull() )
         return null;
     else
         return dr.Mob;
 }
        public static Tristate RetrieveAlwaysLiveWithBothBioparents( Int32 subjectTag, LinksDataSet.tblParentsOfGen1CurrentDataTable dtInput )
        {
            if( dtInput == null ) throw new ArgumentNullException("dtInput");
            if( dtInput.Count <= 0 ) throw new ArgumentException("There should be at least one row in tblParentsOfGen1Current.");

            LinksDataSet.tblParentsOfGen1CurrentRow dr = dtInput.FindBySubjectTag(subjectTag);
            YesNo response = (YesNo)(dr.AlwaysLivedWithBothBioparents);
            return CommonFunctions.TranslateYesNo(response);

            //switch( response ) {
            //    case YesNo.Yes:
            //        return Tristate.Yes;
            //    case YesNo.No:
            //        return Tristate.No;
            //    case YesNo.ValidSkipOrNoInterviewOrNotInSurvey:
            //    case YesNo.InvalidSkip:
            //    case YesNo.DoNotKnow:
            //    case YesNo.Refusal:
            //        return Tristate.DoNotKnow;
            //    default:
            //        throw new InvalidOperationException("The TriState value is not recognized by this function.");
            //}
        }
        public static Int16? RetrieveBirthYear( Int32 subjectTag, Bioparent bioparent, LinksDataSet.tblParentsOfGen1CurrentDataTable dtInput )
        {
            if( dtInput == null ) throw new ArgumentNullException("dtInput");
            if( dtInput.Count <= 0 ) throw new ArgumentException("There should be at least one row in tblParentsOfGen1Current.");

            LinksDataSet.tblParentsOfGen1CurrentRow dr = dtInput.FindBySubjectTag(subjectTag);
            switch( bioparent ) {
                case Bioparent.Mom:
                    if( dr.IsBiomomBirthYearEstimatedNull() ) return null;
                    else return dr.BiomomBirthYearEstimated;
                case Bioparent.Dad:
                    if( dr.IsBiodadBirthYearEstimatedNull() ) return null;
                    else return dr.BiodadBirthYearEstimated;
                default:
                    throw new ArgumentOutOfRangeException("bioparent", bioparent, "The function does not accommodate that bioparent value.");
            }
        }
        public static Tristate RetrieveUSBorn( Int32 subjectTag, Item item, LinksDataSet.tblParentsOfGen1CurrentDataTable dtInput )
        {
            if ( dtInput == null ) throw new ArgumentNullException("dtInput");
            if ( dtInput.Count <= 0 ) throw new ArgumentException("There should be at least one row in tblParentsOfGen1Current.");

            LinksDataSet.tblParentsOfGen1CurrentRow dr = dtInput.FindBySubjectTag(subjectTag);
            Int16 response = Int16.MaxValue;
            switch ( item ) {
                case Item.Gen1MotherBirthCountry: response = dr.BiomomUSBorn; break;
                case Item.Gen1FatherBirthCountry: response = dr.BiodadUSBorn; break;
                default: throw new ArgumentOutOfRangeException("item", item, "The function does not accommodate that item.");
            }
            return (CommonFunctions.TranslateYesNo((YesNo)response));
        }