private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex != -1 && e.ColumnIndex != -1) { Service.Model.YY_DATA_MANUAL model = new Service.Model.YY_DATA_MANUAL(); model.STCD = dataGridView1.Rows[e.RowIndex].Cells["Column1"].Value.ToString(); model.TM = (DateTime)dataGridView1.Rows[e.RowIndex].Cells["Column6"].Value; model.DATAVALUE = dataGridView1.Rows[e.RowIndex].Cells["Column4"].Value.ToString(); model.DOWNDATE = (DateTime)dataGridView1.Rows[e.RowIndex].Cells["Column7"].Value; model.NFOINDEX = 5; string Where = "where stcd='" + model.STCD + "' and TM='" + model.TM.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'"; if (dataGridView1.Columns[e.ColumnIndex].HeaderText == "删 除") { bool b = PublicBD.db.DelImg(Where); if (b) { Search(); DevComponents.DotNetBar.MessageBoxEx.Show("数据删除成功!", "[提示]", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { DevComponents.DotNetBar.MessageBoxEx.Show("数据删除失败!", "[提示]", MessageBoxButtons.OK, MessageBoxIcon.Information); } } if (dataGridView1.Columns[e.ColumnIndex].HeaderText == "查 看") { string STCD = dataGridView1.Rows[e.RowIndex].Cells["Column1"].Value.ToString(); DateTime TM = DateTime.Parse(dataGridView1.Rows[e.RowIndex].Cells["Column6"].Value.ToString()); List <Service.Model.YY_DATA_IMG> list = PublicBD.db.GetImg(STCD, TM).ToList <Service.Model.YY_DATA_IMG>(); if (list.Count > 0) { byte[] bt = list.First().DATAVALUE; if (bt != null && bt.Length > 0) { string Path = CreateImage(STCD, TM.ToString(), bt); System.Diagnostics.Process.Start(Path); } else { DevComponents.DotNetBar.MessageBoxEx.Show("图片内容为空!", "[提示]", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } } }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex != -1 && e.ColumnIndex != -1) { Service.Model.YY_DATA_MANUAL model = new Service.Model.YY_DATA_MANUAL(); model.STCD = dataGridView1.Rows[e.RowIndex].Cells["Column1"].Value.ToString(); model.TM = (DateTime)dataGridView1.Rows[e.RowIndex].Cells["Column5"].Value; model.DATAVALUE = dataGridView1.Rows[e.RowIndex].Cells["Column4"].Value.ToString(); model.DOWNDATE = DateTime.Now; model.NFOINDEX = 5; string Where = "where stcd='" + model.STCD + "' and TM='" + model.TM.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'"; if (dataGridView1.Columns[e.ColumnIndex].HeaderText == "删 除") { bool b = PublicBD.db.DelManualData(Where); if (b) { Search(); DevComponents.DotNetBar.MessageBoxEx.Show("数据删除成功!", "[提示]", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { DevComponents.DotNetBar.MessageBoxEx.Show("数据删除失败!", "[提示]", MessageBoxButtons.OK, MessageBoxIcon.Information); } } if (dataGridView1.Columns[e.ColumnIndex].HeaderText == "更 新") { bool b = PublicBD.db.UdpManualData(model, Where); if (b) { Search(); DevComponents.DotNetBar.MessageBoxEx.Show("数据更新成功!", "[提示]", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { DevComponents.DotNetBar.MessageBoxEx.Show("数据更新失败!", "[提示]", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }