public void updateGridViewWithCheckBoxRow(object sender, DataGridViewCellEventArgs e) { if (dataGridViewWithCheckBox1.CurrentRow == null) { return; } int selectIndex = dataGridViewWithCheckBox1.CurrentRow.Index; string controllerID = dataGridViewWithCheckBox1["UserID", selectIndex].Value.ToString().Trim(); AccessDataBase.Model.UserInfo modeUserInfo = bllUserInfo.GetModel(int.Parse(controllerID)); FormUser formUser = new FormUser(modeUserInfo, OpenMode.Update); formUser.ShowDialog(); this.refreshDataGridView(); }
private void toolStripButtonUpdateUserInfo_Click(object sender, EventArgs e) { if (dataGridViewWithCheckBox1.CurrentRow == null) { return; } AccessDataBase.BLL.UserInfo bllUserInfo = new AccessDataBase.BLL.UserInfo(); int selectIndex = dataGridViewWithCheckBox1.CurrentRow.Index; string controllerID = dataGridViewWithCheckBox1["UserID", selectIndex].Value.ToString().Trim(); AccessDataBase.Model.UserInfo modeUserInfo = bllUserInfo.GetModel(int.Parse(controllerID)); FormUser formUser = new FormUser(modeUserInfo, OpenMode.Update); formUser.ShowDialog(); this.refreshDataGridView(); }
private void toolStripButtonDeleteUserInfo_Click(object sender, EventArgs e) { AccessDataBase.BLL.UserInfo bllUserInfo = new AccessDataBase.BLL.UserInfo(); if (MyMessageBox.MessageBoxOkCancel("用户信息删除后不能恢复,是否删除?") == System.Windows.Forms.DialogResult.Cancel) { return; } foreach (DataGridViewRow i in dataGridViewWithCheckBox1.Rows) { if (dataGridViewWithCheckBox1.GetRowCheckBoxState(i.Index)) { string userID = dataGridViewWithCheckBox1["UserID", i.Index].Value.ToString().Trim(); AccessDataBase.Model.UserInfo modeUserInfo = bllUserInfo.GetModel(int.Parse(userID)); if (bllUserInfo.Exists(modeUserInfo.UserID)) { bllUserInfo.Delete(modeUserInfo.UserID); } } } this.refreshDataGridView(); }
private void toolStripButtonUpdateUserInfo_Click(object sender, EventArgs e) { if (dataGridViewWithCheckBox1.CurrentRow == null) return; AccessDataBase.BLL.UserInfo bllUserInfo = new AccessDataBase.BLL.UserInfo(); int selectIndex = dataGridViewWithCheckBox1.CurrentRow.Index; string controllerID = dataGridViewWithCheckBox1["UserID", selectIndex].Value.ToString().Trim(); AccessDataBase.Model.UserInfo modeUserInfo = bllUserInfo.GetModel(int.Parse(controllerID)); FormUser formUser = new FormUser(modeUserInfo, OpenMode.Update); formUser.ShowDialog(); this.refreshDataGridView(); }
private void toolStripButtonDeleteUserInfo_Click(object sender, EventArgs e) { AccessDataBase.BLL.UserInfo bllUserInfo = new AccessDataBase.BLL.UserInfo(); if (MyMessageBox.MessageBoxOkCancel("�û���Ϣɾ�����ָܻ�,�Ƿ�ɾ��?") == System.Windows.Forms.DialogResult.Cancel) return; foreach (DataGridViewRow i in dataGridViewWithCheckBox1.Rows) { if (dataGridViewWithCheckBox1.GetRowCheckBoxState(i.Index)) { string userID = dataGridViewWithCheckBox1["UserID", i.Index].Value.ToString().Trim(); AccessDataBase.Model.UserInfo modeUserInfo = bllUserInfo.GetModel(int.Parse(userID)); if (bllUserInfo.Exists(modeUserInfo.UserID)) bllUserInfo.Delete(modeUserInfo.UserID); } } this.refreshDataGridView(); }