public ActionResult FireTimes(string instanceName, string groupName, string itemName) { InstanceModel instance = instanceRepo.GetInstance(instanceName); TriggerRepository trigRepo = new TriggerRepository(instance); TriggerFireTimesModel m = new TriggerFireTimesModel(); m.Trigger = trigRepo.GetTrigger(itemName, groupName); CalendarRepository calRepo = new CalendarRepository(instance); m.Calendar = calRepo.GetCalendar(m.Trigger.CalendarName); ViewData["groupName"] = groupName; if (m.Trigger == null) { ViewData["triggerName"] = itemName; return(View("NotFound")); } else { return(View(m)); } }
public ActionResult EditCronTrigger(CronTriggerViewModel model) { if (!ModelState.IsValid) { return(View(model)); } TriggerRepository.UpdateCronTrigger(model.ToDto()); return(RedirectToAction("trigger-manager")); }
/*public static TriggerXml DeserializeXml(HttpRequestMessage request) * { * var doc = new XmlDocument(); * doc.Load(request.Content.ReadAsStreamAsync().Result); * LogTrigger(doc.DocumentElement.OuterXml); * var serializer = new XmlSerializer(typeof(TriggerXml)); * var stream = GenerateStreamFromString(doc.DocumentElement.OuterXml); * TriggerXml sapTrigger = (TriggerXml)serializer.Deserialize(stream); * return sapTrigger; * }*/ public static void LogTrigger(Trigger xml, string objectType, string host) { var triggerRepo = new TriggerRepository(); var trigger = new TriggerDb { Trigger = GetXmlString(xml), Created = DateTime.Now, ObjectType = objectType, Host = host }; triggerRepo.AddTrigger(trigger); }
//private ConfigOptions _options; public InitialiseWorkflowData(IHostingEnvironment env, TriggerRepository context, ModulesRepository module, WFStateRepository wfstate, MessageTemplateRepository message) { _context = context;; _env = env; _module = module; _wfstate = wfstate; _message = message; }
public TriggerListViewModel(INavigation navigation) { _navigation = navigation; _triggerRepository = new TriggerRepository(); AddCommand = new Command(async() => await ShowAddTrigger()); DeleteAllTriggersCommand = new Command(async() => await DeleteAllTriggers()); FetchTriggers(); }
public AddTrigerViewModel(INavigation navigation) { _navigation = navigation; //_contactValidator = new TriggerValidator(); _trigger = new Triggers(); _triggerRepository = new TriggerRepository(); AddTriggerCommand = new Command(async() => await AddTrigger()); ViewAllTriggersCommand = new Command(async() => await ShowTriggerList()); }
public ActionResult TriggerManager() { var dtos = TriggerRepository.GetTriggers(); var vms = new List <TriggerViewModel>(); foreach (var dto in dtos) { vms.Add(TriggerViewModel.Create(dto)); } return(View(vms)); }
public ActionResult EditCronTrigger(int id) { var dto = TriggerRepository.GetCronGrigger(id); if (dto != null) { var vm = CronTriggerViewModel.Create(dto); vm.Jobs = JobRepository.GetJobs(null).ToSelectList(); return(View(vm)); } return(RedirectToAction("cron-trigger-manager")); }
public void AddTest() { var dir = Directory.GetCurrentDirectory(); var options = Microsoft.Extensions.Options.Options.Create(new RepositoryOptions { TriggerDbPath = "tests.db4" }); var repo = new TriggerRepository(options); repo.AddTrigger(new PriceCryptoTrigger(), 0); repo.AddTrigger(new PercentCryptoTrigger(), 0); }
public DetailsViewModel(INavigation navigation, int selectedTriggerID) { _navigation = navigation; //_contactValidator = new TriggerValidator(); _trigger = new Triggers(); _trigger.Id = selectedTriggerID; _triggerRepository = new TriggerRepository(); UpdateTriggerCommand = new Command(async() => await UpdateTrigger()); DeleteTriggerCommand = new Command(async() => await DeleteTrigger()); FetchTriggerDetails(); }
public static async Task Passes_trigger_keys_to_database_provider() { var keys = new[] { "key1", "key2" }; var mockDatabaseProvider = new Mock <IDatabaseProvider>(); var triggerRepository = new TriggerRepository(mockDatabaseProvider.Object); await triggerRepository.DeleteKeys(keys); mockDatabaseProvider.Verify( p => p.DeleteItems(It.Is <IEnumerable <RawItem> >(c => CheckTriggers(keys, c.ToArray()))), Times.Once); }
public static async Task Calls_database_provider_to_add_new_trigger() { var mockDatabaseProvider = new Mock <IDatabaseProvider>(); var triggerRepository = new TriggerRepository(mockDatabaseProvider.Object); await triggerRepository.AddTrigger(); mockDatabaseProvider.Verify( p => p.SaveItem(It.Is <RawItem>(r => r.PrimaryKey == "TRIGGER" && r.SortKey.Length == 36 && r.Trigger == r.SortKey)), Times.Once); }
public static async Task Returns_trigger_keys_from_database_provider() { var keys = new[] { "key1", "key2" }; var triggers = keys.Select(RawItem.CreateTrigger).ToArray(); var mockDatabaseProvider = new Mock <IDatabaseProvider>(); mockDatabaseProvider .Setup(p => p.GetTriggers()) .ReturnsAsync(triggers); var triggerRepository = new TriggerRepository(mockDatabaseProvider.Object); var result = await triggerRepository.GetKeys(); Assert.Equal(keys, result); }
protected ScheduledJobTrigger GetTrigger() { return(TriggerId.HasValue ? TriggerRepository.Get(TriggerId.Value) : null); }