public void CurrentChanged(ExcludeDto exclude) { _currentExclude = exclude; Action(s => { var data = s.GetExcludeData(exclude.Id); ProducerSynonyms = data.Synonyms; Producers = data.Producers; }); }
public void AddToAssortment(ExcludeDto current) { var view = new AddToAssortmentView(current, ShowProducers.producers); if (view.ShowDialog() == DialogResult.OK) { Refresh(); } }
public void DeleteSynonym(ExcludeDto current) { if (String.IsNullOrEmpty(current.OriginalSynonym) && current.OriginalSynonymId == 0) { MessageBox.Show("Для выбранного исключения не задано оригинальное наименование", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Action(s => s.DeleteSynonym(current.OriginalSynonymId)); Refresh(); }
public AddToAssortmentView(ExcludeDto exclude, List <ProducerDto> producers) { Text = "Добавление в ассортимент"; Width = 400; Height = 500; var accept = ((Button)AcceptButton); accept.Text = "Добавить"; AcceptButton = null; var createEquivalent = new CheckBox { AutoSize = true, Text = "Создать новый эквивалент?", Checked = true }; table.Controls.Add(createEquivalent, 0, 0); var equivalent = new TextBox { Width = 200, Text = exclude.ProducerSynonym }; table.Controls.Add(equivalent, 1, 0); table.Controls.Add(new Label { Text = "Выберете производителя", AutoSize = true, }, 0, 1); var searcher = new ProducerSearcher(producers); Shown += (s, a) => searcher.SearchText.Focus(); table.Controls.Add(searcher.ToolStrip, 0, 2); table.Controls.Add(searcher.Table.Host, 0, 3); accept.InputMap().Click(() => Add(searcher.Table.Selected <ProducerDto>(), equivalent.Text, createEquivalent.Checked, exclude)); searcher.Table.Host.InputMap().KeyDown(Keys.Enter, () => Add(searcher.Table.Selected <ProducerDto>(), equivalent.Text, createEquivalent.Checked, exclude)); }
public void Add(ProducerDto producer, string equivalent, bool createEquivalent, ExcludeDto exclude) { Action(s => { if (!createEquivalent) { equivalent = null; } if (!s.CheckProductIsMonobrend(exclude.Id, producer.Id)) { s.AddToAssotrment(exclude.Id, producer.Id, equivalent); } else { MessageBox.Show("Товар помечен как \"Монобренд\", добавление к нему нового поставщика возможно только при снятии этой отметки.", "Невозможно добавить поставщика"); } }); }
public void MistakenExclude(ExcludeDto current) { Action(s => { s.DeleteExclude(current.Id); }); Refresh(); }
public void DoNotShow(ExcludeDto current) { Action(s => s.DoNotShow(current.Id)); Refresh(); }