private void buttonWithAccessLevel12_Click(object sender, EventArgs e) { if (listBox1.SelectedIndex != -1) { int sqIndex = (int)listBox1.SelectedValue; SquadAddEditForm sae = new SquadAddEditForm(((DataRowView)listBox1.SelectedItem).Row["name"].ToString(), data: dataSet1.Tables["squad"].Select("id=" + sqIndex.ToString())[0].ItemArray, buttonCaption: "Редактировать"); if (sae.ShowDialog() == System.Windows.Forms.DialogResult.OK) { dataSet1.Tables["squad"].Select("id=" + sqIndex.ToString())[0].ItemArray = sae.Result; if (postgreConnection.UpdateDB("squad", dataSet1, 2)) ChangeSelectedSquad(sqIndex); listBox1.Refresh(); } } }
private void изменитьОтрядToolStripMenuItem_Click(object sender, EventArgs e) { SquadAddEditForm saef = new SquadAddEditForm("Редактировать отряд", data: dataSet1.Tables["squad"].Select("id=" + (int)dataGridView1.SelectedRows[0].Cells["id"].Value)[0].ItemArray, buttonCaption: "Редактировать"); if(saef.ShowDialog()==DialogResult.OK) { dataSet1.Tables["squad"].Select("id=" + (int)dataGridView1.SelectedRows[0].Cells["id"].Value)[0].ItemArray = saef.Result; if (postgreConnection.UpdateDB("squad", dataSet1, 2)) DrawData(); } }
private void buttonWithAccessLevel11_Click(object sender, EventArgs e) { SquadAddEditForm sae = new SquadAddEditForm("Добавить отряд"); if(sae.ShowDialog() == System.Windows.Forms.DialogResult.OK) { dataSet1.Tables["squad"].Rows.Add(sae.Result); postgreConnection.UpdateDB("squad", dataSet1, 1); } }
private void menuItemWithAccessLevel15_Click(object sender, EventArgs e) { SquadAddEditForm saef = new SquadAddEditForm("Добавить отряд"); if (saef.ShowDialog() == DialogResult.OK) { globalDS.Tables["squad"].Rows.Add(saef.Result); postgreConnection.UpdateDB("squad", globalDS, 1); } }