コード例 #1
0
    public CommerceLibOrderInfo(DataRow orderRow)
    {
        Shipping = new ShippingInfo();
        Tax      = new TaxInfo();

        OrderID     = Int32.Parse(orderRow["OrderID"].ToString());
        DateCreated = orderRow["DateCreated"].ToString();
        DateShipped = orderRow["DateShipped"].ToString();
        Comments    = orderRow["Comments"].ToString();
        Status      = Int32.Parse(orderRow["Status"].ToString());
        AuthCode    = orderRow["AuthCode"].ToString();
        Reference   = orderRow["Reference"].ToString();
        Customer    = Membership.GetUser(
            new Guid(orderRow["CustomerID"].ToString()));
        CustomerProfile =
            (HttpContext.Current.Profile as ProfileCommon)
            .GetProfile(Customer.UserName);
        CreditCard   = new SecureCard(CustomerProfile.CreditCard);
        OrderDetails =
            CommerceLibAccess.GetOrderDetails(
                orderRow["OrderID"].ToString());
        // Get Shipping Data
        if (orderRow["ShippingID"] != DBNull.Value &&
            orderRow["ShippingType"] != DBNull.Value &&
            orderRow["ShippingCost"] != DBNull.Value)
        {
            Shipping.ShippingID =
                Int32.Parse(orderRow["ShippingID"].ToString());
            Shipping.ShippingType = orderRow["ShippingType"].ToString();
            Shipping.ShippingCost =
                double.Parse(orderRow["ShippingCost"].ToString());
        }
        else
        {
            Shipping.ShippingID = -1;
        }
        // Get Tax Data
        if (orderRow["TaxID"] != DBNull.Value &&
            orderRow["TaxType"] != DBNull.Value &&
            orderRow["TaxPercentage"] != DBNull.Value)
        {
            Tax.TaxID         = Int32.Parse(orderRow["TaxID"].ToString());
            Tax.TaxType       = orderRow["TaxType"].ToString();
            Tax.TaxPercentage =
                double.Parse(orderRow["TaxPercentage"].ToString());
        }
        else
        {
            Tax.TaxID = -1;
        }
        // set info properties
        Refresh();
    }