Exemplo n.º 1
0
 public void EditTradePoint(TradePoint tradepoint, string name, string description)
 {
     tradepoint.Name        = name;
     tradepoint.Description = description;
     _logger.Log($"Изменена торговая точка {tradepoint.Name}");
     SerializeData();
 }
 public EditTradePointPage(Methods methods, Category category, TradePoint tradepoint)
 {
     InitializeComponent();
     _methods             = methods;
     _category            = category;
     _tradepoint          = tradepoint;
     comboBox.ItemsSource = _methods.Categories;
     textBoxEditTradePointDescription.Text = _tradepoint.Description;
     textBoxEditTradePointName.Text        = _tradepoint.Name;
 }
Exemplo n.º 3
0
        private void buttonAddTradePointOk_Click(object sender, RoutedEventArgs e)
        {
            int    number;
            double number1;

            if (string.IsNullOrWhiteSpace(textBoxAddTradePointName.Text))
            {
                MessageBox.Show("Введите название!");
                textBoxAddTradePointName.Focus();
                return;
            }
            if ((int.TryParse(textBoxAddTradePointName.Text, out number) == true))
            {
                MessageBox.Show("Данные введены неверно!");
                textBoxAddTradePointName.Focus();
                return;
            }
            if (double.TryParse(textBoxAddTradePointName.Text, out number1) == true)
            {
                MessageBox.Show("Данные введены неверно!");
                textBoxAddTradePointName.Focus();
                return;
            }
            if (string.IsNullOrWhiteSpace(textBoxAddTradePointDescription.Text))
            {
                MessageBox.Show("Введите описание!");
                textBoxAddTradePointDescription.Focus();
                return;
            }
            if ((int.TryParse(textBoxAddTradePointDescription.Text, out number) == true))
            {
                MessageBox.Show("Данные введены неверно!");
                textBoxAddTradePointDescription.Focus();
                return;
            }
            if (double.TryParse(textBoxAddTradePointDescription.Text, out number1) == true)
            {
                MessageBox.Show("Данные введены неверно!");
                textBoxAddTradePointDescription.Focus();
                return;
            }
            if (string.IsNullOrWhiteSpace(comboBox.Text))
            {
                MessageBox.Show("Выберите категорию!");
                comboBox.Focus();
                return;
            }
            if (comboBox.SelectedItem is Category && comboBox.ItemsSource != null)
            {
                TradePoint temp = new TradePoint(textBoxAddTradePointName.Text, textBoxAddTradePointDescription.Text);
                _methods.AddTradePoint(temp, comboBox.SelectedItem as Category);
                NavigationService.Navigate(new AdminPage(_methods, _category));
            }
        }
Exemplo n.º 4
0
 public void DeleteTradePoint(TradePoint tradepoint, Category category)
 {
     category.TradePoints.Remove(tradepoint);
     _logger.Log($"Удалена торговая точка {tradepoint.Name}");
     SerializeData();
 }
Exemplo n.º 5
0
 public void AddTradePoint(TradePoint tradepoint, Category category)
 {
     category.TradePoints.Add(tradepoint);
     _logger.Log($"Добавлена торговая точка {tradepoint.Name}");
     SerializeData();
 }