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(); } }