using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using Excel = Microsoft.Office.Interop.Excel; namespace IS_hairdresser { public partial class Consumables_sold_FORM : Form { public Consumables_sold_FORM() { InitializeComponent(); } private void Consumables_sold_FORM_Load(object sender, EventArgs e) { // TODO: данная строка кода позволяет загрузить данные в таблицу "gushchinaDataSet.Consumables_sold". При необходимости она может быть перемещена или удалена. this.consumables_soldTableAdapter.Fill(this.gushchinaDataSet.Consumables_sold); } private void менюToolStripMenuItem_Click(object sender, EventArgs e) { Form1 frm = new Form1(); this.Close(); frm.Show(); } private void сохранитьToolStripMenuItem_Click(object sender, EventArgs e) { consumables_soldTableAdapter.Update(gushchinaDataSet.Consumables_sold); } private void скачатьToolStripMenuItem_Click(object sender, EventArgs e) { Excel.Application exApp = new Excel.Application(); exApp.Workbooks.Add(); Excel.Worksheet wsh = (Excel.Worksheet)exApp.ActiveSheet; int i, j; wsh.Cells[1, 1] = "Артикул"; wsh.Cells[1, 2] = "Наименование"; wsh.Cells[1, 3] = "Цена"; wsh.Cells[1, 4] = "Количество"; wsh.Cells[1, 5] = "Дата"; wsh.Cells[1, 6] = "Сотрудник"; for (i = 0; i <= dataGridView.RowCount - 2; i++) { for (j = 0; j <= dataGridView.ColumnCount - 1; j++) { wsh.Cells[i + 2, j + 1] = dataGridView[j, i].Value.ToString(); } } exApp.Visible = true; } private void button1_Click(object sender, EventArgs e) { listBindingSource.Filter = "[Артикул] LIKE'" + textBox2.Text + "%'"; } private void button4_Click(object sender, EventArgs e) { listBindingSource.Filter = "[Наименование] LIKE'" + comboBox1.Text + "%'"; } private void button7_Click(object sender, EventArgs e) { listBindingSource.Filter = "[Дата] LIKE'" + textBox5.Text + "%'"; } private void button5_Click(object sender, EventArgs e) { listBindingSource.Filter = "[Сотрудник] LIKE'" + textBox1.Text + "%'"; } private void button8_Click(object sender, EventArgs e) { listBindingSource.Filter = ""; } private void button6_Click(object sender, EventArgs e) { for (int i = 0; i < dataGridView.ColumnCount; i++) for (int j = 0; j < dataGridView.RowCount; j++) { dataGridView[i, j].Style.BackColor = Color.White; dataGridView[i, j].Style.ForeColor = Color.Black; } if (textBox1.Text != "") { for (int i = 0; i < dataGridView.ColumnCount; i++) for (int j = 0; j < dataGridView.RowCount; j++) if (dataGridView[i, j].Value != null) if (dataGridView[i, j].Value.ToString().IndexOf(textBox1.Text) > -1) { dataGridView[i, j].Style.BackColor = Color.Black; dataGridView[i, j].Style.ForeColor = Color.Red; } } if (textBox2.Text != "") { for (int i = 0; i < dataGridView.ColumnCount; i++) for (int j = 0; j < dataGridView.RowCount; j++) if (dataGridView[i, j].Value != null) if (dataGridView[i, j].Value.ToString().IndexOf(textBox2.Text) > -1) { dataGridView[i, j].Style.BackColor = Color.Black; dataGridView[i, j].Style.ForeColor = Color.Red; } } if (comboBox1.Text != "") { for (int i = 0; i < dataGridView.ColumnCount; i++) for (int j = 0; j < dataGridView.RowCount; j++) if (dataGridView[i, j].Value != null) if (dataGridView[i, j].Value.ToString().IndexOf(comboBox1.Text) > -1) { dataGridView[i, j].Style.BackColor = Color.Black; dataGridView[i, j].Style.ForeColor = Color.Red; } } if (textBox3.Text != "") { for (int i = 0; i < dataGridView.ColumnCount; i++) for (int j = 0; j < dataGridView.RowCount; j++) if (dataGridView[i, j].Value != null) if (dataGridView[i, j].Value.ToString().IndexOf(textBox3.Text) > -1) { dataGridView[i, j].Style.BackColor = Color.Black; dataGridView[i, j].Style.ForeColor = Color.Red; } } if (textBox4.Text != "") { for (int i = 0; i < dataGridView.ColumnCount; i++) for (int j = 0; j < dataGridView.RowCount; j++) if (dataGridView[i, j].Value != null) if (dataGridView[i, j].Value.ToString().IndexOf(textBox4.Text) > -1) { dataGridView[i, j].Style.BackColor = Color.Black; dataGridView[i, j].Style.ForeColor = Color.Red; } } if (textBox5.Text != "") { for (int i = 0; i < dataGridView.ColumnCount; i++) for (int j = 0; j < dataGridView.RowCount; j++) if (dataGridView[i, j].Value != null) if (dataGridView[i, j].Value.ToString().IndexOf(textBox5.Text) > -1) { dataGridView[i, j].Style.BackColor = Color.Black; dataGridView[i, j].Style.ForeColor = Color.Red; } } } private void button2_Click(object sender, EventArgs e) { listBindingSource.Filter = "[Количество] LIKE'" + textBox5.Text + "%'"; } private void button3_Click(object sender, EventArgs e) { listBindingSource.Filter = "[Цена] LIKE'" + textBox5.Text + "%'"; } } }