private void CreateNewRule() { List <AdminService.Trigger> triggers = new List <AdminService.Trigger>(); foreach (var i in Constructor.Triggers) { if (i.baseTrigger != null) { triggers.Add(i.baseTrigger); } } Rule created = new Rule() { Name = Constructor.Name, Triggers = triggers, DayFrom = Constructor.SelectedDayFrom, DayTill = Constructor.SelectedDayTill, TimeFrom = Constructor.TimeFrom, TimeTill = Constructor.TimeTill, Link = Constructor.SelectedLink, Source = Constructor.SelectedSource, Action = Constructor.SelectedAction, Parameter = Constructor.ActionParam }; BusinessRules.Add(new BusinessRule(created)); client.AddBusinessRule(created); Constructor.ClearContents(); }
public override bool IsSatisfiedBy(NorthwindApp.Entities.DTO.Product candidate) { if (candidate.CategoryID != 1) { BusinessRules.Add(new BusinessException("Ürün içecek kategorisinde olmalıdır")); return(false); } return(true); }
public AdminVM() { Constructor = new RuleConstructor(client.GetExposedData()); foreach (var i in client.GetBusinessRules()) { BusinessRules.Add(new BusinessRule(i)); } Drop = new RelayCommand( () => { client.RemoveBusinessRule(SelectedRule.businessRule); BusinessRules.Remove(SelectedRule); SelectedRule = null; }, () => { return(SelectedRule != null); }); Create = new RelayCommand(CreateNewRule, Constructor.CanCreate); }