//update selected record
        private void ButtonUpdateRecord_Click(object sender, EventArgs e)
        {
            var selectedRow = SelectedQueryRow;

            if (selectedRow == null)
            {
                return;
            }
            if (IsRowDirty(selectedRow))
            {
                //no delete dirt row
                ShowMsgBox("Cant delete not commited changes");
                return;
            }
            var editForm = new ResignEditor(_rowResignationDictionary[selectedRow], "Edit");

            if (!editForm.GetResign(out var resign, true))
            {
                return;
            }
            if (CheckDuplicate(resign.ADName, out var checkDup) &&
                _rowResignationDictionary[selectedRow].ADName != resign.ADName &&
                _rowResignationDictionary[selectedRow].HRCode != resign.HRCode)
            {
                if (!ShowWarning())
                {
                    return;
                }
            }
            //add to controller
            Controller.CommandList.Add(new Command()
            {
                ActionType = DbAction.Update, Resign = resign
            });
            UpdateQueryGridRow(selectedRow, resign);
            _dirtyIndex.Add(selectedRow.Index);
            selectedRow.DefaultCellStyle.BackColor = UpdateRowColor;
        }
        //insert new record
        private void ButtonInsertNewRecord_Click(object sender, EventArgs e)
        {
            var insertForm = new ResignEditor("Insert");

            if (!insertForm.GetResign(out var resign))
            {
                return;
            }
            if (CheckDuplicate(resign.ADName, out var checkDup))
            {
                if (!ShowWarning())
                {
                    return;
                }
            }
            var newRecord = AddToQueryGrid(resign, "New record", NewRowColor);

            Controller.CommandList.Add(new Command()
            {
                ActionType = DbAction.Insert, Resign = resign
            });
            _dirtyIndex.Add(newRecord.Index);
        }