private void поКоличествуВыпускаемыхИзделийToolStripMenuItem_Click(object sender, EventArgs e) { SearshDialog2 sd = new SearshDialog2(); WorkshopQwery(n => n.ListOfTheProductRange.Count == sd.NumberOfWorkers, "Выборка по количеству выпускаемых изделий", sd); }
private void WorkshopQwery(Func <MyWorkshop, bool> predicate, string docName, SearshDialog2 sd) { Blank frm = (Blank)this.ActiveMdiChild; sd.ShowDialog(); MyWorkshop[] works = frm.Workshops; if (sd.NumberOfWorkers != -1) { IEnumerable <MyWorkshop> filteredWorkshops = works.Where(predicate); works = filteredWorkshops.ToArray(); Blank blank = new Blank(); blank.Workshops = works; blank.MdiParent = this; blank.DocName = docName; blank.Text = blank.DocName; blank.Show(); } else { MessageBox.Show("Введены неверные данные"); } }
private void поКоличествуРаботниковToolStripMenuItem_Click(object sender, EventArgs e) { SearshDialog2 sd = new SearshDialog2(); WorkshopQwery(n => n.NumberOfWorkers == sd.NumberOfWorkers, "Выборка по количеству работников", sd); }