示例#1
0
        private void tmrRestore_Tick(object sender, EventArgs e)
        {
            tmrRestore.Enabled = false;

            if (grdData.CurrentRow == null)
            {
                return;
            }

            int rowIndex = grdData.CurrentRow.Index;

            btnPrint.Enabled       =
                btnService.Enabled =
                    true;

            if (grdData.IsStatusRow(rowIndex))
            {
                oPassCur.ClearOne();
                btnEdit.Enabled       =
                    btnDelete.Enabled =
                        false;
            }
            else
            {
                // заполнение объекта по текущей строке
                DataRow r = ((DataRowView)((DataGridViewRow)grdData.Rows[rowIndex]).DataBoundItem).Row;
                oPassCur.FillOne(r);
                btnEdit.Enabled   = (!oPassCur.DateConfirm.HasValue && !oPassCur.DateBeg.HasValue);
                btnDelete.Enabled = (!oPassCur.DateConfirm.HasValue && !oPassCur.DateBeg.HasValue);

                mniPassSetDateEntry.Enabled   = !oPassCur.DateBeg.HasValue;
                mniPassClearDateEntry.Enabled = oPassCur.DateBeg.HasValue;
                mniPassSetDateExit.Enabled    = !oPassCur.DateEnd.HasValue;
                mniPassClearDateExit.Enabled  = oPassCur.DateEnd.HasValue;

                mniPassConfirm.Enabled   = !oPassCur.IsClosed && !oPassCur.IsConfirmed;
                mniPassUnConfirm.Enabled = !oPassCur.IsClosed && oPassCur.IsConfirmed;
                mniPassPermit.Enabled    = !oPassCur.IsClosed && !oPassCur.IsPermitted;
                mniPassUnPermit.Enabled  = !oPassCur.IsClosed && oPassCur.IsPermitted;
                mniPassPrint.Enabled     = !oPassCur.IsClosed && oPassCur.IsPermitted;
            }
            tcPasses.SetAllNeedRestore(true);
        }