public ChangingPricePage() { InitializeComponent(); _changingPriceService = new ChangingPriceService(); CurrencyTypeComboBox.Items.Add(CurrencyType.EUR); CurrencyTypeComboBox.Items.Add(CurrencyType.USD); CurrencyTypeComboBox.Items.Add(CurrencyType.RUB); CurrencyTypeComboBox.SelectedItem = CurrencyType.USD; oldBuyPriceLabel.Content = "Old buy price: " + _changingPriceService.GetLastChangingBuyPriceByCurrencyType((CurrencyType)CurrencyTypeComboBox.SelectedItem) + " BYN"; oldSellPriceLabel.Content = "Old sell price: " + _changingPriceService.GetLastChangingSellPriceByCurrencyType((CurrencyType)CurrencyTypeComboBox.SelectedItem) + " BYN"; }
public BuySellPage(OperationType type) { InitializeComponent(); _type = type; _changingPriceService = new ChangingPriceService(); _receiptService = new ReceiptService(); buyPrice = Convert.ToDouble(_changingPriceService.GetLastChangingBuyPriceByCurrencyType(CurrencyType.USD)); sellPrice = Convert.ToDouble(_changingPriceService.GetLastChangingSellPriceByCurrencyType(CurrencyType.USD)); maxCountPerDay = Convert.ToInt32(ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None).AppSettings.Settings["MaxCurrencyCountPerDay"].Value); CurrencyTypeComboBox.Items.Add(CurrencyType.EUR); CurrencyTypeComboBox.Items.Add(CurrencyType.USD); CurrencyTypeComboBox.Items.Add(CurrencyType.RUB); CurrencyTypeComboBox.SelectedItem = CurrencyType.USD; this.MainLabel.Content = $"{type} page. Course: {(type == OperationType.BUY ? buyPrice : sellPrice)}"; }
private void CurrencyTypeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { oldBuyPriceLabel.Content = "Old buy price: " + _changingPriceService.GetLastChangingBuyPriceByCurrencyType((CurrencyType)CurrencyTypeComboBox.SelectedItem) + " BYN"; oldSellPriceLabel.Content = "Old sell price: " + _changingPriceService.GetLastChangingSellPriceByCurrencyType((CurrencyType)CurrencyTypeComboBox.SelectedItem) + " BYN"; }
private void CurrencyTypeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { buyPrice = Convert.ToDouble(_changingPriceService.GetLastChangingBuyPriceByCurrencyType((CurrencyType)CurrencyTypeComboBox.SelectedItem)); sellPrice = Convert.ToDouble(_changingPriceService.GetLastChangingSellPriceByCurrencyType((CurrencyType)CurrencyTypeComboBox.SelectedItem)); this.MainLabel.Content = $"{_type} page. Course: {(_type == OperationType.BUY ? buyPrice : sellPrice)}"; }