private void infolist_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 5) { if (Program.SystemMode == 1) { frs.addCropAndPest(count, infolist.CurrentRow.Cells[3].Value.ToString(), infolist.CurrentRow.Cells[4].Value.ToString()); frs.Hide(); frs.setfocus(); frs.Show(); Hide(); } else { frsm.addCropAndPest(count, infolist.CurrentRow.Cells[3].Value.ToString(), infolist.CurrentRow.Cells[4].Value.ToString()); frsm.Hide(); frsm.setfocus(); frsm.Show(); Hide(); } } }
private void infolist_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } if (e.ColumnIndex == 2) { string[] strWhereParameterArray = new string[5] { _pesticideId, _formCode, _content, infolist.CurrentRow.Cells["cropId"].Value.ToString(), infolist.CurrentRow.Cells["pestId"].Value.ToString() }; if (((DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "*", "HyScope", " pesticideId = {0} AND formCode = {1} AND contents = {2} AND cropId = {3} AND pestId = {4} AND isDelete in ('N','') ", "", null, strWhereParameterArray, CommandOperationType.ExecuteReaderReturnDataTable)).Rows.Count > 0) { if (Program.SystemMode == 1) { frs.addCropAndPest(count, infolist.CurrentRow.Cells["cropId"].Value.ToString(), infolist.CurrentRow.Cells["pestId"].Value.ToString()); frs.Hide(); frs.setfocus(); frs.Show(); Hide(); } else { frsm.addCropAndPest(count, infolist.CurrentRow.Cells["cropId"].Value.ToString(), infolist.CurrentRow.Cells["pestId"].Value.ToString()); frsm.Hide(); frsm.setfocus(); frsm.Show(); Hide(); } } else { MessageBox.Show(string.Format("此配對已不存在,請選擇其他配對。此配對將自您的常用配對紀錄中移除。", Application.ProductName), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); try { string[] strParameterArray = new string[3] { barcodeid, infolist.CurrentRow.Cells["cropId"].Value.ToString(), infolist.CurrentRow.Cells["pestId"].Value.ToString() }; string sql = " DELETE FROM hypos_user_pair WHERE barcode = {0} AND cropId = {1} AND pestId = {2} "; DataBaseUtilities.DBOperation(Program.ConnectionString, sql, strParameterArray, CommandOperationType.ExecuteNonQuery); infolist.Rows.RemoveAt(infolist.CurrentRow.Index); } catch (Exception) { throw; } } } if (e.ColumnIndex == 3) { new dialogMedDescription(_pesticideId, infolist.CurrentRow.Cells["cropId"].Value.ToString(), infolist.CurrentRow.Cells["pestId"].Value.ToString(), _formCode, _content).ShowDialog(); } }