private void menuModifyUser_Click(object sender, EventArgs e) { //String userId = null; if (this.dgWechatMember.SelectedRows == null) { MessageBox.Show("请先选择"); return; } frmAddWechatUser frmAddWechatUser = new frmAddWechatUser(); frmAddWechatUser.wechatJsonUser.userid = this.dgWechatMember.CurrentRow.Cells[1].Value.ToString(); DialogResult result = frmAddWechatUser.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { DataGridViewRow row = dgWechatMember.CurrentRow; row.Cells[0].Value = frmAddWechatUser.wechatJsonUser.name; row.Cells[1].Value = frmAddWechatUser.wechatJsonUser.userid; row.Cells[2].Value = frmAddWechatUser.wechatJsonUser.weixinid; row.Cells[3].Value = frmAddWechatUser.wechatJsonUser.mobile; row.Cells[4].Value = frmAddWechatUser.wechatJsonUser.email; row.Cells[5].Value = "未关注"; } }
private void btnAdd_Click(object sender, EventArgs e) { frmAddWechatUser frmAddWechatUser = new frmAddWechatUser(); if (frmAddWechatUser.wechatJsonUser.department == null) { frmAddWechatUser.wechatJsonUser.department = new List<int>(); } if (this.tvOrganization.SelectedNode != null) { frmAddWechatUser.wechatJsonUser.department.Add(int.Parse(this.tvOrganization.SelectedNode.Tag.ToString())); } DialogResult result = frmAddWechatUser.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { dgWechatMember.Rows.Add(); DataGridViewRow row = dgWechatMember.Rows[dgWechatMember.RowCount - 1]; row.Cells[0].Value = frmAddWechatUser.wechatJsonUser.name; row.Cells[1].Value = frmAddWechatUser.wechatJsonUser.userid; row.Cells[2].Value = frmAddWechatUser.wechatJsonUser.weixinid; row.Cells[3].Value = frmAddWechatUser.wechatJsonUser.mobile; row.Cells[4].Value = frmAddWechatUser.wechatJsonUser.email; row.Cells[5].Value = "未关注"; } }