void BindData()
    {
        ProductPrice price = ProductPrices.GetPrice(priceID);

        if (price == null)
        {
            price = new ProductPrice();
        }
        else
        {
            productID = price.ProductID;
        }

        Product product = Products.GetProduct(productID);

        if (product != null)
        {
            this.hyProductName.Text        = product.ProductName;
            this.hyProductName.NavigateUrl = GlobalSettings.RelativeWebRoot + "controlpanel/controlpanel.aspx?product-product&&id=" + productID;
        }
        else
        {
            throw new HHException(ExceptionType.ProductNotFound, "未找到商品信息!");
        }

        txtApplyTaxRate.Text   = price.ApplyTaxRate.ToString();
        txtPriceFloor.Text     = price.PriceFloor.HasValue ? price.PriceFloor.Value.ToString() : string.Empty;
        txtPriceGradeA.Text    = price.PriceGradeA.HasValue ? price.PriceGradeA.Value.ToString() : string.Empty;
        txtPriceGradeB.Text    = price.PriceGradeB.HasValue ? price.PriceGradeB.Value.ToString() : string.Empty;
        txtPriceGradeC.Text    = price.PriceGradeC.HasValue ? price.PriceGradeC.Value.ToString() : string.Empty;
        txtPriceGradeD.Text    = price.PriceGradeD.HasValue ? price.PriceGradeD.Value.ToString() : string.Empty;
        txtPriceGradeE.Text    = price.PriceGradeE.HasValue ? price.PriceGradeE.Value.ToString() : string.Empty;
        txtPriceMarket.Text    = price.PriceMarket.HasValue ? price.PriceMarket.Value.ToString() : string.Empty;
        txtPricePromotion.Text = price.PricePromotion.HasValue ? price.PricePromotion.Value.ToString() : string.Empty;
        txtPricePurchase.Text  = price.PricePurchase.HasValue ? price.PricePurchase.Value.ToString() : string.Empty;
        if (price.QuoteEnd != DateTime.MinValue)
        {
            txtQuoteEnd.Text = price.QuoteEnd.ToString("yyyy年MM月dd日");
        }
        if (price.QuoteFrom != DateTime.MinValue)
        {
            txtQuoteFrom.Text = price.QuoteFrom.ToString("yyyy年MM月dd日");
        }
        txtQuoteMOQ.Text              = price.QuoteMOQ.HasValue ? price.QuoteMOQ.Value.ToString() : string.Empty;
        txtQuoteRenewal.Text          = price.QuoteRenewal.ToString();
        ddlSupplyRegion.SelectedValue = price.SupplyRegion.ToString();
        piDeliverySpan.DateSpanValue  = price.DeliverySpan;
        piFreight.SelectedValue       = price.IncludeFreight;
        piTax.SelectedValue           = price.IncludeTax;
        piWarrantySpan.DateSpanValue  = price.WarrantySpan;
        csPrice.SelectedValue         = price.SupplyStatus;
    }
    public void btnPost_Click(object sender, EventArgs e)
    {
        ProductPrice price = null;

        if (action == OperateType.Add)
        {
            price           = new ProductPrice();
            price.ProductID = productID;
        }
        else
        {
            price = ProductPrices.GetPrice(priceID);
        }
        price.ApplyTaxRate = Convert.ToDecimal(txtApplyTaxRate.Text);
        if (!string.IsNullOrEmpty(txtPriceFloor.Text))
        {
            price.PriceFloor = Convert.ToDecimal(txtPriceFloor.Text);
        }
        else
        {
            price.PriceFloor = null;
        }

        if (!string.IsNullOrEmpty(txtPriceFloor.Text))
        {
            price.PriceFloor = Convert.ToDecimal(txtPriceFloor.Text);
        }
        else
        {
            price.PriceFloor = null;
        }

        if (!string.IsNullOrEmpty(txtPriceGradeA.Text))
        {
            price.PriceGradeA = Convert.ToDecimal(txtPriceGradeA.Text);
        }
        else
        {
            price.PriceGradeA = null;
        }

        if (!string.IsNullOrEmpty(txtPriceGradeB.Text))
        {
            price.PriceGradeB = Convert.ToDecimal(txtPriceGradeB.Text);
        }
        else
        {
            price.PriceGradeB = null;
        }

        if (!string.IsNullOrEmpty(txtPriceGradeC.Text))
        {
            price.PriceGradeC = Convert.ToDecimal(txtPriceGradeC.Text);
        }
        else
        {
            price.PriceGradeC = null;
        }

        if (!string.IsNullOrEmpty(txtPriceGradeD.Text))
        {
            price.PriceGradeD = Convert.ToDecimal(txtPriceGradeD.Text);
        }
        else
        {
            price.PriceGradeD = null;
        }

        if (!string.IsNullOrEmpty(txtPriceGradeE.Text))
        {
            price.PriceGradeE = Convert.ToDecimal(txtPriceGradeE.Text);
        }
        else
        {
            price.PriceGradeE = null;
        }

        if (!string.IsNullOrEmpty(txtPriceMarket.Text))
        {
            price.PriceMarket = Convert.ToDecimal(txtPriceMarket.Text);
        }
        else
        {
            price.PriceMarket = null;
        }

        if (!string.IsNullOrEmpty(txtPricePromotion.Text))
        {
            price.PricePromotion = Convert.ToDecimal(txtPricePromotion.Text);
        }
        else
        {
            price.PricePromotion = null;
        }

        if (!string.IsNullOrEmpty(txtPricePurchase.Text))
        {
            price.PricePurchase = Convert.ToDecimal(txtPricePurchase.Text);
        }
        else
        {
            price.PricePurchase = null;
        }

        price.QuoteEnd  = Convert.ToDateTime(txtQuoteEnd.Text);
        price.QuoteFrom = Convert.ToDateTime(txtQuoteFrom.Text);

        if (!string.IsNullOrEmpty(txtQuoteMOQ.Text))
        {
            price.QuoteMOQ = Convert.ToInt32(txtQuoteMOQ.Text);
        }
        else
        {
            price.QuoteMOQ = null;
        }

        price.QuoteRenewal   = Convert.ToInt32(txtQuoteRenewal.Text);
        price.DeliverySpan   = piDeliverySpan.DateSpanValue;
        price.IncludeFreight = piFreight.SelectedValue;
        price.IncludeTax     = piTax.SelectedValue;
        price.WarrantySpan   = piWarrantySpan.DateSpanValue;
        price.SupplyStatus   = csPrice.SelectedValue;
        price.SupplyRegion   = Convert.ToInt32(ddlSupplyRegion.SelectedValue);
        DataActionStatus status;

        if (action == OperateType.Add)
        {
            status = ProductPrices.Create(price);
            switch (status)
            {
            case DataActionStatus.UnknownFailure:
                mbMessage.ShowMsg("产品报价失败,请联系管理员!", Color.Red);
                break;

            case DataActionStatus.Success:
            default:
                mbMessage.ShowMsg("产品报价成功,可继续进行产品报价,若完成请返回!", Color.Navy);
                break;
            }
        }
        else
        {
            status = ProductPrices.Update(price);
            switch (status)
            {
            case DataActionStatus.UnknownFailure:
                mbMessage.ShowMsg("修改产品报价失败,请联系管理员!", Color.Red);
                break;

            case DataActionStatus.Success:
            default:
                mbMessage.ShowMsg("修改产品报价成功,可继续修改产品报价,若完成请返回!", Color.Navy);
                break;
            }
        }
        if (status == DataActionStatus.Success)
        {
            BindData();
        }
    }