private void btnLaws_Click(object sender, EventArgs e) { int i = 0; int intUpDateID = -1; switch (intSelectModel) { case 1: bool blIsSame = true; int intTerID = 0; ; #region【区域范围】 try { foreach (DataGridViewRow dgvr in dgv_Main.Rows) { if (dgvr.Cells["cl"].Value != null && int.Parse(dgvr.Cells["cl"].Value.ToString()) == 1) { intUpDateID = Convert.ToInt32(dgvr.Cells["TerritorialID"].Value.ToString()); i += 1; if (intTerID != 0) { if (intTerID != Convert.ToInt32(dgvr.Cells["TerritorialID"].Value.ToString())) { blIsSame = false; } } intTerID = Convert.ToInt32(dgvr.Cells["TerritorialID"].Value.ToString()); } } } catch { intUpDateID = -1; i = 0; } if (i == 0) { MessageBox.Show("请选择要配置的区域", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else if (i > 1 && !blIsSame) { MessageBox.Show("所选区域不能大于1个,请重新选择!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { tempTerritorialID_TerSet = intTerID; A_FrmAreaManage_AddTerSet frmAmadd = new A_FrmAreaManage_AddTerSet(this); frmAmadd.ShowDialog(); } #endregion break; case 2: #region【区域信息】 try { foreach (DataGridViewRow dgvr in dgv_Main.Rows) { if (dgvr.Cells["cl"].Value != null && int.Parse(dgvr.Cells["cl"].Value.ToString()) == 1) { intUpDateID = Convert.ToInt32(dgvr.Cells["TerritorialID"].Value.ToString()); i += 1; } } } catch { intUpDateID = -1; i = 0; } if (i == 0) { MessageBox.Show("请选择要修改的区域信息", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else if (i > 1) { MessageBox.Show("所选区域信息不能大于1个,请重新选择!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { blIsUpDate = true; tempTerritorialID = intUpDateID; A_FrmAreaManage_AddTerInfo frmAmTer = new A_FrmAreaManage_AddTerInfo(this); frmAmTer.ShowDialog(); } #endregion break; case 3: #region【区域类型】 try { foreach (DataGridViewRow dgvr in dgv_Main.Rows) { if (dgvr.Cells["cl"].Value != null && int.Parse(dgvr.Cells["cl"].Value.ToString()) == 1) { intUpDateID = Convert.ToInt32(dgvr.Cells["TerritorialTypeID"].Value.ToString()); i += 1; } } } catch { intUpDateID = -1; i = 0; } if (i == 0) { MessageBox.Show("请选择要修改的区域类型", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else if (i > 1) { MessageBox.Show("所选区域类型不能大于1个,请重新选择!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { blIsUpDate = true; tempTerritorialTypeID = intUpDateID; A_FrmAreaManage_AddTerType frmAmTerType = new A_FrmAreaManage_AddTerType(this); frmAmTerType.ShowDialog(); } #endregion break; case 4: #region[特殊工种配置] A_frmSWrokSet f = new A_frmSWrokSet(this); f.ShowDialog(); #endregion break; default: break; } }
private void dgv_Main_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { switch (intSelectModel) { case 1: #region【区域范围】 blIsSee_TerSet = true; tempTerritorialID_TerSet = Convert.ToInt32(dgv_Main.Rows[e.RowIndex].Cells["TerritorialID"].Value.ToString()); A_FrmAreaManage_AddTerSet frmAmadd = new A_FrmAreaManage_AddTerSet(this); frmAmadd.ShowDialog(); blIsSee_TerSet = false; #endregion break; case 2: #region【区域信息】 blIsUpDate = false; tempTerritorialID = Convert.ToInt32(dgv_Main.Rows[e.RowIndex].Cells["TerritorialID"].Value.ToString()); A_FrmAreaManage_AddTerInfo frmAmTer = new A_FrmAreaManage_AddTerInfo(this); frmAmTer.ShowDialog(); #endregion break; case 3: #region【区域类型】 blIsUpDate = false; tempTerritorialTypeID = Convert.ToInt32(dgv_Main.Rows[e.RowIndex].Cells["TerritorialTypeID"].Value.ToString()); A_FrmAreaManage_AddTerType frmAmTerType = new A_FrmAreaManage_AddTerType(this); frmAmTerType.ShowDialog(); #endregion break; default: break; } } }
private void btnAdd_Click(object sender, EventArgs e) { switch (intSelectModel) { case 2: #region【区域信息】 tempTerritorialID = -1; A_FrmAreaManage_AddTerInfo frmAmTer = new A_FrmAreaManage_AddTerInfo(this); frmAmTer.ShowDialog(); #endregion break; case 3: #region【区域类型】 tempTerritorialTypeID = -1; A_FrmAreaManage_AddTerType frmAmTerType = new A_FrmAreaManage_AddTerType(this); frmAmTerType.ShowDialog(); #endregion break; default: break; } }