private void редактироватьToolStripMenuItem4_Click(object sender, EventArgs e) { NewCatrij catrij = new NewCatrij(true, this.CatrijDGW.CurrentRow.Cells[0].Value.ToString(), this.CatrijDGW.CurrentRow.Cells[1].Value.ToString(), this.CatrijDGW.CurrentRow.Cells[2].Value.ToString(), this.CatrijDGW.CurrentRow.Cells[3].Value.ToString(), this.CatrijDGW.CurrentRow.Cells[4].Value.ToString(), this.CatrijDGW.CurrentRow.Cells[5].Value.ToString(), this.CatrijDGW.CurrentRow.Cells[6].Value.ToString(), this.CatrijDGW.CurrentRow.Cells[7].Value.ToString()); if (catrij.ShowDialog() == DialogResult.OK) { this.CatrijDGW.DataSource = this.dal.GetCatrij(this.PrinterDGW.CurrentRow.Cells[0].Value.ToString()); int sum = 0; for (int i = 0; i < this.CatrijDGW.RowCount; i++) { sum += Convert.ToInt32(this.CatrijDGW.Rows[i].Cells[5].Value.ToString()); } this.dal.OtpechatanoStrinichek(Convert.ToInt32(this.PrinterDGW.Rows[index - 1].Cells[0].Value.ToString()), sum); this.PrinterDGW.DataSource = this.dal.GetPrinter(); this.label5.Text = "Отредактировано"; } }
private void добавитьКатриджToolStripMenuItem_Click(object sender, EventArgs e) { NewCatrij catrij = new NewCatrij(); if (catrij.ShowDialog() == DialogResult.OK) { MessageBox.Show("Катридж внесен в базу данных", "Информация", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); this.CatrijDGW.DataSource = this.dal.GetCatrij(this.PrinterDGW.CurrentRow.Cells["ID"].Value.ToString()); int sum = 0; for (int i = 0; i < this.CatrijDGW.RowCount; i++) { sum += Convert.ToInt32(this.CatrijDGW.Rows[i].Cells[5].Value.ToString()); } this.dal.OtpechatanoStrinichek(Convert.ToInt32(this.PrinterDGW.Rows[index - 1].Cells[0].Value.ToString()), sum); this.PrinterDGW.DataSource = this.dal.GetPrinter(); } else { MessageBox.Show("Катридж НЕ внесен в базу данных", "Информация", MessageBoxButtons.OK, MessageBoxIcon.Hand); } }