Say I have a value defined as a form of commission formulas
let address_commission = 1.0
and I want to apply the above commission to the amount that I read from the database (the code from the WCF service window that I have)
let address_commission = 1.0
new Model.ClaimModel(
Code = (row.["claim_code"] :?> string),
EvtDate = (row.["event_date"] :?> DateTime),
Amount = (row.["amount"] :?> double) * address_commission,
now I see that the amount line compiles fine, but I also need to include the same commission in the next
PrevAmount = (if row.IsNull("prev_amount") then Nullable() else (row.["prev_amount"] :?> Nullable<double>)),
which is wrong since The type 'float' does not match the type 'obj'
Therefore, I also tried
PrevAmount = (if row.IsNull("prev_amount") then Nullable() else (((row.["prev_amount"] :?> double) * address_commission) :?> Nullable<double>)),
but he also fails with The type 'double' does not have any proper subtypes and cannot be used as the source of a type test or runtime coercion.
What is the right way to handle this?
user6996876
source
share