コード例 #1
0
        public void PopulateContact(SqlDataReader row, Boolean retrievePhoneNumbers)
        {
            ContactID = (Int32)row["ContactID"];
            Name      = (String)row["Name"];
            Address   = (String)row["Address"];
            City      = (String)row["City"];
            State     = (String)row["State"];
            Zip       = (String)row["Zip"];
            Email     = (String)row["Email"];
            Twitter   = (String)row["Twitter"];

            if (retrievePhoneNumbers)
            {
                PhoneNumbers = ContactPhone.GetPhoneNumbersByContactID(ContactID);
            }
        }
コード例 #2
0
        public static ContactPhone getPhoneByID(Int32 contactPhoneID)
        {
            ContactPhone phone = new ContactPhone();

            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);

            conn.Open();
            SqlCommand    cmd    = new SqlCommand(String.Format("SELECT top 1 * FROM ContactPhones WHERE contactPhoneID={0}", contactPhoneID), conn);
            SqlDataReader reader = cmd.ExecuteReader();

            if (reader.Read())
            {
                phone = new ContactPhone(reader);
            }

            return(phone);
        }