private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { Form frm = Application.OpenForms["UpdateWorkOrder"]; if (frm == null) { UpdateWorkOrder updateWorkOrder = new UpdateWorkOrder(this); var selectRow = dataGridView1.CurrentCell.RowIndex; updateWorkOrder.idIndex = int.Parse(dataGridView1.CurrentRow.Cells[0].Value.ToString()); updateWorkOrder.txtName = dataGridView1.CurrentRow.Cells[1].Value.ToString(); updateWorkOrder.txtDesc = dataGridView1.CurrentRow.Cells[2].Value.ToString(); updateWorkOrder.startDate = DateTime.Parse(dataGridView1.CurrentRow.Cells[3].Value.ToString()); updateWorkOrder.finishDate = DateTime.Parse(dataGridView1.CurrentRow.Cells[4].Value.ToString()); updateWorkOrder.ManDay = double.Parse(dataGridView1.CurrentRow.Cells[6].Value.ToString()); if (dataGridView1.CurrentRow.Cells[5].Value != null) { updateWorkOrder.expiredDate = DateTime.Parse(dataGridView1.CurrentRow.Cells[5].Value.ToString()); } else { updateWorkOrder.expiredDate = null; } updateWorkOrder.Show(); } } catch (Exception) { MessageBox.Show("Bir Hata Oluştu!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } GC.Collect(); GC.WaitForPendingFinalizers(); }
private void btnUpdateWorkOrder_Click(object sender, EventArgs e) { Form frm = Application.OpenForms["UpdateWorkOrder"]; try { if (frm == null) { if (workOrders.Count > 0) { UpdateWorkOrder updateWorkOrder = new UpdateWorkOrder(this); var selectRow = dataGridView1.SelectedRows[0].Index; updateWorkOrder.idIndex = int.Parse(dataGridView1.CurrentRow.Cells[0].Value.ToString()); updateWorkOrder.txtName = dataGridView1.CurrentRow.Cells[1].Value.ToString(); updateWorkOrder.txtDesc = dataGridView1.CurrentRow.Cells[2].Value.ToString(); updateWorkOrder.startDate = DateTime.Parse(dataGridView1.CurrentRow.Cells[3].Value.ToString()); updateWorkOrder.finishDate = DateTime.Parse(dataGridView1.CurrentRow.Cells[4].Value.ToString()); updateWorkOrder.ManDay = double.Parse(dataGridView1.CurrentRow.Cells[6].Value.ToString()); if (dataGridView1.CurrentRow.Cells[5].Value != null) { updateWorkOrder.expiredDate = DateTime.Parse(dataGridView1.CurrentRow.Cells[5].Value.ToString()); } else { updateWorkOrder.expiredDate = null; } updateWorkOrder.Show(); } else { MessageBox.Show("Lütfen İş Emri Girişi Yapın !", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception) { MessageBox.Show("Bir Hata Oluştu! Lütfen İş Emri Seçtiğinize Emin Olun", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } //Form frm = Application.OpenForms["UpdateWorkOrder"]; //if (frm == null) //{ // UpdateWorkOrder updateWorkOrder = new UpdateWorkOrder(this); // //updateWorkOrder.workOrders.AddRange(workOrders); // updateWorkOrder.Name = dataGridView1.CurrentRow.Cells[1].Value.ToString(); // updateWorkOrder.Show(); //} //dataGridView1.CellDoubleClick(object sender); GC.Collect(); GC.WaitForPendingFinalizers(); }