//Обновление информации в TabPages private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) { TabControl control = (sender as TabControl); if (control.SelectedTab.Text == "Все категории") { string[] Cat = Shop.GetCategoryes(); dataGridView3.Rows.Clear(); foreach (string s in Cat) { DataGridViewRow row = new DataGridViewRow(); DataGridViewCell cel = new DataGridViewTextBoxCell(); cel.Value = s; row.Cells.Add(cel); dataGridView3.Rows.Add(row); } } else if (control.SelectedTab.Text == "Все товары") { Good[] goods = Shop.GetAllGoods(); dgvAllGoods.Rows.Clear(); foreach (Good g in goods) { DataGridViewRow row = new DataGridViewRow(); DataGridViewCell cel = new DataGridViewTextBoxCell(); cel.Value = g.Barcode; row.Cells.Add(cel); cel = new DataGridViewTextBoxCell(); cel.Value = g.Name; row.Cells.Add(cel); dgvAllGoods.Rows.Add(row); } } else if (control.SelectedTab.Text == "Товаров на складе") { Good[] goods = Shop.GetGoodsBalance(); dgvBalance.Rows.Clear(); foreach (Good g in goods) { DataGridViewRow row = new DataGridViewRow(); DataGridViewCell cel = new DataGridViewTextBoxCell(); cel.Value = g.Barcode; row.Cells.Add(cel); cel = new DataGridViewTextBoxCell(); cel.Value = g.Name; row.Cells.Add(cel); cel = new DataGridViewTextBoxCell(); cel.Value = g.Category; row.Cells.Add(cel); cel = new DataGridViewTextBoxCell(); cel.Value = g.Count; row.Cells.Add(cel); cel = new DataGridViewTextBoxCell(); cel.Value = g.PriceOut; row.Cells.Add(cel); dgvBalance.Rows.Add(row); } } else if (control.SelectedTab.Text == "Добавленные сегодня") { Good[] goods = Shop.GetGoodsToDay(); dgvChangeInserted.Rows.Clear(); foreach (Good g in goods) { DataGridViewRow row = new DataGridViewRow(); DataGridViewCell cel = new DataGridViewTextBoxCell(); cel.Value = g.Barcode; row.Cells.Add(cel); cel = new DataGridViewTextBoxCell(); cel.Value = g.Name; row.Cells.Add(cel); cel = new DataGridViewTextBoxCell(); cel.Value = g.Category; row.Cells.Add(cel); cel = new DataGridViewTextBoxCell(); cel.Value = g.Count; row.Cells.Add(cel); cel = new DataGridViewTextBoxCell(); cel.Value = g.PriceIn; row.Cells.Add(cel); row.Tag = g.idWare; dgvChangeInserted.Rows.Add(row); } } }