public override bool CanSaveRecord()
 {
     return(((_viewportState == ViewportState.NewRowState) || (_viewportState == ViewportState.ModifyRowState)) &&
            AccessControl.HasPrivelege(Priveleges.DirectoriesReadWrite));
 }
 public override bool HasAssocLicenses()
 {
     return((_vSoftware.Position > -1) &&
            AccessControl.HasPrivelege(Priveleges.LicensesRead));
 }
 public override bool CanCopyRecord()
 {
     return((_vSoftware.Position != -1) && !_softwareDm.EditingNewRecord &&
            AccessControl.HasPrivelege(Priveleges.DirectoriesReadWrite));
 }
 public override bool CanDeleteRecord()
 {
     return((_vSoftware.Position > -1) &&
            (_viewportState != ViewportState.NewRowState) &&
            AccessControl.HasPrivelege(Priveleges.DirectoriesReadWrite));
 }
        private bool ChangeViewportStateTo(ViewportState state)
        {
            if (!AccessControl.HasPrivelege(Priveleges.DirectoriesReadWrite))
            {
                _viewportState = ViewportState.ReadState;
                return(true);
            }
            switch (state)
            {
            case ViewportState.ReadState:
                switch (_viewportState)
                {
                case ViewportState.ReadState:
                    return(true);

                case ViewportState.NewRowState:
                case ViewportState.ModifyRowState:
                    var result = MessageBox.Show(@"Сохранить изменения в базу данных?", @"Внимание",
                                                 MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
                    switch (result)
                    {
                    case DialogResult.Yes:
                        SaveRecord();
                        break;

                    case DialogResult.No:
                        CancelRecord();
                        break;

                    default:
                        return(false);
                    }
                    return(_viewportState == ViewportState.ReadState);
                }
                break;

            case ViewportState.NewRowState:
                switch (_viewportState)
                {
                case ViewportState.ReadState:
                    if (_softwareDm.EditingNewRecord)
                    {
                        return(false);
                    }
                    _viewportState = ViewportState.NewRowState;
                    return(true);

                case ViewportState.NewRowState:
                    return(true);

                case ViewportState.ModifyRowState:
                    var result = MessageBox.Show(@"Сохранить изменения в базу данных?", @"Внимание",
                                                 MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
                    switch (result)
                    {
                    case DialogResult.Yes:
                        SaveRecord();
                        break;

                    case DialogResult.No:
                        CancelRecord();
                        break;

                    default:
                        return(false);
                    }
                    return(_viewportState == ViewportState.ReadState && ChangeViewportStateTo(ViewportState.NewRowState));
                }
                break;

            case ViewportState.ModifyRowState:
                switch (_viewportState)
                {
                case ViewportState.ReadState:
                    _viewportState = ViewportState.ModifyRowState;
                    return(true);

                case ViewportState.ModifyRowState:
                    return(true);

                case ViewportState.NewRowState:
                    var result = MessageBox.Show(@"Сохранить изменения в базу данных?", @"Внимание",
                                                 MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
                    switch (result)
                    {
                    case DialogResult.Yes:
                        SaveRecord();
                        break;

                    case DialogResult.No:
                        CancelRecord();
                        break;

                    default:
                        return(false);
                    }
                    return(_viewportState == ViewportState.ReadState && ChangeViewportStateTo(ViewportState.ModifyRowState));
                }
                break;
            }
            return(false);
        }
 public override bool CanInsertRecord()
 {
     return(!_softwareDm.EditingNewRecord && AccessControl.HasPrivelege(Priveleges.DirectoriesReadWrite));
 }
 public override bool CanSaveRecord()
 {
     return(SnapshotHasChanges() &&
            AccessControl.HasPrivelege(Priveleges.DirectoriesReadWrite));
 }
 public override bool CanDeleteRecord()
 {
     return((_vSnapshotSoftVersions.Position != -1) &&
            AccessControl.HasPrivelege(Priveleges.DirectoriesReadWrite));
 }
 public override bool CanInsertRecord()
 {
     return((ParentType == ParentTypeEnum.Software) && (ParentRow != null) &&
            AccessControl.HasPrivelege(Priveleges.DirectoriesReadWrite));
 }
Esempio n. 10
0
 public override bool CanInsertRecord()
 {
     return(AccessControl.HasPrivelege(Priveleges.DirectoriesReadWrite));
 }
 public override bool CanDeleteRecord()
 {
     return((_vSnapshotSoftLicKeys.Position != -1) &&
            AccessControl.HasPrivelege(Priveleges.LicensesReadWrite));
 }