private void dgv_type_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { //DataGridView dgv_type = (DataGridView)sender; Common.DataGridViewHelper dgv_type = (Common.DataGridViewHelper)sender; //如果不是首行 if (e.RowIndex > -1) { string colname = dgv_type.Columns[e.ColumnIndex].Name; shuadan_account sa = (shuadan_account)dgv_type.CurrentRow.DataBoundItem; if (colname == "col_state") { #region 修改状态 sa.sdastate = sa.sdastate == "1" ? "2" : "1"; BLL.shuadan_accountManager.Update(sa); dgv_type.ToClearChecked(); #endregion } else if (colname == "col_del") { #region 修改状态 if (MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK) { BLL.shuadan_accountManager.Delete(sa.sdaid); dgv_type.ToAfterDelete(e.RowIndex); } #endregion } else if (colname == "col_login") { #region 登录账号 tabControl1.SelectedTab = tp_shuadan; login(sa.sdaccount, sa.sdapwd); btn_shuadan_geren.PerformClick(); #endregion } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void dgv_type_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { //DataGridView dgv_type = (DataGridView)sender; Common.DataGridViewHelper dgv_type = (Common.DataGridViewHelper)sender; //如果不是首行 if (e.RowIndex > -1) { string colname = dgv_type.Columns[e.ColumnIndex].Name; huashu hs = (huashu)dgv_type.CurrentRow.DataBoundItem; if (colname == "col_typestate") { #region 修改状态 hs.hstate = hs.hstate == "1" ? "2" : "1"; BLL.huashuManager.Update(hs); dgv_type.ToClearChecked(); bind_cb(); #endregion } else if (colname == "col_del") { #region 修改状态 if (MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK) { BLL.huashuManager.Delete(hs.hid); dgv_type.ToAfterDelete(e.RowIndex); bind_cb(); } #endregion } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }