Esempio n. 1
0
        private IEnumerable <SqlDataRecord> ToSqlDataRecords(IEnumerable <Station> stations)
        {
            // Construct the Data Record with the MetaData:
            SqlDataRecord sdr = new SqlDataRecord(
                new SqlMetaData("Identifier", SqlDbType.NVarChar, 5),
                new SqlMetaData("Name", SqlDbType.NVarChar, 255),
                new SqlMetaData("StartDate", SqlDbType.DateTime2),
                new SqlMetaData("EndDate", SqlDbType.DateTime2),
                new SqlMetaData("StationHeight", SqlDbType.SmallInt),
                new SqlMetaData("State", SqlDbType.NVarChar, 255),
                new SqlMetaData("Latitude", SqlDbType.Real),
                new SqlMetaData("Longitude", SqlDbType.Real)
                );

            // Now yield the Measurements in the Data Record:
            foreach (var station in stations)
            {
                sdr.SetString(0, station.Identifier);
                sdr.SetString(1, station.Name);
                sdr.SetDateTime(2, station.StartDate);
                sdr.SetNullableDateTime(3, station.EndDate);
                sdr.SetInt16(4, station.StationHeight);
                sdr.SetString(5, station.State);
                sdr.SetFloat(6, station.Latitude);
                sdr.SetFloat(7, station.Longitude);

                yield return(sdr);
            }
        }
Esempio n. 2
0
            IEnumerator <SqlDataRecord> IEnumerable <SqlDataRecord> .GetEnumerator()
            {
                SqlDataRecord sdr = new SqlDataRecord(
                    new SqlMetaData("AddressFK", SqlDbType.SmallInt),
                    new SqlMetaData("age", SqlDbType.SmallInt, 30),
                    new SqlMetaData("Church", SqlDbType.VarChar),
                    new SqlMetaData("Denomination", SqlDbType.VarChar),
                    new SqlMetaData("DisabilitiesExplanation", SqlDbType.VarChar),
                    new SqlMetaData("DOB", SqlDbType.Date),
                    new SqlMetaData("EducationFK", SqlDbType.SmallInt),
                    new SqlMetaData("EducationMajor", SqlDbType.VarChar),
                    new SqlMetaData("Email", SqlDbType.VarChar),
                    new SqlMetaData("EmergencyNotify", SqlDbType.VarChar),
                    new SqlMetaData("Employer", SqlDbType.VarChar),
                    new SqlMetaData("EmployerPhone", SqlDbType.VarChar),
                    new SqlMetaData("EnrollmentTypeFK", SqlDbType.SmallInt),
                    new SqlMetaData("FamilyKey", SqlDbType.SmallInt),
                    new SqlMetaData("FirstName", SqlDbType.VarChar),
                    new SqlMetaData("Gender", SqlDbType.VarChar),
                    new SqlMetaData("Grade", SqlDbType.SmallInt),
                    new SqlMetaData("HasLearningDisabilities", SqlDbType.Bit),
                    new SqlMetaData("HasPhysicalDisabilities", SqlDbType.Bit),
                    new SqlMetaData("InHSLDA", SqlDbType.Bit),
                    new SqlMetaData("inMTHEA", SqlDbType.Bit),
                    new SqlMetaData("IsPrimaryAddress", SqlDbType.Bit),
                    new SqlMetaData("keyfield", SqlDbType.SmallInt),
                    new SqlMetaData("LastName", SqlDbType.VarChar),
                    new SqlMetaData("LastYrSchool", SqlDbType.VarChar),
                    new SqlMetaData("PersonFK", SqlDbType.SmallInt),
                    new SqlMetaData("PrimaryInsurance", SqlDbType.VarChar),
                    new SqlMetaData("PrimaryPhone", SqlDbType.VarChar),
                    new SqlMetaData("SecondaryPhone", SqlDbType.VarChar),
                    new SqlMetaData("SSN", SqlDbType.VarChar),
                    new SqlMetaData("SupportGroupOrCoop", SqlDbType.VarChar),
                    new SqlMetaData("WillGraduate", SqlDbType.Bit));

                foreach (People i in this)
                {
                    sdr.SetSqlInt16(0, i.AddressFK);
                    sdr.SetSqlInt16(1, i.age);
                    sdr.SetString(3, i.Church);
                    sdr.SetString(4, i.Denomination);
                    sdr.SetString(5, i.DisabilitiesExplanation);
                    sdr.SetNullableDateTime(5, i.DOB);
                    sdr.SetSqlInt16(5, i.EducationFK);
                    sdr.SetString(5, i.EducationMajor);
                    sdr.SetString(5, i.Email);
                    sdr.SetString(5, i.EmergencyNotify);
                    sdr.SetString(5, i.Employer);
                    sdr.SetString(5, i.EmployerPhone);
                    sdr.SetSqlInt16(5, i.EnrollmentTypeFK);
                    // sdr.SetSqlInt16(5, i.FamilyKey);
                    sdr.SetString(5, i.FirstName);
                    sdr.SetString(5, i.Gender);
                    sdr.SetSqlInt16(5, i.Grade);
                    sdr.SetBoolean(5, i.HasLearningDisabilities);
                    sdr.SetBoolean(5, i.HasPhysicalDisabilities);
                    sdr.SetBoolean(5, i.InHSLDA);
                    sdr.SetBoolean(5, i.inMTHEA);
                    sdr.SetBoolean(5, i.IsPrimaryAddress);
                    sdr.SetSqlInt16(5, i.keyfield);
                    sdr.SetString(5, i.LastName);
                    sdr.SetString(5, i.LastYrSchool);
                    sdr.SetSqlInt16(5, i.PersonFK);
                    sdr.SetBoolean(5, i.PrimaryInsurance);
                    sdr.SetString(5, i.PrimaryPhone);
                    sdr.SetString(5, i.SecondaryPhone);
                    sdr.SetString(5, i.SSN);
                    sdr.SetString(5, i.SupportGroupOrCoop);
                    sdr.SetBoolean(5, i.WillGraduate);
                    yield return(sdr);
                }
            }