12345678910111213141516171819202122232425262728293031323334 |
- using System.Collections.Generic;
- using System.Linq;
- using InABox.Core;
- using InABox.DynamicGrid;
- namespace PRSServer.Forms.CustomProperties
- {
- internal class CustomPropertyGrid : DynamicDataGrid<CustomProperty>
- {
- public CustomPropertyGrid()
- {
- Options.AddRange(
- DynamicGridOption.AddRows,
- DynamicGridOption.EditRows,
- DynamicGridOption.DeleteRows,
- DynamicGridOption.RecordCount,
- DynamicGridOption.SelectColumns
- );
- HiddenColumns.Add(x => x.Class);
- HiddenColumns.Add(x => x.Type);
- }
- protected override void DoValidate(CustomProperty[] items, List<string> errors)
- {
- base.DoValidate(items, errors);
- if (items.Any(x => string.IsNullOrWhiteSpace(x.Class)))
- errors.Add("[Class] must not be blank!");
- if (items.Any(x => string.IsNullOrWhiteSpace(x.Name)))
- errors.Add("[Name] must not be blank!");
- if (items.Any(x => string.IsNullOrWhiteSpace(x.Type)))
- errors.Add("[Type] must not be blank!");
- }
- }
- }
|