public static ToDecimal ( String value, IFormatProvider provider ) : Decimal | ||
value | String | |
provider | IFormatProvider | |
return | Decimal |
public ActionResult AddToBasket(AddToBasketButtonAddToBasketViewModel viewModel) { var cartServiceProvider = new CartServiceProvider(); var contactFactory = new ContactFactory(); string userId = contactFactory.GetContact(); var createCartRequest = new CreateOrResumeCartRequest(Context.GetSiteName(), userId); var cart = cartServiceProvider.CreateOrResumeCart(createCartRequest).Cart; var cartProduct = new CartProduct { ProductId = viewModel.ProductSku, Price = new Price(Convert.ToDecimal(viewModel.Price), cart.CurrencyCode) }; cartProduct.Properties.Add("VariantSku", viewModel.VariantSku); var cartLines = new ReadOnlyCollection <CartLine>( new Collection <CartLine> { new CartLine { Product = cartProduct, Quantity = (uint)viewModel.Quantity } } ); var request = new AddCartLinesRequest(cart, cartLines); cartServiceProvider.AddCartLines(request); return(Json(_miniBasketService.Refresh(), JsonRequestBehavior.AllowGet)); }
private IEnumerable <InternalBulkMeasurements> Decompress(string data) { var bytes = Convert.FromBase64String(data); using var to = new MemoryStream(); using var from = new MemoryStream(bytes); using var gzip = new GZipStream(@from, CompressionMode.Decompress); gzip.CopyTo(to); var final = to.ToArray(); var protoMeasurements = MeasurementData.Parser.ParseFrom(final); var measurements = from measurement in protoMeasurements.Measurements group measurement by measurement.SensorID into g select new InternalBulkMeasurements { SensorID = ObjectId.Parse(g.Key), Measurements = g.Select(m => new SingleMeasurement { Data = m.Datapoints.ToDictionary(p => p.Key, p => new DataPoint { Accuracy = p.Accuracy, Precision = p.Precision, Unit = p.Unit, Value = Convert.ToDecimal(p.Value), }), Location = new GeoJsonPoint <GeoJson2DGeographicCoordinates>(new GeoJson2DGeographicCoordinates(m.Longitude, m.Latitude)), PlatformTime = m.PlatformTime.ToDateTime(), Timestamp = m.Timestamp.ToDateTime() }).ToList() }; this.logger.LogInformation("Received {count} measurements.", protoMeasurements.Measurements.Count); return(measurements); }
/// <summary> /// Sets the initial value of the editor based on the contents of /// the Cell being edited /// </summary> protected override void SetEditValue() { // make sure we start with a valid value this.Value = this.Minimum; // attempt to get the cells data this.Value = Convert.ToDecimal(this.EditingCell.Data); }
/// <summary> /// Converts a value to a <see cref="decimal"/>. /// </summary> /// <param name="value">The object to convert.</param> /// <returns>The converted <paramref name="value"/>.</returns> public decimal ToDecimal(object value) { if (value == null) { throw new ArgumentNullException(nameof(value)); } return(SConvert.ToDecimal(value, CultureInfo.InvariantCulture)); }
public static decimal?ToDecimalN(this object obj) { if (obj == null) { return(null); } if (obj is bool) { return(Convert.ToDecimal(obj)); } return(decimal.TryParse(obj.ToString().Replace(".", ","), NumberStyles.Any, Culture, out decimal tmpvalue) ? tmpvalue : (decimal?)null); }
private static void RegisterDoubleConversions( ITypeConverterRegistry registry) { registry.Register <double, short>(from => SysConv.ToInt16(from)); registry.Register <double, int>(from => SysConv.ToInt32(from)); registry.Register <double, long>(from => SysConv.ToInt64(from)); registry.Register <double, ushort>(from => SysConv.ToUInt16(from)); registry.Register <double, uint>(from => SysConv.ToUInt32(from)); registry.Register <double, ulong>(from => SysConv.ToUInt64(from)); registry.Register <double, decimal>(from => SysConv.ToDecimal(from)); registry.Register <double, float>(from => SysConv.ToSingle(from)); registry.Register <double, string>(from => from.ToString(CultureInfo.InvariantCulture)); }
private static void RegisterSingleConversions( DefaultTypeConverter registry) { registry.Register <float, byte>(from => SysConv.ToByte(from)); registry.Register <float, short>(from => SysConv.ToInt16(from)); registry.Register <float, int>(from => SysConv.ToInt32(from)); registry.Register <float, long>(from => SysConv.ToInt64(from)); registry.Register <float, ushort>(from => SysConv.ToUInt16(from)); registry.Register <float, uint>(from => SysConv.ToUInt32(from)); registry.Register <float, ulong>(from => SysConv.ToUInt64(from)); registry.Register <float, decimal>(from => SysConv.ToDecimal(from)); registry.Register <float, double>(from => SysConv.ToDouble(from)); registry.Register <float, string>(from => from.ToString(CultureInfo.InvariantCulture)); }
/// <internalonly/> Decimal IConvertible.ToDecimal(IFormatProvider provider) { return(Convert.ToDecimal(m_value)); }
protected void Page_Load(object sender, EventArgs e) { var parser = new MathParser(); var resultA = ""; #region LoadFuncs parser.LocalFunctions.Add("isprime", x => { if (x[0] % 1 == 0) // check if it's an integer { return(Check.IsPrime((long)x[0]) ? 1 : 0); } throw new ArgumentException("The input is not an integer"); }); parser.LocalFunctions.Add("isodd", x => { if (x[0] % 1 == 0) // check if it's an integer { return(Check.IsOdd((long)x[0]) ? 1 : 0); } throw new ArgumentException("The input is not an integer"); }); parser.LocalFunctions.Add("iseven", x => { if (x[0] % 1 == 0) // check if it's an integer { return(Check.IsEven((long)x[0]) ? 1 : 0); } throw new ArgumentException("The input is not an integer"); }); parser.LocalFunctions.Add("iscoprime", x => { if (x[0] % 1 == 0) // check if it's an integer { return(Check.IsCoprime((long)x[0], (long)x[1]) ? 1 : 0); } throw new ArgumentException("The input is not an integer"); }); parser.LocalFunctions.Add("gdc", x => { if (x[0] % 1 == 0) // check if it's an integer { return(Get.Gdc((long)x[0], (long)x[1])); } throw new ArgumentException("The input is not an integer"); }); parser.LocalFunctions.Add("lcm", x => { if (x[0] % 1 == 0) // check if it's an integer { return(Get.Lcm((long)x[0], (long)x[1])); } throw new ArgumentException("The input is not an integer"); }); parser.LocalFunctions.Add("mod", x => { if (x[0] % 1 == 0) // check if it's an integer { return(Get.Mod((long)x[0], (long)x[1])); } throw new ArgumentException("The input is not an integer"); }); parser.LocalFunctions.Add("mean", x => x.Sum() / x.Length); parser.LocalFunctions.Add("bindec", x => { var returnvalue = Converter.From(Base.Base2, x[0].ToString(parser.CultureInfo)).To(Base.Base10); resultA += @"<table style='border:1px solid green;margin:3px;float:left;'><tr><th>Binary</th><th>Decimal</th></tr> <tr><td>" + x[0].ToString(parser.CultureInfo) + @"</td><td>" + returnvalue + @"</td></tr></table><div style='clear:both;'></div>"; return(Convert.ToDecimal(returnvalue)); }); parser.LocalFunctions.Add("decbin", x => { var returnvalue = Converter.From(Base.Base10, x[0].ToString(CultureInfo.InvariantCulture)).To(Base.Base2); resultA += @"<table style='border:1px solid green;margin:3px;float:left;'><tr><th>Decimal</th><th>Binary</th></tr> <tr><td>" + x[0].ToString(CultureInfo.InvariantCulture) + @"</td><td>" + returnvalue + @"</td></tr></table><div style='clear:both;'></div>"; return(Convert.ToDecimal(returnvalue)); }); var isStart = false; var list = new List <decimal>(); //const bool isDone = false; parser.LocalFunctions.Add("table", x => { // remake this method, so that the the parser.LocalVariables["x"] < parser.LocalVariables["table_max"] // is in front of everything. then, we can reuse the newWindow check code GC.Collect(); if (x.Length < 3) { resultA += "Error: the function requires 3 parameters."; return(0); } if (x.Length == 4) { if (x[3] <= 0) { resultA += "Error: the step cannot be zero."; return(0); } } if (isStart == false) { parser.LocalVariables["x"] = x[1]; isStart = true; resultA += "<table style='border:1px solid green;margin:3px;float:left;'><tr><th>x</th><th>f(x)</th></tr>"; } if (parser.LocalVariables["x"] <= x[2]) { parser.Parse(Request["expression"]); resultA += "<tr><td>" + parser.LocalVariables["x"] + "</td><td>" + x[0] + "</td></tr>"; list.Add(x[0]); parser.LocalVariables["x"] += x.Length == 3 ? 1 : x[3]; //parser.Parse(Request["expression"]); //parser.LocalVariables["x"] += x.Length == 3 ? 1 : x[3]; } else { //IsDone = true; resultA += @"</table> <table style='border:1px solid green;margin:3px;float:right;'><tr><th>Sum</th><th>Mean</th><th>Median</th></tr> <tr><td>" + (double)list.SumOfListElements() + @"</td><td>" + (double)list.Mean() + @"</td><td>" + (double)list.Median() + @"</td></tr> </table> <br /> <br /> <br /> <a href='?expression=" + Request["expression"].Replace("table", "sum") + @"' style='margin:3px;float:right;'>(sum)</a><br /> <br /> <a href='?expression=seq()' style='margin:3px;float:right;'>(more)</a> <div style='clear:both;'></div>"; isStart = false; return(1); } return(1); }); parser.LocalFunctions.Add("sum", x => { // remake this method, so that the the parser.LocalVariables["x"] < parser.LocalVariables["table_max"] // is in front of everything. then, we can reuse the newWindow check code GC.Collect(); if (x.Length < 3) { resultA += "Error: the function requires 3 parameters."; return(0); } if (x.Length == 4) { if (x[3] <= 0) { resultA += "Error: the step cannot be zero."; return(0); } } if (isStart == false) { parser.LocalVariables["x"] = x[1]; isStart = true; resultA += "<table style='border:1px solid green;margin:3px;float:left;'><tr><th>x</th><th>f(x)</th></tr>"; } if (parser.LocalVariables["x"] <= x[2]) { list.Add(x[0]); resultA += "<tr><td>" + parser.LocalVariables["x"] + "</td><td>" + list.SumOfListElements() + "</td></tr>"; parser.LocalVariables["x"] += x.Length == 3 ? 1 : x[3]; parser.Parse(Request["expression"]); parser.LocalVariables["x"] += x.Length == 3 ? 1 : x[3]; } else { //IsDone = true; resultA += @"</table> <table style='border:1px solid green;margin:3px;float:right;'><tr><th>Sum</th><th>Mean</th><th>Median</th></tr> <tr><td>" + (double)list.SumOfListElements() + @"</td><td>" + (double)list.Mean() + @"</td><td>" + (double)list.Median() + @"</td></tr> </table> <br /> <br /> <br /> <a href='?expression=" + Request["expression"].Replace("sum", "table") + @"' style='margin:3px;float:right;'>(table)</a><br /> <br /> <a href='?expression=seq()' style='margin:3px;float:right;'>(more)</a> <div style='clear:both;'></div>"; isStart = false; return(1); } return(1); }); decimal upper = 0; decimal lower = 0; var isUpper = false; var isLower = false; var isParserDone = false; var isParserDone2 = false; const decimal h = 0.00000001M; // 0.00000000001M; parser.LocalFunctions.Add("d", x => { // remake this method, so that the the parser.LocalVariables["x"] < parser.LocalVariables["table_max"] // is in front of everything. then, we can reuse the newWindow check code GC.Collect(); if (x[0] == 0 && x.Length < 2) { resultA += "Error: Please enter a function. The derivative is calculated with respect to x, i.e. d/dx(f(x))."; return(0); } if (x.Length < 2) { resultA += "Error: Please provide me with an x coordinate."; return(0); } if (!isUpper) { parser.LocalVariables["x"] = x[1] + h; if (!isParserDone) { isParserDone = true; parser.Parse(Request["expression"]); isParserDone = false; } if (isParserDone) { isUpper = true; upper = x[0]; } //IsParserDone = false; } if (!isLower && isUpper && isParserDone == false) { //lower = x[0]; parser.LocalVariables["x"] = x[1]; if (!isParserDone2) { isParserDone2 = true; parser.Parse(Request["expression"]); isParserDone2 = false; //IsUpper = true; } if (isParserDone2) { isLower = true; lower = x[0]; } } //check the no. of times this is executed. if (isLower && isUpper && !isParserDone2) { return(Math.Round((upper - lower) / h)); } return(0); }); parser.LocalFunctions.Add("seq", x => { resultA += "This function is currently under development."; //under development. return(0); }); #endregion #region LoadVariables var ci = Thread.CurrentThread.CurrentCulture; var monthNo = ci.Calendar.GetMonth(DateTime.Today); var weekNo = ci.Calendar.GetWeekOfYear(DateTime.Today, ci.DateTimeFormat.CalendarWeekRule, ci.DateTimeFormat.FirstDayOfWeek ); var dayNo = ci.Calendar.GetDayOfYear(DateTime.Today); parser.LocalVariables.Add("month", monthNo); parser.LocalVariables.Add("week", weekNo); parser.LocalVariables.Add("day", dayNo); #endregion #region LoadOperators parser.OperatorList.Add("$"); parser.OperatorList.Add("isnot"); parser.OperatorList.Add("and"); parser.OperatorList.Add("or"); parser.OperatorAction.Add("isnot", (x, y) => (x != y) ? 1 : 0); parser.OperatorAction.Add("and", (x, y) => (x == 1 && y == 1) ? 1 : 0); parser.OperatorAction.Add("or", (x, y) => (x == 1 || y == 1) ? 1 : 0); parser.OperatorAction.Add("$", (x, y) => { if (x % 1 != 0 || y % 1 != 0) { throw new ArgumentException("The input is not an integer"); } var returnValue = (long)x ^ (long)y; resultA += @"<table style='border:1px solid green;margin:3px;float:left;'><tr><th>Decimal</th><th>Binary</th></tr> <tr><td style='text-align:center'>" + x.ToString(CultureInfo.InvariantCulture) + @"</td><td style='text-align:right'>" + Converter.From(Base.Base10, x.ToString(CultureInfo.InvariantCulture)).To(Base.Base2) + @"</td></tr> <tr><td style='text-align:center'>" + y.ToString(CultureInfo.InvariantCulture) + @"</td><td style='text-align:right'>" + Converter.From(Base.Base10, y.ToString(CultureInfo.InvariantCulture)).To(Base.Base2) + @"</td></tr> <tr><td style='text-align:center'>" + returnValue.ToString() + @"</td><td style='text-align:right'>" + Converter.From(Base.Base10, returnValue.ToString()).To(Base.Base2) + @"</td></tr> </table><div style='clear:both;'></div>"; return(returnValue); }); //parser.OperatorAction["^"] = delegate(decimal x, decimal y) //{ // decimal returnValue = 1; // if (y == 0) // { // returnValue = 1; // } // else if (y == 1) // { // returnValue = x; // } // else if (y > 1) // { // for (int i = 0; i < y; i++) // { // returnValue *= x; // } // } // else if (y < 0) // { // for (int i = 0; i > y; i--) // { // returnValue *= 1/x; // } // } // return returnValue; //}; parser.LocalFunctions.Add("if", x => { if (x[0] == 1) { return(x[1]); } return(x.Length == 3 ? x[2] : 0); }); #endregion if (Request["expression"] == null) { return; } text.Value = Request["expression"]; parser.LocalVariables.Add("x", 0); try { result.Style.Add("border", "1px solid blue"); result.InnerHtml += "Result: " + parser.Parse(Request["expression"]).ToString(parser.CultureInfo); result.InnerHtml += "<br />" + resultA; } catch (Exception ex) { result.InnerHtml = ex.Message; } }
public ExecuteResult Update() { var moneyType = Ioc.Resolve <IAutoConfigService>() .GetList <MoneyTypeConfig>() .FirstOrDefault(e => e.Id == Parameter.MoneyTypeId); var repositoryContext = Ioc.Resolve <IUserRepository>().RepositoryContext; var transaction = repositoryContext.BeginNativeDbTransaction(); try { var sql = $"update Asset_Account set Amount=Amount-{Amount}, ModifiedTime=GetDate() where MoneyTypeId='{SourceMoneyTypeId}' and UserId={UserId} and Amount>={Amount}"; //判断更新语句是否影响了数据库 if (repositoryContext.ExecuteNonQuery(transaction, sql) > 0) { foreach (var item in RuleItems) { var addAmount = item.Ratio * Amount; sql = $"declare @amount decimal(18, 2);update Asset_Account set Amount=Amount+{addAmount}, @amount=Amount+{addAmount}, HistoryAmount=HistoryAmount+{addAmount}, ModifiedTime=GetDate() where MoneyTypeId='{item.MoneyTypeId}' and UserId={UserId};select @amount"; var result = repositoryContext.ExecuteScalar(transaction, sql); if (result == null || result == DBNull.Value) { return(ExecuteResult.Fail($"sql script:\"{sql}\" execute with 0 line update.")); } var afterAmount = Convert.ToDecimal(result); //此处继续加入Share_Reward与Asset_Bill表的记录 sql = @"insert into Share_Reward(AfterAcount, ConfirmTime, CreateTime, ExtraDate, Fee, FenRunDate, Intro, IsAccount, [Level], ModifiedTime, ModuleId, ModuleName, MoneyTypeId, MoneyTypeName, OrderId,OrderPrice, OrderSerial, OrderUserId, OrderUserNick, Price, Remark, Serial, SortOrder, State, Status, UserId, UserNikeName, TriggerType, ModuleConfigId, BonusId) values(@afteracount, GETDATE(), GETDATE(), '', 0, GETDATE(), @intro, 1, 0, GETDATE(), @moduleid, @modulename, @moneytypeid, @moneytypename, 0, 0, '', 0, '', 0, NULL, '', 1000, 3, 0, @userid, @usernickname, @triggertype, @moduleconfigid, @bonusid)"; IList <DbParameter> parameterList = new List <DbParameter> { repositoryContext.CreateParameter("@afteracount", afterAmount), repositoryContext.CreateParameter("@intro", Parameter.Summary), repositoryContext.CreateParameter("@moduleid", Parameter.ModuleId), repositoryContext.CreateParameter("@modulename", Parameter.ModuleName), repositoryContext.CreateParameter("@moneytypeid", Parameter.MoneyTypeId), repositoryContext.CreateParameter("@moneytypename", moneyType.Name), repositoryContext.CreateParameter("@userid", Parameter.ReceiveUserId), repositoryContext.CreateParameter("@triggertype", Parameter.TriggerType), repositoryContext.CreateParameter("@moduleconfigid", Parameter.ModuleConfigId), repositoryContext.CreateParameter("@bonusid", Parameter.BonusId) }; repositoryContext.ExecuteNonQuery(transaction, sql, parameterList.ToArray()); sql = @"insert into Asset_Bill(ActionType, AfterAmount,Amount, BillStatus, BillTypeId, BillTypeName, CheckAmount, CreateTime, Currency, ExtraDate, FailuredReason, Flow, Intro, ModifiedTime, MoneyTypeId, MoneyTypeName, OrderSerial, OtherUserId, OtherUserName, PayTime, ReceiveTime, Remark, Serial, ServiceAmount, ServiceMoneyTypeId, SortOrder, [Status], UserId, UserName, UserRemark) values(@actiontype, @afteramount, @amount, @billstatus, @billtypeid, @billtypename, @checkamount, GETDATE(), @currency, NULL, NULL, 0, @intro, GETDATE(), @moneytypeid, @moneytypename, NULL, 0, NULL,GETDATE(), GETDATE(), NULL, NULL, 0, 0, 1000, 0, @userid, @UserName, NULL)"; parameterList = new List <DbParameter> { /*epositoryContext.CreateParameter("@actiontype", fenRunBillTypeConfig.ActionType),*/ repositoryContext.CreateParameter("@afteramount", afterAmount), repositoryContext.CreateParameter("@amount", addAmount), repositoryContext.CreateParameter("@billstatus", Parameter.BillStatus), //repositoryContext.CreateParameter("@billtypeid", fenRunBillTypeConfig.Id), //repositoryContext.CreateParameter("@billtypename", fenRunBillTypeConfig.Name), repositoryContext.CreateParameter("@checkamount", addAmount), repositoryContext.CreateParameter("@currency", moneyType.Currency), repositoryContext.CreateParameter("@intro", Parameter.Summary), repositoryContext.CreateParameter("@moneytypeid", moneyType.Id), repositoryContext.CreateParameter("@moneytypename", moneyType.Name), repositoryContext.CreateParameter("@userid", Parameter.ReceiveUserId), repositoryContext.CreateParameter("@UserName", Parameter.ReceiveUserName) }; repositoryContext.ExecuteNonQuery(transaction, sql, parameterList.ToArray()); } } transaction.Commit(); return(ExecuteResult.Success()); } catch (Exception e) { transaction.Rollback(); return(ExecuteResult.Error(e)); } finally { transaction.Dispose(); } }
protected static internal object ConvertValue(Type type, NSJSValue value) { if (type == null) { throw new ArgumentNullException("type"); } object o = FetchValue(type, value); if (type == typeof(int)) { o = (o == null ? 0 : Converter.ToInt32(o)); } else if (type == typeof(uint)) { o = (o == null ? 0u : Converter.ToUInt32(o)); } else if (type == typeof(short)) { o = (o == null ? (short)0 : Converter.ToInt16(o)); } else if (type == typeof(ushort)) { o = (o == null ? (ushort)0 : Converter.ToUInt16(o)); } else if (type == typeof(sbyte)) { o = (o == null ? (sbyte)0 : Converter.ToSByte(o)); } else if (type == typeof(byte)) { o = (o == null ? (byte)0 : Converter.ToByte(o)); } else if (type == typeof(long)) { o = (o == null ? 0L : Converter.ToInt64(o)); } else if (type == typeof(ulong)) { o = (o == null ? 0ul : Converter.ToUInt64(o)); } else if (type == typeof(float)) { o = (o == null ? 0f : Converter.ToSingle(o)); } else if (type == typeof(double)) { o = (o == null ? 0d : Converter.ToDouble(o)); } else if (type == typeof(decimal)) { o = (o == null ? 0m : Converter.ToDecimal(o)); } else if (type == typeof(char)) { o = (o == null ? '\0' : Converter.ToChar(o)); } else if (type == typeof(DateTime)) { long ticks = 0; if (o is long) { ticks = (long)o; } else if (o != null) { ticks = Converter.ToInt64(o); } o = NSJSDateTime.LocalDateToDateTime(ticks); } else if (type == typeof(string)) { if (o == null) { o = null; } else if (!(o is string)) { o = o.ToString(); } } else if (typeof(NSJSValue).IsAssignableFrom(type)) { return(type.IsInstanceOfType(value) ? value : null); } return(o); }
public decimal ToDecimal(object value) => SystemConvert.ToDecimal(value);
protected void RadGridExpenseDetail_OnBatchEditCommand(object sender, GridBatchEditingEventArgs e) { foreach (var command in e.Commands) { if (command.Type.ToString() != "Cancel") { command.NewValues["ExpenseId"] = Convert.ToInt32(ViewState["NewIndex"]); command.NewValues["Date"] = (string.IsNullOrEmpty(Convert.ToString(command.NewValues["Date"]))) ? new DateTime(9999, 12, 31) : command.NewValues["Date"]; command.NewValues["Office"] = (string.IsNullOrEmpty(Convert.ToString(command.NewValues["Office"]))) ? 0 : Convert.ToDecimal(command.NewValues["Office"]); command.NewValues["Lodging"] = (string.IsNullOrEmpty(Convert.ToString(command.NewValues["Lodging"]))) ? 0 : Convert.ToDecimal(command.NewValues["Lodging"]); command.NewValues["Ground"] = (string.IsNullOrEmpty(Convert.ToString(command.NewValues["Ground"]))) ? 0 : Convert.ToDecimal(command.NewValues["Ground"]); command.NewValues["Meals"] = (string.IsNullOrEmpty(Convert.ToString(command.NewValues["Meals"]))) ? 0 : Convert.ToDecimal(command.NewValues["Meals"]); command.NewValues["Advertising"] = (string.IsNullOrEmpty(Convert.ToString(command.NewValues["Advertising"]))) ? 0 : Convert.ToDecimal(command.NewValues["Advertising"]); command.NewValues["Mail"] = (string.IsNullOrEmpty(Convert.ToString(command.NewValues["Mail"]))) ? 0 : Convert.ToDecimal(command.NewValues["Mail"]); command.NewValues["Telephone"] = (string.IsNullOrEmpty(Convert.ToString(command.NewValues["Telephone"]))) ? 0 : Convert.ToDecimal(command.NewValues["Telephone"]); command.NewValues["Km"] = (string.IsNullOrEmpty(Convert.ToString(command.NewValues["Km"]))) ? 0 : Convert.ToDecimal(command.NewValues["Km"]); command.NewValues["Kilometrage"] = (string.IsNullOrEmpty(Convert.ToString(command.NewValues["Kilometrage"]))) ? 0 : Convert.ToDecimal(command.NewValues["Kilometrage"]); command.NewValues["Miscellaneous"] = (string.IsNullOrEmpty(Convert.ToString(command.NewValues["Miscellaneous"]))) ? 0 : Convert.ToDecimal(command.NewValues["Miscellaneous"]); command.NewValues["CreatedId"] = CurrentUserId; command.NewValues["CreatedDate"] = DateTime.Now; } } }
decimal IConvertible.ToDecimal (IFormatProvider provider) { return Convert.ToDecimal (Value, provider); }