/// <summary>
        /// The ButtonAdd_Click method.
        /// </summary>
        /// <param name="sender">The <paramref name="sender"/> parameter.</param>
        /// <param name="args">The <paramref name="args"/> parameter.</param>
        private void ButtonAdd_Click(object sender, EventArgs args)
        {
            var newRuleTrigger = new RuleTrigger {
                SituationType = cbxSituationType.SelectedItem.ToString()
            };

            if (chbxEnabled.Checked)
            {
                var resourceRefs   = new List <ResourceRef>();
                var newResourceRef = new ResourceRef {
                    Type = (ResourceRef.ResourceType)((ComboboxItem)cbxSituationType.SelectedItem).Value
                };
                var sourceId = ((ComboboxItem)cbxSource.SelectedItem).Value as string;
                if (string.IsNullOrEmpty(sourceId))
                {
                    return;
                }

                newResourceRef.Id = sourceId;
                resourceRefs.Add(newResourceRef);
                newRuleTrigger.ResourceRefs = resourceRefs;
            }

            var lvItem = new ListViewItem(string.Empty);

            lvItem.SubItems.Add(newRuleTrigger.SituationType);
            lvItem.SubItems.Add(newRuleTrigger.ResourceRefs.Count > 0 ? newRuleTrigger.ResourceRefs[0].Id : @"All");
            lvItem.Tag = newRuleTrigger;
            TriggerListView.Items.Add(lvItem);
        }
Exemplo n.º 2
0
        public static Task <IEnumerable <ValidationError> > ValidateAsync(RuleTrigger action, ISchemaProvider schemas)
        {
            Guard.NotNull(action, nameof(action));
            Guard.NotNull(schemas, nameof(schemas));

            var visitor = new RuleTriggerValidator(schemas);

            return(action.Accept(visitor));
        }
Exemplo n.º 3
0
        bool IRuleTriggerHandler.Trigger(AppEvent @event, RuleTrigger trigger, Guid ruleId)
        {
            if (@event is TEvent typed)
            {
                return(Trigger(typed, (TTrigger)trigger, ruleId));
            }

            return(false);
        }
Exemplo n.º 4
0
        bool IRuleTriggerHandler.Trigger(EnrichedEvent @event, RuleTrigger trigger)
        {
            if (@event is TEnrichedEvent typed)
            {
                return(Trigger(typed, (TTrigger)trigger));
            }

            return(false);
        }
Exemplo n.º 5
0
        bool IRuleTriggerHandler.Trigger(AppEvent @event, RuleTrigger trigger, Guid ruleId)
        {
            var typed = @event as TEvent;

            if (typed != null)
            {
                return(Trigger(typed, (TTrigger)trigger, ruleId));
            }

            return(false);
        }
Exemplo n.º 6
0
        bool IRuleTriggerHandler.Trigger(EnrichedEvent @event, RuleTrigger trigger)
        {
            var typed = @event as TEnrichedEvent;

            if (typed != null)
            {
                return(Trigger(typed, (TTrigger)trigger));
            }

            return(false);
        }
Exemplo n.º 7
0
        public void DeleteRecord(string ruleId, string classId, string accessType, string seqNo)
        {
            try
            {
                //Step 1 Code to delete the object from the database
                RuleTrigger s = new RuleTrigger();
                s.ruleId     = ruleId;
                s.classId    = classId;
                s.accessType = accessType;
                s.seqNo      = seqNo;
                PostRequest <RuleTrigger> req = new PostRequest <RuleTrigger>();
                req.entity = s;
                PostResponse <RuleTrigger> r = _companyStructureService.ChildDelete <RuleTrigger>(req);
                if (!r.Success)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    Common.errorMessage(r);
                    return;
                }
                else
                {
                    //Step 2 :  remove the object from the store
                    Store1.Reload();

                    //Step 3 : Showing a notification for the user
                    Notification.Show(new NotificationConfig
                    {
                        Title = Resources.Common.Notification,
                        Icon  = Icon.Information,
                        Html  = Resources.Common.RecordDeletedSucc
                    });
                }
            }
            catch (Exception ex)
            {
                //In case of error, showing a message box to the user
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorDeletingRecord).Show();
            }
        }
Exemplo n.º 8
0
        public static Task <IEnumerable <ValidationError> > ValidateAsync(Guid appId, RuleTrigger action, IAppProvider appProvider)
        {
            Guard.NotNull(action);
            Guard.NotNull(appProvider);

            var visitor = new RuleTriggerValidator(x => appProvider.GetSchemaAsync(appId, x));

            return(action.Accept(visitor));
        }
Exemplo n.º 9
0
 bool IRuleTriggerHandler.Triggers(Envelope <AppEvent> @event, RuleTrigger trigger)
 {
     return(Triggers(@event, (T)trigger));
 }
Exemplo n.º 10
0
 public void Should_freeze_triggers(RuleTrigger trigger)
 {
     TestUtils.TestFreeze(trigger);
 }
Exemplo n.º 11
0
 public static RuleTriggerDto Create(RuleTrigger properties)
 {
     return(properties.Accept(Instance));
 }
Exemplo n.º 12
0
        public static Task <IEnumerable <ValidationError> > ValidateAsync(DomainId appId, RuleTrigger trigger, IAppProvider appProvider)
        {
            Guard.NotNull(trigger, nameof(trigger));
            Guard.NotNull(appProvider, nameof(appProvider));

            var visitor = new RuleTriggerValidator(x => appProvider.GetSchemaAsync(appId, x));

            return(trigger.Accept(visitor));
        }
Exemplo n.º 13
0
 IAsyncEnumerable <EnrichedEvent> IRuleTriggerHandler.CreateSnapshotEvents(RuleTrigger trigger, DomainId appId)
 {
     return(CreateSnapshotEvents((TTrigger)trigger, appId));
 }