系统托盘通知程序 - 在 SQL Server 中创建新记录时触发
在支持服务台工作。 新的票证进来,并在 SQL 表中创建记录,并将它们转储到任何分析师都可以提取的特定类别。
当有新工单时,前端不会通知分析师,因此必须不断刷新前端(浏览器)以查看新工单是否进入“待分配”文件夹。
我想创建一个位于系统托盘中的通知程序(类似于 GMail Notifier)。
有人有一些好的起点,或者可能的片段,可以给我一些热情,让我真正开始创建某种通知程序?
谢谢
Work on a support helpdesk.
New tickets come in and records are created in a SQL Table and they are dumped to a specific category where any analyst can pick them up.
Front end does not notify analysts when there are new tickets, so have to contonously refresh the front-end (browser) to see if new tickets are coming into the 'To Be Assigned' folder.
Id like to create a notifier (similar to something like GMail Notifier) that sits in the system tray.
Anyone got some good starting points, or possible snippets that would give me some enthusiasm to actually get onto creating some sort of notifier?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
轮询是实现此目的的一种方法,但如果您使用的是 SQL Server 2005 或更高版本,更优雅的解决方案是使用 SQL Server 查询通知。这允许您指定查询(例如“SELECT ID FROM Tickets”)并在结果更改时收到通知。关于如何在 CodeProject 上执行此操作,有一个很棒的教程:
http://www.codeproject .com/KB/database/QueryNotifications.aspx
Polling is one way to do this, but if you are using SQL Server 2005 or later, a more elegant solution is to use SQL Server Query Notifications. This allows you to specify a query (for example "SELECT ID FROM Tickets") and be notified when the results change. There is a great tutorial on how to do this on CodeProject:
http://www.codeproject.com/KB/database/QueryNotifications.aspx
如果您使用 .NET,则可以使用 Timer 对象并将“tick”间隔设置为 60 秒。在每个 Tick 事件中,您将轮询 SQL 数据库表并将最后一个工单记录创建的日期/时间存储在变量中。然后检查是否插入了创建日期/时间大于上次创建日期/时间的工单记录。您甚至可以添加另一个计时器组件来“倒计时”到下一次数据库轮询。如果你真的想变得更灵活,你可以将数据库轮询代码放在 BackGroundWorker 线程中,这样你的 GUI 在等待 SQL Server 连接时就不会出现空白。
If you are using .NET, you can use a Timer object and set the "tick" interval to 60 seconds. On every Tick event you would poll the SQL database table and store the date/time of the last ticket record creation in a variable. Then just check to see if there were any ticket records inserted with a creation date/time greater than the last creation date/time. You could even add another Timer component to "count down" to the next database poll. If you really wanted to get slick you put the database polling code in a BackGroundWorker thread so your GUI never blanks out while you wait for a SQL Server connection.
系统托盘通知程序基本上会执行与浏览器刷新相同的操作,对服务器执行 ping 操作以获取新记录。您可能希望它每 60 秒“ping”一次您的服务器,或者更快或更慢,具体取决于您希望收到通知的速度。
用 C# 制作一个几乎是微不足道的。但你没有说你会使用哪种语言。我确信 Java 人员来到这里会说这在 Java 中是微不足道的。然后一个蟒蛇家伙会进来告诉我们他可以做得更容易。
A systray notifier is basically going to do the same thing as a browser refresh, ping the server for new records. You'd probably want it to "ping" your server every 60 seconds, or faster or slower depending on how quick you want to be notified.
Making one in C# would be nearly trivial. But you didn't say which language you'd be using. I'm sure a Java guy would come in here and say its trivial in Java. A python guy would then come in and tell us both he can do it even easier.