示例#1
0
        public static void PopulateObjectFromReader(SqlDataReader reader, Customer NewCust)
        {
            Address customerAddress = new Address();

            NewCust.Id = (int)reader["Id"];
            NewCust.FirstName = reader["FirstName"].ToString().Trim();
            NewCust.LastName = reader["LastName"].ToString().Trim();
            NewCust.TaxFileNumber = reader["TFN"].ToString().Trim();
            NewCust.PhoneNumber = reader["PhoneNumber"].ToString().Trim();

            customerAddress.StreetDetail = reader["AddressStreetDetail"].ToString().Trim();
            customerAddress.City = reader["AddressCity"].ToString().Trim();
            customerAddress.State = reader["AddressState"].ToString().Trim();
            customerAddress.ZipCode = reader["AddressZipCode"].ToString().Trim();

            NewCust.CustomerAddress = customerAddress;
        }
示例#2
0
        public static BillPayPayee PopulateFromReader(SqlDataReader reader)
        {
            BillPayPayee payee = new BillPayPayee();
            Address address = new Address();

            payee.Id = (int)reader["Id"];
            payee.Name = reader["PayeeName"].ToString().Trim();
            payee.PhoneNumber = reader["PhoneNumber"].ToString().Trim();

            string streetDetail = reader["AddressStreetDetail"].ToString().Trim();

            if (streetDetail != null && streetDetail != "")
            {
                address.StreetDetail = streetDetail;
                address.City = reader["AddressCity"].ToString().Trim();
                address.State = reader["AddressState"].ToString().Trim();
                address.ZipCode = reader["AddressZipCode"].ToString().Trim();
            }

            payee.Address = address;

            return payee;
        }