private static void StartJobs(IWebHost webHost) { var adapter = (IBotFrameworkHttpAdapter)webHost .Services .GetService(typeof(IBotFrameworkHttpAdapter)); var storage = (IStorage)webHost .Services .GetService(typeof(IStorage)); var configuration = (IConfiguration)webHost .Services .GetService(typeof(IConfiguration)); var notifierLogger = (ILogger <NotifyService>)webHost .Services .GetService(typeof(ILogger <NotifyService>)); var crawlerLogger = (ILogger <CrawlerService>)webHost .Services .GetService(typeof(ILogger <CrawlerService>)); //notifier var notifier = new NotifyService(adapter, configuration["MicrosoftAppId"], storage, notifierLogger); Task.Factory.StartNew(notifier.Run, TaskCreationOptions.LongRunning); //crawler var crowler = new CrawlerService(storage, crawlerLogger); Task.Factory.StartNew(crowler.Run, TaskCreationOptions.LongRunning); }
public MainWindow(string token) { InitializeComponent(); restclient = new RestService <Tevekenyseg, string> ("https://localhost:44385", "/api/tevekenyseg", token); notifyservice = new NotifyService("https://localhost:44385/tevekenysegHub"); notifyservice.AddHandler <Tevekenyseg>("Tevekenyseg", (tevekenyseg) => { if (tevekenyseg.Kategoria == "opcionális") { lbox_opcionalis.Items.Add(tevekenyseg); } else if (tevekenyseg.Kategoria == "sürgős") { lbox_surgos.Items.Add(tevekenyseg); } else { lbox_normal.Items.Add(tevekenyseg); } }); notifyservice.Init(); this.token = token; Sync(); }
public PartialViewResult Details() { using (var srv = new NotifyService()) { return(PartialView(srv.GetNotifications())); } }
public ActionResult ListUser(NotifySearchModel searchModel) { var pagedList = NotifyService.Search2(searchModel.Title, searchModel.FromDateTimeCreated, searchModel.ToDateTimeCreated, searchModel.Type, searchModel.PageIndex); pagedList.SearchModel = searchModel; return(PartialView("_ListUser", pagedList)); }
public static async Task AddNotify(int SchoolID, string faceID, string deviceSerial, string faceName, string authType, string inOutType, string time, string State, string deviceID = null, string snapshotUrl = null, string snapshotConten = null, float?temperature = null) { try { using (var notifyService = new NotifyService()) { await notifyService.CreatAsync(new Models.EnterAndLeave() { DeviceSerial = deviceSerial, FaceId = faceID, FaceName = faceName, AuthType = authType, InOutType = inOutType, Time = time, DeviceId = deviceID, SnapshotContent = snapshotConten, SnapshotUrl = snapshotUrl, Temperature = temperature, SchoolID = SchoolID, State = State, }, true); } } catch (DbEntityValidationException ex) { Console.WriteLine(ex.Message);; } }
public MainWindow(string token) { InitializeComponent(); this.token = token; notifyService = new NotifyService("https://localhost:44346/ticketHub"); notifyService.AddHandler <Ticket>("NewTicket", (value) => lbox.Items.Add(value)); notifyService.AddHandler <string>("Disconnected", (value) => MessageBox.Show(value, "Hiba történt", MessageBoxButton.OK, MessageBoxImage.Error)); notifyService.AddHandler <string>("Connected", (value) => this.Title += " id: " + value); try { notifyService.Init(); } catch (System.Net.Http.HttpRequestException ex) { MessageBox.Show(ex.Message, "Hiba történt", MessageBoxButton.OK, MessageBoxImage.Error); } rest = new RestService <Ticket, string>( "https://localhost:44346/", "/api/ticket", token); Sync(); }
public Api(string node) { netnode = node; switch (netnode) { case "testnet": neoCliService = new NeoCliService { hh = hh, neoCliJsonRPCUrl = mh.neoCliJsonRPCUrl_testnet }; mongodbConnStr = mh.mongodbConnStr_testnet; mongodbDatabase = mh.mongodbDatabase_testnet; neoCliJsonRPCUrl = mh.neoCliJsonRPCUrl_testnet; notifyService = new NotifyService { mh = mh, mongodbConnStr = mh.mongodbConnStr_testnet, mongodbDatabase = mh.mongodbDatabase_testnet, }; assetService = new AssetService { mh = mh, block_mongodbConnStr = mh.mongodbConnStr_testnet, block_mongodbDatabase = mh.mongodbDatabase_testnet, analy_mongodbConnStr = mh.analy_mongodbConnStr_testnet, analy_mongodbDatabase = mh.analy_mongodbDatabase_testnet, neoCliJsonRPCUrl = mh.neoCliJsonRPCUrl_testnet, }; break; case "mainnet": neoCliService = new NeoCliService { hh = hh, neoCliJsonRPCUrl = mh.neoCliJsonRPCUrl_mainnet, }; mongodbConnStr = mh.mongodbConnStr_mainnet; mongodbDatabase = mh.mongodbDatabase_mainnet; neoCliJsonRPCUrl = mh.neoCliJsonRPCUrl_mainnet; notifyService = new NotifyService { mh = mh, mongodbConnStr = mh.mongodbConnStr_mainnet, mongodbDatabase = mh.mongodbDatabase_mainnet, }; assetService = new AssetService { mh = mh, block_mongodbConnStr = mh.mongodbConnStr_mainnet, block_mongodbDatabase = mh.mongodbDatabase_mainnet, analy_mongodbConnStr = mh.analy_mongodbConnStr_mainnet, analy_mongodbDatabase = mh.analy_mongodbDatabase_mainnet, neoCliJsonRPCUrl = mh.neoCliJsonRPCUrl_mainnet, }; break; } initMonitor(); }
/// <summary> /// 获取过去七天迟到早退情况 /// </summary> /// <param name="SchoolID"></param> /// <returns></returns> public static object GetNotifyStateByTime(int SchoolID) { using (NotifyService notifyService = new NotifyService()) { DateTime dt = DateTime.Now; ArrayList myArray = new ArrayList(); ArrayList Late = new ArrayList(); //迟到 ArrayList LeaveEarly = new ArrayList(); //早退 ArrayList Normal = new ArrayList(); //正常 for (int i = -12; i < 0; i++) { var month = dt.AddMonths(i).Month; myArray.Add(month); var notify = notifyService.GetAll(m => m.IsDelete == false && m.SchoolID == SchoolID && m.CreatTime.Month == month); Late.Add(notify.Where(m => m.State == "迟到").Count()); LeaveEarly.Add(notify.Where(m => m.State == "早退").Count()); Normal.Add(notify.Where(m => m.State == "正常").Count()); } object obj = new { DateArr = myArray, Late, LeaveEarly, Normal }; return(obj); } }
protected override async Task <bool> OnMessageReceivedAsync(DocumentPublishCancelEventMessage message, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); try { var publishDocumentTask = await PublishDocumentTaskRepository.GetAsync(message.Id); if (publishDocumentTask == null) { return(false); } if (publishDocumentTask.IsFinished) { return(true); } SavePublishTaskInfo(publishDocumentTask); await NotifyService.SendNotificationAsync(publishDocumentTask); return(true); } catch (OperationCanceledException) { throw; } catch (Exception e) { _logger.LogError(e, "Возникла ошибка при обработке сообщения"); return(false); } }
private void ProgramEntry_UninstallationFinished(object sender, OperationFinishedEventArgs e) { if (!e.Cancelled) { UpdateProgramList(e.Entry, e.OperationType); NotifyService.Notify(new Notification("Info", "Uninstallation finished")); } }
protected override async Task <bool> OnMessageReceivedAsync(DocumentPublishEventMessage message, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); try { var publishDocumentTask = await PublishDocumentTaskRepository.GetAsync(message.Id); if (publishDocumentTask == null) { publishDocumentTask = new PublishDocumentTask(message); PublishDocumentTaskRepository.Save(publishDocumentTask); await NotifyService.SendNotificationAsync(publishDocumentTask); } if (!CheckIsNeedToProcessMessage(publishDocumentTask)) { return(true); } var documentPublicationInfo = await ProcessMessage(message, cancellationToken); SavePublishTaskInfo(publishDocumentTask, documentPublicationInfo); await NotifyService.SendNotificationAsync(publishDocumentTask); if (documentPublicationInfo.ResultType == PublicationResultType.Processing) { var updateMessage = CreatePublishUpdateMessage(message, documentPublicationInfo.RefId); EventBus.PublishMessage(updateMessage); return(false); } var documentPublishResultEventMessage = new DocumentPublishResultEventMessage { UserId = message.UserId, Id = message.Id, CreatedAt = message.CreatedAt, LoadId = documentPublicationInfo.LoadId, ResultType = documentPublicationInfo.ResultType }; EventBus.PublishMessage(documentPublishResultEventMessage); return(true); } catch (OperationCanceledException) { throw; } catch (Exception e) { _logger.LogError(e, "Возникла ошибка при обработке сообщения"); return(false); } }
public ActionResult Detail(int id) { ViewBag.Type = WebUtil.GetEnumSelectList <Notifi_Type>(); ViewBag.UserCreate = new SelectList(HoaDonService.GetNhanvien(), "ID", "FullName"); var model = NotifyService.GetById(id); //TODO return(View("Detail", model)); }
public HomeController(IMemoryCache cache, IConfiguration configuration, SecurityService securityService, NotifyService notifyService) { this.cache = cache; this.configuration = configuration; this.securityService = securityService; this.notifyService = notifyService; }
public ManagerController(IConfiguration configuration, ArticleDbContext articleDbContext, NotifyService notifyService, IMemoryCache memoryCache) { this.articleDbContext = articleDbContext; this.configuration = configuration; this.notifyService = notifyService; this.memoryCache = memoryCache; }
public HomeController(IMemoryCache cache, NotifyService notifyService, SecurityService securityService, ProfileService userInfoService) { this.cache = cache; this.notifyService = notifyService; this.securityService = securityService; this.userInfoService = userInfoService; }
public async override Task <TollGeolocationStatus> CheckStatus() { var location = GeoWatcher.Location; var waypoints = GeoDataService.FindNearestEntranceTollPoints(location); WaypointChecker.SetTollPointsInRadius(waypoints); if (waypoints.Count == 0) { return(TollGeolocationStatus.NotOnTollRoad); } var insideTollPoint = WaypointChecker.DetectWeAreInsideSomeTollPoint(location); if (insideTollPoint != null) { double radius = insideTollPoint.Radius != 0 ? insideTollPoint.Radius / 1000 : SettingsService.WaypointSmallRadius * 1000; Log.LogMessage($"We are inside tollpoint {radius} radius"); WaypointChecker.SetIgnoredChoiceTollPoint(insideTollPoint); if (WaypointChecker.TollPointsInRadius.Count == 1) { GeoWatcher.StopUpdatingHighAccuracyLocation(); } if (await SpeechToTextService.AskQuestion($"Are you entering {insideTollPoint.Name} tollroad?")) { WaypointChecker.SetEntrance(insideTollPoint); if (insideTollPoint.WaypointAction == WaypointAction.Bridge) { WaypointChecker.SetExit(insideTollPoint); WaypointChecker.SetTollPointsInRadius(null); await NotifyService.Notify("Bill was created"); WaypointChecker.ClearData(); return(TollGeolocationStatus.NotOnTollRoad); } else { return(TollGeolocationStatus.OnTollRoad); } } else { return(TollGeolocationStatus.NotOnTollRoad); } } else { return(TollGeolocationStatus.NearTollRoadEntrance); } }
public static int GetNotifyCount() { try { using (var notifyService = new NotifyService()) { return(notifyService.GetAll().Count()); }; } catch (Exception) { throw; } }
/// <summary> /// 分页查询进出记录 /// </summary> /// <param name="PageSize"></param> /// <param name="PageIndex"></param> /// <param name="SchoolID"></param> /// <returns></returns> public static List <Models.EnterAndLeave> GetNotify(int PageSize, int PageIndex, int SchoolID) { try { using (var notifyService = new NotifyService()) { return(notifyService.GetAll(m => m.SchoolID == SchoolID, false, PageSize, PageIndex).ToList()); }; } catch (Exception ex) { throw new Exception(ex.Message); } }
public IActionResult Index() { var user = UserService.Find(t => t.login == User.Identity.Name); var model = NotifyService .Include(t => t.Recipient) .Include(t => t.Sender) .Include(t => t.Project) .FindAll(t => t.RecipientId == user.Id); return(View(model)); }
private void CheckSelfUpdate() { PackageManager m = new PackageManager(); _selfUpdate = m.GetManagerUpdate(new Core.Models.Version(Assembly.GetExecutingAssembly().GetName().Version.ToString())); if (_selfUpdate != null) { menuItem_update.Visibility = Visibility.Visible; NotifyService.Notify(new Notification("Update", "There is a update for VoukoderManager. Click to install it"), DoSelfUpdate); } }
public ArticleController(IConfiguration configuration, ArticleDbContext articleDbContext, OssService ossService, NotifyService notifyService) { this.articleDbContext = articleDbContext; this.ossService = ossService; this.notifyService = notifyService; this.configuration = configuration; pageSize = configuration.GetValue <int>("PageSize"); }
//[AuthorizeAdmin(Permissions = new Permission[] { Permission.Floor_Create, Permission.Floor_Edit })] public ActionResult Create(NOTIFY model) { var result = NotifyService.Create(model); return (Json( new RedirectCommand() { Code = result.Code, Message = result.Message, Url = Url.Action("IndexUser", new { id = model.ID }) }, JsonRequestBehavior.AllowGet)); }
public NotifyServiceTests() { var mockEnv = new Mock <IEnv>(); mockEnv.Setup(m => m.NotifyApiKey).Returns("api_key"); _mockNotificationClient = new Mock <INotificationClientAdapter>(); _mockLogger = new Mock <ILogger <NotifyService> >(); _service = new NotifyService(_mockLogger.Object, _mockNotificationClient.Object, mockEnv.Object); _personalisation = new Dictionary <string, dynamic> { { "pin_code", "123456" } }; }
public static void Main(string[] args) { Thread.Sleep(TimeSpan.FromSeconds(60)); IUnitOfWork unitOfWork = new UnitOfWork(); ICassandraService cassandraService = new CassandraService(unitOfWork); IMessageService messageService = new MessageService(unitOfWork); INotifyService notify = new NotifyService(unitOfWork, messageService, cassandraService); IConsumerService consumer = new ConsumerService(unitOfWork, notify); consumer.Consume(); CreateHostBuilder(args).Build().Run(); }
public MainWindow(string token) { InitializeComponent(); _token = token; _restService = new RestService <Ticket, string>("https://localhost:44398", "/api/ticket", _token); _notifyService = new NotifyService("https://localhost:44398/api/ticketHub"); _notifyService.AddHandler("TicketUpdate", async() => await Sync()); _notifyService.Init(); Sync(); }
public FeedsController(VoteItDBContext context, FeedRepository feedRepository, UserManager <IdentityUser> userManager, UserRepository userRepository, NotifyService notifyService, FeedService feedService) { this._context = context; this._feedRepositry = feedRepository; this._userManager = userManager; this._userRepository = userRepository; this._notifyService = notifyService; this._feedService = feedService; }
public ActionResult Notify(int?flag, int?ma) { if (flag.HasValue) { NotifyService.ChangeStatus(); } if (ma.HasValue) { NotifyService.ChangeStatusNotifyId(ma); } var model = NotifyService.GetNotify(); return(PartialView("_Notify", model)); }
public AttackController(ILogger <AttackController> logger, IHubContext <AttackHub> hubContext, DnsDbContext dnsDb, AttackService attackService, NotifyService notifyService, RedisService redisService) { _logger = logger; _hubContext = hubContext; _dnsDb = dnsDb; _attackService = attackService; _notifyService = notifyService; _redisService = redisService; }
public TicketLogic(string token) { notifyService = new NotifyService("https://localhost:44346/ticketHub"); notifyService.AddHandler <Ticket>("NewTicket", (value) => GetTicket(value)); //notifyService.AddHandler<string>("Disconnected", (value) => MessageBox.Show(value, "Hiba történt", MessageBoxButton.OK, MessageBoxImage.Error)); //notifyService.AddHandler<string>("Connected", (value) => this.Title += " id: " + value); notifyService.Init(); rest = new RestService <Ticket, string>( "https://localhost:44346/", "/api/ticket", token); Init(); }
private void Package_InstallationFinished(object sender, OperationFinishedEventArgs e) { if (!e.Cancelled) { if (e.Entry.ComponentType == ProgramType.VoukoderCore || ((VKPackage)e.Entry).Dependencies != null) { LoadProgramLists(); } else { UpdateProgramList(e.Entry, e.OperationType); } NotifyService.Notify(new Notification("Info", "Installation finished")); } }