private void rowEmployee_Click(object sender, EventArgs e) { updateEmployee form3 = new updateEmployee(); oldAccount = Account.Text.ToString(); oldPosition = Position.Text.ToString(); oldEName = EName.Text.ToString(); oldECode = ECode.Text.ToString(); oldPas = Pas.Text.ToString(); oldIsvalid = IsValid.Text.ToString(); EID = Convert.ToInt32(ID.Text.ToString()); RowName = this; form3.ShowDialog(this); }
private void dgvEmployee_DoubleClick(object sender, EventArgs e)//弹出修改画面 { try { string p; AccountID = dgvEmployee.Rows[dgvEmployee.CurrentRow.Index].Cells["AccountID"].Value.ToString(); Position = dgvEmployee.Rows[dgvEmployee.CurrentRow.Index].Cells["Position"].Value.ToString(); DEmployeeCode = dgvEmployee.Rows[dgvEmployee.CurrentRow.Index].Cells["DEmployeeCode"].Value.ToString(); DEmployeeName = dgvEmployee.Rows[dgvEmployee.CurrentRow.Index].Cells["DEmployeeName"].Value.ToString(); ID = dgvEmployee.Rows[dgvEmployee.CurrentRow.Index].Cells["DEmployeeID"].Value.ToString(); Isvalid = dgvEmployee.Rows[dgvEmployee.CurrentRow.Index].Cells["IsValid"].Value.ToString(); EType = dgvEmployee.Rows[dgvEmployee.CurrentRow.Index].Cells["Type"].Value.ToString(); p = dgvEmployee.Rows[dgvEmployee.CurrentRow.Index].Cells["Pas"].Value.ToString(); if (p != "") { // Pas = db.Decrypt(p); Pas = p; } CIndex = dgvEmployee.CurrentCell.ColumnIndex; if (CIndex > 0 && CIndex < 8) { updateEmployee UE = new updateEmployee(); if (UE.ShowDialog() == DialogResult.OK) { dgvEmployee.Rows[dgvEmployee.CurrentRow.Index].Cells["AccountID"].Value = updateEmployee.uAccountID; dgvEmployee.Rows[dgvEmployee.CurrentRow.Index].Cells["Pas"].Value = updateEmployee.uPas; dgvEmployee.Rows[dgvEmployee.CurrentRow.Index].Cells["Position"].Value = updateEmployee.uPosition; dgvEmployee.Rows[dgvEmployee.CurrentRow.Index].Cells["DEmployeeName"].Value = updateEmployee.uDEmployeeName; dgvEmployee.Rows[dgvEmployee.CurrentRow.Index].Cells["DEmployeeCode"].Value = updateEmployee.uDEmployeeCode; dgvEmployee.Rows[dgvEmployee.CurrentRow.Index].Cells["IsValid"].Value = updateEmployee.uIsvalid; dgvEmployee.Rows[dgvEmployee.CurrentRow.Index].Cells["Type"].Value = updateEmployee.utype; } } else { } } catch (System.Exception ex) { MessageBox.Show(ex.Message); } }