コード例 #1
0
ファイル: PaperTypesPanel.cs プロジェクト: aurigma/PhotoKiosk
        private void _typesView_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (_isLoaded)
            {
                PaperType type           = _typesView.Rows[e.RowIndex].Tag as PaperType;
                string    newName        = _typesView["NameColumn", e.RowIndex].Value != null ? _typesView["NameColumn", e.RowIndex].Value.ToString() : string.Empty;
                string    newDescription = _typesView["DescriptionColumn", e.RowIndex].Value != null ? _typesView["DescriptionColumn", e.RowIndex].Value.ToString() : string.Empty;
                if (type != null)
                {
                    type.Name        = newName;
                    type.Description = newDescription;
                }
                else
                {
                    type = PriceManager.AddPaperType(newName, newDescription);
                    _typesView.Rows[e.RowIndex].Tag = type;
                }

                ValidateCells(null);
            }
        }