private void Button_Click(object sender, RoutedEventArgs e) { try { var countBuy = Convert.ToInt32(this.NewBuyPriceTextBox.Text); var countSell = Convert.ToInt32(this.NewSellPriceTextBox.Text); if (countBuy > 0 && countSell > 0) { var newBuyPrice = Convert.ToDouble(this.NewBuyPriceTextBox.Text); var newSellPrice = Convert.ToDouble(this.NewSellPriceTextBox.Text); var newPrice = new ChangePrice { CurrencyType = (CurrencyType)CurrencyTypeComboBox.SelectedItem, DateTime = DateTime.Now, BuyPrice = newBuyPrice, SellPrice = newSellPrice }; _changingPriceService.Add(newPrice); this.Close(); } else if (countBuy <= 0 || countSell <= 0) { MessageBox.Show(this, $"Can't make new price less than or equal 0.", "Error", MessageBoxButton.OK); NewBuyPriceTextBox.Text = countBuy.ToString(); NewSellPriceTextBox.Text = countSell.ToString(); } } catch (Exception) { MessageBox.Show(this, $"Something goes wrong.", "Error", MessageBoxButton.OK); } }
public async Task <ActionResult> Edit(EditProductViewModel product) { var command = new ChangePrice(product.Id, product.Price); await _productService.ExecuteAsync(command); return(RedirectToAction("Index")); }
public void ChangePrice(ChangePrice cmd) { this.Price = new ProductPrice(cmd.Price, cmd.Discount); this.ModifiedDate = DateTimeOffset.Now; this.ApplyEvent(new ProductPriceChanged(this.Id, this.Price.Price, this.Price.Discount, this.ModifiedDate.Value)); }
async public void ChangePricing() { if (pickPlot.SelectedIndex > -1) { Application.Current.Properties["Counter"] = pickPlot.SelectedIndex; await PopupNavigation.Instance.PushAsync(ChangePrice.GetInstance()); } }
public IActionResult ChangePrice([FromBody] ChangePrice changePrice) { var price = Convert.ToDecimal(changePrice.Price, CultureInfo.CreateSpecificCulture("ru-RU")); _productOperationService.ChangePrice(changePrice.ProductId, price); return(Ok()); }
public PriceChangeSerializeAction(IStockRestClient stockRestClient, ChangePrice changePrice, bool isRegularPriceChange) : base("PriceChange") { _stockRestClient = stockRestClient; _changePrice = changePrice; _isRegularPriceChange = isRegularPriceChange; }
public async Task <StockPrice> EditPrice(ChangePrice stockModel, bool isRegularPriceChange) { var action = new PriceChangeSerializeAction(_stockRestClient, stockModel, isRegularPriceChange); await PerformTask(action); var stockPrice = (StockPriceContract)action.ResponseValue; return(new Mapper().MapStockPrice(stockPrice)); }
// изменить статус зала private void CSbtn_Click(object sender, EventArgs e) { Form frm = new ChangePrice(); frm.Show(); Course customer = new Course(); List <string> list = new List <string>(); list = customer.getCoursePrice(); CorseList.DataSource = list; }
public string ChangePriceindb(ChangePrice obj) { using (HttpClient client = new HttpClient()) { string stringData = JsonConvert.SerializeObject(obj); var contentData = new StringContent(stringData, System.Text.Encoding.UTF8, "application/json"); HttpResponseMessage response = client.PostAsync(webapiurl + "/Admin/UpdatePrice", contentData).Result; var list = response.Content.ReadAsStringAsync().Result; return(list); } }
public void ChangePrice(decimal price, decimal discount, decimal finalPrice) { var product = this.GetProduct(price: price, discount: discount); var cmd = new ChangePrice(price, discount); product.ChangePrice(cmd); product.Price.Price.Should().Be(price); product.Price.Discount.Should().Be(discount); product.FinalPrice.Should().Be(finalPrice); product.ModifiedDate?.ToString("yyyyMMdd").Should().Be(DateTimeOffset.Now.ToString("yyyyMMdd")); }
public ActionResult ChangePrice(ChangePrice obj) { var res = ChangePricemethod(obj); if (res.Contains("Successfully")) { ViewBag.Message = res; ViewBag.Screen = DropDown.ScreenList(); ViewBag.Class = DropDown.Classid(); } return(View("AdminUserPage")); }
public static void Setup(TestContext ctx) { RefreshDatabase(); var addProduct = new AddProduct("Name", "Description", new decimal(1.99)); var sut = new ProductService(new EntityFrameworkRepository(DbContext), new EntityFrameworkProductLocator(DbContext)); sut.Execute(addProduct); var productId = DbContext.Products.Single().Id; var changePrice = new ChangePrice(productId, new decimal(29.99)); sut.Execute(changePrice); }
private async Task PriceChangeAsync() { if (IsAllFieldsEntered()) { if (SelectedPriceIndex >= 0 && !(StockPriceModel?.SpecialPriceTypes.ElementAt(SelectedPriceIndex)).Equals(ApplicationConstants.RegularPriceText)) { var ChangePrice = new ChangePrice() { Fromdate = StockPriceModel.FromDate.ToString("MM/dd/yyyy", CultureInfo.InvariantCulture), Todate = StockPriceModel.ToDate.ToString("MM/dd/yyyy", CultureInfo.InvariantCulture), StockCode = StockCode, RegisterNumber = CacheBusinessLogic.RegisterNumber, TillNumber = CacheBusinessLogic.TillNumber, SaleNumber = CacheBusinessLogic.SaleNumber, RegularPrice = decimal.Parse(StockPriceModel.RegularPriceText, CultureInfo.InvariantCulture), IsEndDate = StockPriceModel.IsEndDateChecked, PerDollarChecked = PriceUnits.ElementAt(_selectedPriceUnitIndex).Equals("$"), PriceType = StockPriceModel?.SpecialPriceTypes.ElementAt(SelectedPriceIndex), GridPricesContract = GetGridPrices() }; var response = await _stockBussinessLogic.EditPrice(ChangePrice, false); WriteToLineDisplay(response.LineDisplay); MapStockPriceModel(response); EditPrice(false); } else { var ChangePrice = new ChangePrice() { StockCode = StockCode, RegisterNumber = CacheBusinessLogic.RegisterNumber, TillNumber = CacheBusinessLogic.TillNumber, SaleNumber = CacheBusinessLogic.SaleNumber, RegularPrice = decimal.Parse(StockPriceModel.RegularPriceText, CultureInfo.InvariantCulture) }; var response = await _stockBussinessLogic.EditPrice(ChangePrice, true); WriteToLineDisplay(response.LineDisplay); MapStockPriceModel(response); EditPrice(false); } } }
public HttpResponseMessage UpdatePrice(ChangePrice obj) { bool status = false; status = objReg.updateAmount(obj); if (status == true) { var showmessage = "Updated Successfully."; return(Request.CreateResponse(HttpStatusCode.OK, showmessage)); } else { var showmessage = "Fail Please try again."; return(Request.CreateResponse(HttpStatusCode.BadRequest, showmessage)); } }
/// <summary> /// 修改价格 /// </summary> public void ChangePrices() { if (this.ChangePrice == "") { this.ChangePrice = "0"; } else { double price = 0; if (!double.TryParse(ChangePrice, out price)) { this.ChangePrice = "0"; } if (!ChangePrice.EndsWith(".")) { this.ChangePrice = Math.Round(price, 2).ToString(); } } }
private async Task Change_Clicked(EventArgs e) { string name = PriceList.SelectedItem.ToString(); for (int x = 0; x < PriceArray.Length; x++) { if (PriceArray.Cast <string>().ToList().ElementAt(x) == name) { select2 = x; } } MessagingCenter.Subscribe <ChangePrice>(this, "Change", async(sender) => { PopList(pickPrice.SelectedIndex); Pricetitle.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Pricings") + " :" + AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Saved"); SaveAll.GetInstance().SavePricing(); await Task.Delay(5000); Pricetitle.Text = AppResource.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true).GetString("Pricings"); }); Application.Current.Properties["Priceholder"] = (pickPrice.SelectedIndex, select2); await PopupNavigation.Instance.PushAsync(ChangePrice.GetInstance()); }
public void Add(ChangePrice changePrice) { _repo.Add(changePrice); }
public void Add(ChangePrice changePrice) { _db.ChangingPrices.Add(changePrice); SaveChanges(); }
public async Task <StockPrice> EditPrice(ChangePrice stockModel, bool isRegularPriceChange) { return(await _serializeManager.EditPrice(stockModel, isRegularPriceChange)); }
public string ChangePricemethod(ChangePrice obj) { return(HttpCalls.Httpclientcall(obj, "Admin", "UpdatePrice")); }
private void OnChangePrice(object sender, StockInfoEventArgs e) { ChangePrice?.Invoke(sender, e); }
private void CPbtn_Click(object sender, EventArgs e) { Form frm = new ChangePrice(); frm.Show(); }