private void buttonWorkAdd_Click(object sender, EventArgs e) { var Form = new WorkEntityForm(); Form.sf = this; Form.StaffId = Int32.Parse(dataGridViewStaff.SelectedCells[0].Value.ToString()); Form.Show(); }
private void buttonWorkEdit_Click(object sender, EventArgs e) { try { var wDate = dataGridViewWork.SelectedCells[0].Value.ToString(); var wHours = dataGridViewWork.SelectedCells[1].Value.ToString(); if (String.IsNullOrEmpty(wDate) && String.IsNullOrEmpty(wHours)) { throw new Exception("Не выбрана работа"); } var Form = new WorkEntityForm(); Form.StaffId = Int32.Parse(dataGridViewStaff.SelectedCells[0].Value.ToString()); Form.Date = Convert.ToDateTime(wDate); Form.Hours = Convert.ToInt32(wHours); Form.sf = this; Form.Show(); } catch (Exception gg) { MessageBox.Show(gg.Message, "SWA", MessageBoxButtons.OK, MessageBoxIcon.Error); } }