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; namespace Фабрика { public partial class FSpisMaterial : Form { public FSpisMaterial() { InitializeComponent(); } private void FSpisMaterial_Load(object sender, EventArgs e) { // TODO: данная строка кода позволяет загрузить данные в таблицу "dbFabrika2024DataSet.Furnitura". При необходимости она может быть перемещена или удалена. this.furnituraTableAdapter.Fill(this.dbFabrika2024DataSet.Furnitura); // TODO: данная строка кода позволяет загрузить данные в таблицу "dbFabrika2024DataSet.Tkani". При необходимости она может быть перемещена или удалена. this.tkaniTableAdapter.Fill(this.dbFabrika2024DataSet.Tkani); } private void tkaniBindingNavigatorSaveItem_Click(object sender, EventArgs e) { this.Validate(); this.tkaniBindingSource.EndEdit(); this.tableAdapterManager.UpdateAll(this.dbFabrika2024DataSet); } private void BtnSpisMaterial_Click(object sender, EventArgs e) { DialogResult rez = MessageBox.Show("Вы уверены, что нужно выбранные материалы?", "Внимание!", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (rez == DialogResult.No) return; for (int i = 0; i <= DgvTkan.RowCount - 1; i++) { int CountSpis = 0; try { CountSpis = Convert.ToInt32(DgvTkan.Rows[i].Cells[3].Value); } catch { } if (CountSpis == 0) continue; int LengthTkan = Convert.ToInt32(DgvTkan.Rows[i].Cells[2].Value); LengthTkan -= CountSpis; DgvTkan.Rows[i].Cells[2].Value = LengthTkan; } tkaniBindingSource.EndEdit(); this.tkaniTableAdapter.Update(this.dbFabrika2024DataSet.Tkani); for (int i = 0; i <= DgvFurnitura.RowCount - 1; i++) { int CountSpis = 0; try { CountSpis = Convert.ToInt32(DgvFurnitura.Rows[i].Cells[2].Value); } catch { } if (CountSpis == 0) continue; int CountFur = Convert.ToInt32(DgvFurnitura.Rows[i].Cells[1].Value); CountFur -= CountSpis; DgvFurnitura.Rows[i].Cells[1].Value = CountFur; } furnituraBindingSource.EndEdit(); this.furnituraTableAdapter.Update(this.dbFabrika2024DataSet.Furnitura); } private void BtnToExcel_Click(object sender, EventArgs e) { MessageBox.Show("Документ сформирован"); } private void BtnCancel_Click(object sender, EventArgs e) { DialogResult = DialogResult.Cancel; } } }