示例#1
0
        public QueryViewModel(IEnumerable <string> recordTypes, IRecordService recordService, IApplicationController controller, bool allowQuery = false, bool loadInitially = false, CustomGridFunction closeFunction = null
                              , IEnumerable <CustomGridFunction> customFunctions = null)
            : base(controller)
        {
            CustomFunctions = customFunctions;
            LoadInitially   = loadInitially;
            AllowQuery      = allowQuery;
            RecordService   = recordService;
            if (closeFunction != null)
            {
                ReturnButton = new XrmButtonViewModel(closeFunction.Label, () => { closeFunction.Function(DynamicGridViewModel); }, controller);
            }
            QueryTypeButton = new XrmButtonViewModel("Change Query Type", ChangeQueryType, ApplicationController);
            DeleteSelectedConditionsButton = new XrmButtonViewModel("Delete Selected", () => DeleteSelected(), ApplicationController);
            GroupSelectedConditionsOr      = new XrmButtonViewModel("Group Selected Or", () => GroupSelected(FilterOperator.Or), ApplicationController);
            GroupSelectedConditionsAnd     = new XrmButtonViewModel("Group Selected And", () => GroupSelected(FilterOperator.And), ApplicationController);
            UngroupSelectedConditions      = new XrmButtonViewModel("Ungroup Selected", () => UnGroupSelected(), ApplicationController);
            ChangeQueryType();

            QueryTypeButton.IsVisible = AllowQuery;

            _recordTypes = recordTypes;
            if (_recordTypes.Count() == 1)
            {
                RecordType = _recordTypes.First();
            }
        }
 public void AddFunction(CustomGridFunction customFunction)
 {
     _customfunctions.Add(customFunction);
 }