Esempio n. 1
0
        private void Snapshot(dynamic data)
        {
            var currencyPair = _currencyMapper.GetCurrency((string)data.product_id);
            var orderBook    = new OrderBook
            {
                CurrencyPair = currencyPair
            };

            foreach (var bid in data.bids)
            {
                var bookItem = new OrderBookItem()
                {
                    Price  = DecimalHelper.Get((string)bid[0]),
                    Volume = DecimalHelper.Get((string)bid[1]),
                };
                orderBook.Bids.Add(bookItem);
            }
            foreach (var ask in data.asks)
            {
                var bookItem = new OrderBookItem()
                {
                    Price  = DecimalHelper.Get((string)ask[0]),
                    Volume = DecimalHelper.Get((string)ask[1]),
                };
                orderBook.Asks.Add(bookItem);
            }
            SortBids(orderBook);
            SortAsks(orderBook);
            _orderBookDict[currencyPair] = orderBook;
            OrderBookChanged?.Invoke(orderBook.CurrencyPair, orderBook);
        }
Esempio n. 2
0
        /// <summary>
        /// 页面-支付宝支付通知
        /// </summary>
        public ActionResult AlipayNotify(RequestModel request)
        {
            //支付宝通知日志
            Log4netHelper.Get(KeyModel.Log.PayNotification).AsyncWriter(request.JsonString);

            string tradStatus = JsonHelper.GetValue(request.Obj, "trade_status");

            if (!(tradStatus.ToLower() == "trade_success"))
            {
                return(Content("fail"));
            }

            string  tradeNo          = JsonHelper.GetValue(request.Obj, "out_trade_no");
            decimal moneyValue       = DecimalHelper.Get(JsonHelper.GetValue(request.Obj, "total_fee"));
            string  rechrageRecordId = JsonHelper.GetValue(request.Obj, "trade_no");

            if (VerifyHelper.IsEmpty(tradeNo) || VerifyHelper.IsEmpty(moneyValue))
            {
                throw new MessageException(EnumMessageCode.信息错误);
            }
            try
            {
                rechargeRecordService.RechargeSuccess(tradeNo, moneyValue, rechrageRecordId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(Content("success"));
        }
        private static void FetchUploadFiles(Stream requestStream, byte[] boundarybuffer, string[] files, Encoding encoding, byte[] allRequestBuffer, Action <decimal> completePercentFacotry)
        {
            string _headerTemplate = "Content-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"\r\nContent-Type: application/octet-stream\r\n\r\n";

            byte[]   _buffer               = new byte[4096];
            int      _offset               = 0;
            int      _completeOffset       = 0;
            DateTime _uploadFilesStartTime = DateTime.Now;

            for (int i = 0; i < files.Length; i++)
            {
                requestStream.Write(boundarybuffer, 0, boundarybuffer.Length);
                string _header      = string.Format(_headerTemplate, "file" + i, Path.GetFileName(files[i]));
                byte[] _headerbytes = encoding.GetBytes(_header);
                requestStream.Write(_headerbytes, 0, _headerbytes.Length);

                using (FileStream fileStream = new FileStream(files[i], FileMode.Open, FileAccess.Read))
                {
                    while ((_offset = fileStream.Read(_buffer, 0, _buffer.Length)) != 0)
                    {
                        _completeOffset = _completeOffset + _offset;
                        requestStream.Write(_buffer, 0, _offset);

                        if ((DateTime.Now - _uploadFilesStartTime).TotalMilliseconds >= 10 || _completeOffset == fileStream.Length)
                        {
                            decimal _percent = DecimalHelper.CalcPercentage(_completeOffset, fileStream.Length);
                            completePercentFacotry(_percent);
                            _uploadFilesStartTime = DateTime.Now;
                        }
                    }
                }
            }

            requestStream.Write(allRequestBuffer, 0, allRequestBuffer.Length);
        }
        public bool SaveData()
        {
            var result = false;

            using (var ctx = new EF6.RT2020Entities())
            {
                var item = ctx.ProductSupplement.Where(x => x.ProductId == this._ProductId).FirstOrDefault();
                if (item == null)
                {
                    item = new EF6.ProductSupplement();

                    item.SupplementId = Guid.NewGuid();
                    item.ProductId    = _ProductId;

                    ctx.ProductSupplement.Add(item);
                }
                item.Product.FixedPriceItem = chkFixedPrice.Checked;

                item.VipDiscount_FixedItem      = DecimalHelper.StringToDecimal(txtFixPriceItem.Text);
                item.VipDiscount_DiscountItem   = DecimalHelper.StringToDecimal(txtDiscountItem.Text);
                item.VipDiscount_NoDiscountItem = DecimalHelper.StringToDecimal(txtNoDiscountItem.Text);
                item.StaffDiscount = DecimalHelper.StringToDecimal(txtStaffDiscount.Text);

                ctx.SaveChanges();
            }

            return(result);
        }
Esempio n. 5
0
        /// <summary>
        /// 页面-支付宝支付跳转
        /// </summary>
        public ActionResult AlipayReturn(RequestModel request)
        {
            //异步记录日志
            Log4netHelper.Get(KeyModel.Log.PayNotification).AsyncWriter(request.JsonString);

            var result = WebHelper.GetResult(request);

            if (result.Code == EnumHelper.GetValue(EnumResultCode.操作成功))
            {
                //支付失败
                string returnSuccess = JsonHelper.GetValue(request.Obj, "is_success");
                string tradStatus    = JsonHelper.GetValue(request.Obj, "trade_status");
                if (!(returnSuccess.ToLower() == "t" && tradStatus.ToLower() == "trade_success"))
                {
                    throw new MessageException(EnumMessageCode.支付失败);
                }
                string  tradeNo          = JsonHelper.GetValue(request.Obj, "out_trade_no");
                decimal moneyValue       = DecimalHelper.Get(JsonHelper.GetValue(request.Obj, "total_fee"));
                string  rechrageRecordId = JsonHelper.GetValue(request.Obj, "trade_no");
                if (VerifyHelper.IsEmpty(tradeNo) || VerifyHelper.IsEmpty(moneyValue))
                {
                    throw new MessageException(EnumMessageCode.信息错误);
                }
                try
                {
                    rechargeRecordService.RechargeSuccess(tradeNo, moneyValue, rechrageRecordId);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            return(new RedirectResult(WebHelper.GetMemberUrl("/trade/rechargerecord")));
        }
        public async Task SetForm()
        {
            var response = await ApiHelper.Get <GoiVay>(ApiRouter.BANK_GOIVAY + "/" + _id);

            if (response.IsSuccess && response.Content != null)
            {
                this._goiVay = response.Content as GoiVay;
                this.Title   = _goiVay.Name;

                image.Success += (sender1, e1) =>
                {
                    heightImage = e1.ImageInformation.OriginalHeight;
                    widthImage  = e1.ImageInformation.OriginalWidth;
                    setSizeImage();
                };
                image.Source = ImageSource.FromUri(new Uri(_goiVay.ImageFullUrl));

                lblNganHang.Text    = _goiVay.Bank.Name;
                lblGoiVayName.Text  = _goiVay.Name;
                lblMaxPrice.Text    = DecimalHelper.DecimalToText(_goiVay.MaxPrice) + "%";
                lblMaxTime.Text     = _goiVay.MaxTime + " " + (_goiVay.MaxTimeUnit == 0 ? Language.year.ToLower() : Language.month.ToLower());
                lblLaiSuat.Text     = DecimalHelper.DecimalToText(_goiVay.LaiSuat) + "%";
                lblCondition.Text   = _goiVay.Condition;
                lblDescription.Text = _goiVay.Description;

                lblEmpName.Text = _goiVay.User.FullName;
                lblPhone.Text   = _goiVay.User.Phone;

                imageAvatar.Source = _goiVay.User.AvatarFullUrl;

                lblAddress.Text = _goiVay.Employee.Address;
            }
        }
Esempio n. 7
0
        public decimal CalculateRegen(IClassDefinition classInfo)
        {
            // var life = CalculateAmount(level, classType);
            var totalRegen = Convert.ToDouble(BasicRegen + BonusRegen);

            return(DecimalHelper.RoundToDecimals(totalRegen * Convert.ToDouble(1 + BonusRegenPercentage), 2));
        }
Esempio n. 8
0
        public static void ToDecimal_Bytes_IsNull()
        {
            // Arrange

            // Act
            Assert.Throws <ArgumentNullException>(() => DecimalHelper.ToDecimal(null, 0));

            // Assert
        }
Esempio n. 9
0
        public object Read(byte[] buffer, int index)
        {
            var lo   = ByteOrder.GetIntLE(buffer, index);
            var mid  = ByteOrder.GetIntLE(buffer, index + 4);
            var hi   = ByteOrder.GetIntLE(buffer, index + 8);
            var flag = ByteOrder.GetIntLE(buffer, index + 12);

            return(DecimalHelper.FromBits(lo, mid, hi, flag));
        }
Esempio n. 10
0
        public static void ToDecimal_BytesArray_TooSmall()
        {
            // Arrange

            // Act
            Assert.Throws <ArgumentException>(() => DecimalHelper.ToDecimal(new byte[] { 1 }, 0));

            // Assert
        }
Esempio n. 11
0
        public static void ToDecimal_StartIndex_OutOfRange()
        {
            // Arrange

            // Act
            Assert.Throws <ArgumentOutOfRangeException>(() => DecimalHelper.ToDecimal(new byte[] { }, 1));

            // Assert
        }
Esempio n. 12
0
        public static void GetBytes_ToDecimal(decimal value)
        {
            // Arrange

            // Act
            var result = DecimalHelper.ToDecimal(DecimalHelper.GetBytes(value), 0);

            // Assert
            Assert.Equal(value, result);
        }
Esempio n. 13
0
        public static void ToDecimal(string value, string s)
        {
            // Arrange
            var expected = decimal.Parse(value, CultureInfo.InvariantCulture);

            // Act
            var result = DecimalHelper.ToDecimal(Convert.FromBase64String(s), 0);

            // Assert
            Assert.Equal(expected, result);
        }
Esempio n. 14
0
        public static void GetBytes(string expected, string s)
        {
            // Arrange
            var value = decimal.Parse(s, CultureInfo.InvariantCulture);

            // Act
            var result = DecimalHelper.GetBytes(value);

            // Assert
            Assert.Equal(expected, Convert.ToBase64String(result));
        }
Esempio n. 15
0
        /// <summary>Searches the list of transactions for specified criteria.</summary>
        /// <returns>Return true if any items match</returns>
        private bool SearchTransaction()
        {
            DateTime selectedDate = TransactionDate.SelectedDate != null?DateTimeHelper.Parse(TransactionDate.SelectedDate) : DateTime.MinValue;

            string  payee         = TxtPayee.Text.ToLower();
            string  majorCategory = CmbMajorCategory.SelectedIndex != -1 ? CmbMajorCategory.SelectedValue.ToString().ToLower() : "";
            string  minorCategory = CmbMinorCategory.SelectedIndex != -1 ? CmbMinorCategory.SelectedValue.ToString().ToLower() : "";
            string  memo          = TxtMemo.Text.ToLower();
            decimal outflow       = DecimalHelper.Parse(TxtOutflow.Text.ToLower());
            decimal inflow        = DecimalHelper.Parse(TxtInflow.Text.ToLower());
            string  account       = _selectedAccount.Name?.ToLower() ?? "";

            if (selectedDate != DateTime.MinValue)
            {
                _matchingTransactions = _matchingTransactions.Where(transaction => transaction.Date == selectedDate).ToList();
            }

            if (!string.IsNullOrWhiteSpace(payee))
            {
                _matchingTransactions = _matchingTransactions.Where(transaction => transaction.Payee.ToLower().Contains(payee)).ToList();
            }

            if (!string.IsNullOrWhiteSpace(majorCategory))
            {
                _matchingTransactions = _matchingTransactions.Where(transaction => transaction.MajorCategory.ToLower() == majorCategory).ToList();
            }

            if (!string.IsNullOrWhiteSpace(minorCategory))
            {
                _matchingTransactions = _matchingTransactions.Where(transaction => transaction.MinorCategory.ToLower() == minorCategory).ToList();
            }

            if (!string.IsNullOrWhiteSpace(memo))
            {
                _matchingTransactions = _matchingTransactions.Where(transaction => transaction.Memo.ToLower().Contains(memo)).ToList();
            }

            if (outflow != 0M)
            {
                _matchingTransactions = _matchingTransactions.Where(transaction => transaction.Outflow == outflow).ToList();
            }

            if (inflow != 0M)
            {
                _matchingTransactions = _matchingTransactions.Where(transaction => transaction.Inflow == inflow).ToList();
            }

            if (!string.IsNullOrWhiteSpace(account))
            {
                _matchingTransactions = _matchingTransactions.Where(transaction => transaction.Account.ToLower() == account).ToList();
            }

            return(_matchingTransactions.Count > 0);
        }
        public SelfEmpowerHitProc CalculateProcAmount(IClassDefinition classInfo)
        {
            var baseProcRate  = DecimalHelper.RoundToDecimals((classInfo.ClassType == Enums.ClassTypeEnum.Barbarian ? 10 : 6) / 100, 3);
            var bonusProcRate = DecimalHelper.RoundToDecimals(0.66 * classInfo.DemonicPower * (classInfo.ClassType == Enums.ClassTypeEnum.Barbarian ? 0.6 : 0.5), 3);
            var procAmount    = DecimalHelper.RoundToDecimals(Convert.ToDouble(baseProcRate + bonusProcRate), 2);

            var resourceReturnProc = new SelfEmpowerHitProc {
                ProcPercentage = 1, ProcAmount = procAmount, Duration = 0
            };

            return(resourceReturnProc);
        }
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value != null)
     {
         if (value is decimal)
         {
             var decValue = (decimal)value * 1000;
             return(DecimalHelper.ToCurrency(decValue) + " đ/m2");
         }
     }
     return(null);
 }
Esempio n. 18
0
        /// <summary>Attempts to add a Transaction to the database.</summary>
        /// <returns>Returns true if successfully added</returns>
        private async Task <bool> AddTransaction()
        {
            Transaction newTransaction = new Transaction(await AppState.GetNextTransactionsIndex(), DateTimeHelper.Parse(TransactionDate.SelectedDate),
                                                         TxtPayee.Text, CmbMajorCategory.SelectedValue.ToString(), CmbMinorCategory.SelectedValue.ToString(),
                                                         TxtMemo.Text, DecimalHelper.Parse(TxtOutflow.Text), DecimalHelper.Parse(TxtInflow.Text),
                                                         _selectedAccount.Name);

            _selectedAccount.AddTransaction(newTransaction);
            AppState.AllTransactions.Add(newTransaction);

            return(await AppState.AddTransaction(newTransaction, _selectedAccount));
        }
        public void Deserialize_Decimal()
        {
            // Arrange
            var formatter = new SimpleObjectFormatter(Encoding.UTF8, m_mockInner.Object);
            var flags     = (int)TypeCode.Decimal;
            var value     = RandomHelper.NextInt(g_random, -10000, 10000) / 100M;
            var data      = new ArraySegment <byte>(DecimalHelper.GetBytes(value));

            // Act
            var result = formatter.Deserialize <decimal>(data, flags);

            // Assert
            Assert.Equal(value, result);
        }
Esempio n. 20
0
        public async void PriceToPick_Clicked(object sender, EventArgs e)
        {
            SelectPricePage selectPricePage = new SelectPricePage(viewModel.PostModel.PriceTo, viewModel.PostModel.PriceToUnit);

            selectPricePage.SetSaveEvent(async(object sSender, EventArgs sE) =>
            {
                viewModel.PostModel.PriceToUnit   = (short)selectPricePage.SelectedOption.Id;
                viewModel.PostModel.PriceToText   = DecimalHelper.DecimalToText(selectPricePage.Price) + " " + selectPricePage.SelectedOption.Name.ToLower();
                viewModel.PostModel.PriceTo       = selectPricePage.Price;
                viewModel.PostModel.PriceToQuyDoi = selectPricePage.Price * selectPricePage.SelectedOption.QuyDoi;
                await Navigation.PopAsync();
            });
            await Navigation.PushAsync(selectPricePage);
        }
        public void Serialize_Decimal()
        {
            // Arrange
            var formatter = new SimpleObjectFormatter(Encoding.UTF8, m_mockInner.Object);
            var flags     = -1;
            var value     = 100M;

            // Act
            var result = formatter.Serialize <decimal>(value, out flags);

            // Assert
            Assert.Equal((int)TypeCode.Decimal, flags);
            Assert.NotNull(result.Array);
            Assert.Equal(DecimalHelper.GetBytes(value), result.Array);
        }
Esempio n. 22
0
        /// <summary>Attempts to add a <see cref="FuelTransaction"/> to the database.</summary>
        /// <returns>Returns true if successfully added</returns>
        private async Task <bool> ModifyTransaction()
        {
            ModifiedTransaction = new FuelTransaction(UnmodifiedTransaction.TranscationID,
                                                      UnmodifiedTransaction.VehicleID, DateTimeHelper.Parse(TransactionDate.SelectedDate), TxtStore.Text,
                                                      Int32Helper.Parse(TxtOctane.Text), DecimalHelper.Parse(TxtDistance.Text),
                                                      DecimalHelper.Parse(TxtGallons.Text), DecimalHelper.Parse(TxtPrice.Text),
                                                      DecimalHelper.Parse(TxtOdometer.Text), Int32Helper.Parse(TxtRange.Text));

            if (await AppState.DatabaseInteraction.ModifyTransaction(UnmodifiedTransaction, ModifiedTransaction))
            {
                CurrentVehicle.ModifyTransaction(UnmodifiedTransaction, ModifiedTransaction);
                return(true);
            }
            return(false);
        }
Esempio n. 23
0
        public Life(IClassDefinition classInfo, CharacterClass classData)
        {
            var baseAmt = (classInfo.ClassType == ClassTypeEnum.Sorceress ? 45 : 55);

            BasicAmount = classData.HP + classInfo.Level * 1;
            BonusAmount = classInfo.AngelicPower * 4;
            TotalAmount = CalculateAmount(classInfo);
            var regenCoeff = DecimalHelper.RoundToDecimals(Math.Pow(Convert.ToDouble(1.05), classInfo.Level / 2), 3);

            BasicRegen = Math.Round(0.024m * classData.HPRegen, 3);
            var ratio = Math.Round((decimal)BonusAmount / classData.HP, 3);

            BonusRegen = Math.Round(regenCoeff * ratio, 2);
            TotalRegen = CalculateRegen(classInfo);
        }
Esempio n. 24
0
        //通知信息
        public override void ProcessNotify()
        {
            WxPayData notifyData = GetNotifyData();

            Log4netHelper.Get(KeyModel.Log.PayNotification).AsyncWriter(notifyData.ToJson());

            //检查支付结果中transaction_id是否存在
            if (!notifyData.IsSet("transaction_id"))
            {
                //若transaction_id不存在,则立即返回结果给微信支付后台
                WxPayData res = new WxPayData();
                res.SetValue("return_code", "FAIL");
                res.SetValue("return_msg", "支付结果中微信订单号不存在");
                context.Response.Write(res.ToXml());
                context.Response.End();
            }

            string  transaction_id   = notifyData.GetValue("transaction_id").ToString();
            string  tradeNo          = StringHelper.Get(notifyData.GetValue("out_trade_no"));
            decimal moneyValue       = DecimalHelper.Get(notifyData.GetValue("total_fee")) / 100;
            string  rechrageRecordId = "";


            bool isFunction = false;

            if (QueryOrder(transaction_id))
            {
                //执执判断是否执行成功
                isFunction = fun(tradeNo, moneyValue, rechrageRecordId);
            }

            if (!isFunction)
            {
                WxPayData res = new WxPayData();
                res.SetValue("return_code", "SUCCESS");
                res.SetValue("return_msg", "OK");
                context.Response.Write(res.ToXml());
                context.Response.End();
            }
            else
            {
                WxPayData res = new WxPayData();
                res.SetValue("return_code", "FAIL");
                res.SetValue("return_msg", "订单查询失败");
                context.Response.Write(res.ToXml());
                context.Response.End();
            }
        }
Esempio n. 25
0
        public Stamina(IClassDefinition classInfo, CharacterClass classData)
        {
            var baseAmt = classInfo.ClassType == ClassTypeEnum.Druid ? 60 : classInfo.ClassType == ClassTypeEnum.Barbarian ? 50 : 35;

            BasicAmount = classData.Stamina + classInfo.Level * 1;
            BonusAmount = classInfo.AncestralPower * 4;
            TotalAmount = CalculateAmount(classInfo);
            var regenCoeff = DecimalHelper.RoundToDecimals(Math.Pow(Convert.ToDouble(1.05), classInfo.Level / 2), 3);
            var classCoeff = Math.Round((classInfo.ClassType == ClassTypeEnum.Druid ? 0.050m : 0.040m) * baseAmt, 3);

            BasicRegen = Math.Round(classCoeff * classData.StaminaRegen, 3);
            var ratio = Math.Round((decimal)BonusAmount / classData.Stamina, 3);

            BonusRegen = Math.Round(regenCoeff * ratio, 2);
            TotalRegen = CalculateRegen(classInfo);
        }
        public static decimal queryAddrBalance(string mongodbConnStr, string mongodbDatabase, string coll, string address, string reghash)
        {
            var client     = new MongoClient(mongodbConnStr);
            var database   = client.GetDatabase(mongodbDatabase);
            var collection = database.GetCollection <BsonDocument>(coll);

            var query = collection.Find(BsonDocument.Parse(new JObject()
            {
                { "address", address }, { "register", reghash }
            }.ToString())).ToList();

            if (query != null && query.Count > 0)
            {
                return(decimal.Parse(DecimalHelper.formatDecimal(query[0]["balance"].ToString()), System.Globalization.NumberStyles.Float));
            }
            return(0);
        }
Esempio n. 27
0
        public static void TestRelated()
        {
            var i = Bridge.JSON.Deserialize <int>("25");

            Assert.AreEqual(25, i, "Bridge544 int");

            var dbl = Bridge.JSON.Deserialize <double>("26.1");

            Assert.AreEqual(26.1d, dbl, "Bridge544 double");

            var d = Bridge.JSON.Deserialize <decimal>("27.2");

            DecimalHelper.AssertIsDecimalAndEqualTo(d, 27.2, "Bridge544 decimal");

            var s = JSON.Deserialize <string>("\"Some string\"");

            Assert.AreEqual("Some string", s, "Bridge544 string");
        }
Esempio n. 28
0
        /// <summary>Calls conversion methods based on currently selected conversion type.</summary>
        private void Convert()
        {
            switch (EnumHelper.Parse <Types>(CmbConversionType.SelectedItem.ToString()))
            {
            case Types.Mass:
                TxtConvertTo.Text = TxtConvertFrom.Text.Length > 0 ? Math.Round(decimal.Multiply(DecimalHelper.Parse(TxtConvertFrom.Text), ConvertMass(EnumHelper.Parse <Mass>(CmbConvertFrom.SelectedItem.ToString()), EnumHelper.Parse <Mass>(CmbConvertTo.SelectedItem.ToString()))), 9, MidpointRounding.AwayFromZero).ToString() : "0";
                break;

            case Types.Volume:
                TxtConvertTo.Text = TxtConvertFrom.Text.Length > 0 ? Math.Round(decimal.Multiply(DecimalHelper.Parse(TxtConvertFrom.Text), ConvertVolume(EnumHelper.Parse <Volume>(CmbConvertFrom.SelectedItem.ToString().Replace(" ", "")), EnumHelper.Parse <Volume>(CmbConvertTo.SelectedItem.ToString().Replace(" ", "")))), 9, MidpointRounding.AwayFromZero).ToString() : "0";
                break;

            case Types.Distance:
                TxtConvertTo.Text = TxtConvertFrom.Text.Length > 0 ?
                                    Math.Round(decimal.Multiply(DecimalHelper.Parse(TxtConvertFrom.Text), ConvertDistance(EnumHelper.Parse <Distance>(CmbConvertFrom.SelectedItem.ToString()), EnumHelper.Parse <Distance>(CmbConvertTo.SelectedItem.ToString()))), 9, MidpointRounding.AwayFromZero).ToString() : "0";
                break;
            }
        }
Esempio n. 29
0
        public static void TestRelated()
        {
            var i = JSON.Parse <int>("25");

            Assert.AreEqual(i, 25, "Bridge544 int");

            var dbl = JSON.Parse <double>("26.1");

            Assert.AreEqual(dbl, 26.1d, "Bridge544 double");

            var d = JSON.Parse <decimal>("27.2");

            DecimalHelper.AssertIsDecimalAndEqualTo(d, 27.2, "Bridge544 decimal");

            var s = JSON.Parse <string>("\"Some string\"");

            Assert.AreEqual(s, "Some string", "Bridge544 string");
        }
Esempio n. 30
0
        public bool SaveData()
        {
            var result = false;

            using (var ctx = new EF6.RT2020Entities())
            {
                var item = ctx.Product.Where(x => x.ProductId == _ProductId).FirstOrDefault();
                if (item != null)
                {
                    item.AlternateItem = txtVendorItemNum.Text.Trim();
                    item.ReorderLevel  = DecimalHelper.StringToDecimal(txtReorderLevel.Text);
                    item.ReorderQty    = DecimalHelper.StringToDecimal(txtReorderQuantity.Text);

                    ctx.SaveChanges();
                }
            }

            return(result);
        }