예제 #1
0
        private void FillOrderProperties(Order order, IDataReader reader)
        {
            order.CustomerId     = (string)GetItem("CustomerID", reader);
            order.EmployeeId     = (int?)GetItem("EmployeeID", reader);
            order.RequiredDate   = (DateTime?)GetItem("RequiredDate", reader);
            order.ShipVia        = (int?)GetItem("ShipVia", reader);
            order.Freight        = (decimal?)GetItem("Freight", reader);
            order.ShipName       = (string)GetItem("ShipName", reader);
            order.ShipAddress    = (string)GetItem("ShipAddress", reader);
            order.ShipCity       = (string)GetItem("ShipCity", reader);
            order.ShipRegion     = (string)GetItem("ShipRegion", reader);
            order.ShipPostalCode = (string)GetItem("ShipPostalCode", reader);
            order.ShipCountry    = (string)GetItem("ShipCountry", reader);

            if (reader["OrderDate"] is DBNull)
            {
                return;
            }
            order.StartProcessing((DateTime)reader["OrderDate"]);

            if (!(reader["ShippedDate"] is DBNull))
            {
                order.Deliver((DateTime)reader["ShippedDate"]);
            }
        }