private void dgvUsers_DoubleClick(object sender, EventArgs e) { int UserID; if (WinFormUtil.DataGridView_GetSelectedID(dgvUsers, out UserID)) { BOUser current_user = AccountantPool.Instance.CurrentAccountant.User; AuthUser user = current_user.GetAuthUser(UserID); if (user != null) { FrmAuthUser frm = new FrmAuthUser(); frm.Username = user.Username; frm.Password = user.Password; frm.Role = user.Role; frm.Description = user.Description; if (frm.ShowDialog() == DialogResult.OK) { user.Username = frm.Username; user.Password = frm.Password; user.Description = frm.Description; user.Role = frm.Role; current_user.SaveAuthUser(user); ViewModel(); } } } }
private void btnDeleteRole_Click(object sender, EventArgs e) { int RoleID; if (WinFormUtil.DataGridView_GetSelectedID(dgvRoles, out RoleID)) { BOUser current_user = AccountantPool.Instance.CurrentAccountant.User; AuthRole role = current_user.GetAuthRole(RoleID); if (role != null) { if (current_user.CanDelete(role)) { if (WinFormUtil.Confirm("Do you want to delete?", "Delete Warning") == DialogResult.Yes) { current_user.Delete(role); ViewModel(); } } else if (WinFormUtil.Confirm("Other roles and users have inherited this role, delete this role will also delete them,\r\n do you still want to delete?", "Delete Warning") == DialogResult.Yes) { current_user.Delete(role); ViewModel(); } } } }
private void btnDelLine_Click(object sender, EventArgs e) { int linenumber; if (WinFormUtil.DataGridView_GetSelectedID(dgvPurchaseLines, out linenumber)) { ReviseModel(); mModel.DeletePurchaseLine(linenumber); } }
void dgvSaleLines_DoubleClick(object sender, EventArgs e) { int linenumber; if (WinFormUtil.DataGridView_GetSelectedID(dgvSaleLines, out linenumber)) { BOSaleLine lineModel = mModel.UpdateSaleLine(linenumber); OpenSaleLineDialog(lineModel); } }
private void DataGridView_DoubleClick(DataGridView dgv) { int CardRecordID; if (WinFormUtil.DataGridView_GetSelectedID(dgv, out CardRecordID)) { BOCard cardModel = mModel.GetItem(CardRecordID); OpenCardDialog(cardModel); } }
private void DataGridView_Delete(DataGridView dgv) { int CardRecordID; if (WinFormUtil.DataGridView_GetSelectedID(dgv, out CardRecordID)) { if (WinFormUtil.Confirm("Do you want to delete the card?", "Delete") == DialogResult.Yes) { mModel.Delete(CardRecordID); } } }
private void btnDelUser_Click(object sender, EventArgs e) { int UserID; if (WinFormUtil.DataGridView_GetSelectedID(dgvUsers, out UserID)) { BOUser current_user = AccountantPool.Instance.CurrentAccountant.User; current_user.DeleteAuthUser(UserID); ViewModel(); } }
private void dgvRoles_DoubleClick(object sender, EventArgs e) { int RoleID; if (WinFormUtil.DataGridView_GetSelectedID(dgvRoles, out RoleID)) { BOUser current_user = AccountantPool.Instance.CurrentAccountant.User; AuthRole role = current_user.GetAuthRole(RoleID); if (role != null) { FrmAuthRole frm = new FrmAuthRole(role); if (frm.ShowDialog() == DialogResult.OK) { ViewModel(); } } } }