更新时间:2023-11-17 18:17:46
在您的堆栈跟踪中,有一个System.InvalidCastException
From your stack trace there is a System.InvalidCastException
这意味着某些属性的值具有错误的类型.由于仅更改税"属性,因此其类型不正确.最有可能的税"是一个Money字段,因此我想您应该为其分配类型为decimal
的变量,而不是double
.尝试这样的事情:
It means value of some attribute has incorrect type. Since you are changing only 'tax' attribute, then its type is incorrect. Most probably "tax" is a Money field, so I guess you should assign variable of type decimal
to it, not double
. Try something like this:
decimal Tax = (decimal)((QuoteProduct.BaseAmount
- QuoteProduct.ManualDiscountAmount.GetValueOrDefault()
- QuoteProduct.VolumeDiscountAmount.GetValueOrDefault()) / 20);