Exemple #1
0
        /// ------------------------------------------------------------------------------------
        protected override void OnCellValuePushed(DataGridViewCellValueEventArgs e)
        {
            if (e.ColumnIndex == 1)
            {
                _model.SaveValueForIndex(e.RowIndex, e.Value as string);
            }
            else
            {
                string oldId;
                if (!_model.GetShouldAskToRemoveFieldEverywhere(e.RowIndex, e.Value as string, out oldId))
                {
                    _model.SaveIdForIndex(e.RowIndex, e.Value as string);
                }
                else
                {
                    if (AskUserToVerifyRemovingFieldEverywhere(oldId))
                    {
                        _model.RemoveFieldFromEntireProject(e.RowIndex);
                        RowCount--;
                        Invalidate();
                    }
                }
            }

            base.OnCellValuePushed(e);
        }
Exemple #2
0
        /// ------------------------------------------------------------------------------------
        protected override void OnCellValuePushed(DataGridViewCellValueEventArgs e)
        {
            if (e.ColumnIndex == 1)
            {
                _model.SaveValueForIndex(e.RowIndex, e.Value as string);
            }
            else
            {
                string oldId;

                if (!_model.GetShouldAskToRemoveFieldEverywhere(e.RowIndex, e.Value as string, out oldId))
                {
                    //SP-1815 Crash deleting custom field
                    //If Custom-field is empty, We should not add the value to the model.
                    //We decrement the row count to remove the row with empty value from the grid
                    if (!string.IsNullOrEmpty(e.Value as string))
                    {
                        _model.SaveIdForIndex(e.RowIndex, e.Value as string);
                    }
                    else
                    {
                        RowCount--;
                    }
                }
                else
                {
                    if (AskUserToVerifyRemovingFieldEverywhere(oldId))
                    {
                        _model.RemoveFieldFromEntireProject(e.RowIndex);
                        RowCount--;
                        Invalidate();
                    }
                }
            }

            base.OnCellValuePushed(e);
        }