private void toolStripButton1_Click(object sender, EventArgs e) { CreateRequest newMdiChild = new CreateRequest(); ShowChildForm(newMdiChild); }
private void RequestList_CellContentClick(object sender, DataGridViewCellEventArgs e) { RowNum = e.RowIndex; ColNum = e.ColumnIndex; if (e.ColumnIndex == columnChange) //нажато "изменить" { int kol = e.RowIndex; try { //Далее идет открытие формы "Создание заявки" с заданными полями int driver_id = 0; string str = RequestList.Rows[kol].Cells[2].Value.ToString(); if (RequestList.Rows[kol].Cells[2].Value.ToString() != "") { driver_id = Convert.ToInt32(RequestList.Rows[kol].Cells[2].Value); } else { driver_id = 2; } CreateRequest newMdiChild = new CreateRequest( Convert.ToInt32(RequestList.Rows[kol].Cells[0].Value), driver_id, Convert.ToInt32(RequestList.Rows[kol].Cells[5].Value), RequestList.Rows[kol].Cells[7].Value.ToString(), RequestList.Rows[kol].Cells[8].Value.ToString(), RequestList.Rows[kol].Cells[9].Value.ToString(), RequestList.Rows[kol].Cells[10].Value.ToString(), RequestList.Rows[kol].Cells[11].Value.ToString(), RequestList.Rows[kol].Cells[12].Value.ToString(), RequestList.Rows[kol].Cells[13].Value.ToString(), RequestList.Rows[kol].Cells[6].Value.ToString()); newMdiChild.ShowDialog(); RefreshGrid(); } catch (System.Exception ex) { MessageBox.Show("Update failed: " + ex.Message); } } if (e.ColumnIndex == columnEnding) //нажато "Выполнить" { try { var result = MessageBox.Show("Заявка выполнена?", "Внимание", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { RequestList.Rows[RowNum].Cells[columnStatus].Value = 3; this.Validate(); this.zAYAVKABindingSource.EndEdit(); RefreshGrid(); } } catch (Exception ex) { MessageBox.Show("Ended failed: " + ex.Message); } } }