Timers using windows service/webapplication - c#

1) In my application am scheduling meetings. 2) am collecting payment installments for purchase of an item (it has payment due dates). 3) Now I want to send notifications to the users i) for schedule events I need to send notification 5 min before the meeting time ii) for payment dues I need to send notifications from one week before to till payment due date
My application is a webapplication

1) In my application am scheduling meetings.
Store the scheduled meeting date somewhere persistent (e.g. in a database).
2) am collecting payment installments for purchase of an item (it has payment due dates).
Store the payment due date somewhere persistent (e.g. in a database).
3) Now I want to send notifications to the users
Send notification by email? Or send notification via HTML to their browser when they navigate to your webapplication?
i) for schedule events I need to send notification 5 min before the meeting time
Occasionally (e.g. once/minute) query your database to see which users have meetings scheduled within the next 5 minutes.

ASP.NET isn't great for something like this, because there is no guarantee that your application will be running at the moment it needs to perform the necessary processing.
It would be better to write either a Windows Service or a console app (triggered by Windows Task Scheduler). The service/app could use a timer (or poll/sleep loop) to check for items that need to be processed.

You need a scheduling framework like Quartz.Net

Related

How could I send the user an e-mail in ASP.NET when there is only 1 day left till an event?

So I'm making an appointment scheduler. I want my system to send the user an e-mail when the upcoming event is tomorrow. I'm storing every appointment in an SQL database.
I don't know how to check continuously if the date is within a day instead of only checking it once I load the View that lists these appointments.
I suggest you use existing scheduling engines such as Hangfire, Quartz.NET or similar
That way you can make recurring job that triggers once a day, checks for appointments and then send an email.

Trigger for a Pro active reminder bot

Hi I am making a reminder feature for a bot framework chat bot using c#.
What is the best trigger for a proactive reminder? I saw samples using task delay. is it applicable for reminder that can be set to 30 days from now or every 15 days? if I use a post API to send a proactive reminder. Is there a third party app that can trigger the post request with data coming from a database automatically?
You probably don't want to use Task.Delay for the order of days - if you program dies during that time the reminder will be lost.
Usually you would store a DateTime for when the reminder should fire, then have a job that polls every so often and if the current DateTime is after that one, then it fires. This way it will survive reboots/changing instances etc. and as a bonus makes it easier to test your logic and change the reminder date and time after it is saved.

Time-based notifications on Windows Azure

I have been building a Windows Phone 8 app and Windows Azure cloud service that will allow people to store schedules in the cloud. I have implemented a single sign on system and a cloud service used to store the schedule items.
I have also started building a cloud service to send push notifications however the plan is to send notifications based on scheduled times that have been stored in the cloud, the notification system works however only if I send a notification with a tester application.
Does anyone know how to send notifications based on a time record in an SQL database on Azure?
Thanks
As far as i understand you want a user to make a todoitem with a timestamp.?
If this is true, you could do it in some different ways. The easiest and most expensive is to only use azure. Then you need to use azure scheduler, to compare a time stamp with the current time and when the current time exceeds the time stamp, you send a push notification.
A cheaper way is to have an old pc, where you install server capabilities and go to the server and check the database with the time stamp. And then invoke a server api when you have a match.
But be aware of timezones :)
A link about timestamp in Azure tables
How to use Windows Azure Table Storage Timestamp or Etag field
Are you referring to the Azure Scheduler in Mobile Services?
Check out this link.
Otherwise I believe you'd need to have a service running that will run a task on scheduled times and occasionally poll the database for new times to run (pretty simple to do. Sounds like you probably have most of that already).

Invoke popup as reminder in asp.net MVC

I have a functionality where I need to remind the customers about their appointments before the time interval set while creating the appointment.
Example:
A customer is logged into the system today at 4:00PM.
If a customer has an appointment set today at 5:00PM , and the reminder minutes as 10.
This invokes a popup with beepsound that has to appear today at 4:50PM(i.e 10 minutes before the actual appointment start time).
I have all appointments with start time, end time , (along with the dates) stored in backend table for number of customers.
Please guide me to achive the following in realtime :
(1) to invoke this popup at 4.50PM
(2) play the soundfile stored in the database
From my search,there is a way to do this using signalr concept in mvc. I went through the sample for chat application in this lnk.
http://www.asp.net/signalr/overview/getting-started/tutorial-getting-started-with-signalr
This invokes the hub when a event occurs. but in my application it has to work as a reminder to show the popup if the start time matched the current time. how to get this in real time. Any idea can help me.
This could be a good situation to use WebSockets. (Take a look at Socket.IO, and it's .NET version SocketIO4Net)
The idea would be to have a business logic server side to manage what customer has an appointment to be reminded. Then it uses the WebSocket to send the reminder signal. If the customer is logged in, the js client side would catch the signal and you decide how you want to show it.
To play the sound stored in the database, you could do an action server side that returns the sound file or something, and then use an HTML 5 tag to play the sound.
Hope this helps.
Everything can be done but as ChristianDev says SignalR does not work like this out of the box... I think you can do this with SignalR anyway but you have a few challenges...
You have to maintain state on the server for the clients appointment
This state have to be persistent between connection, when a client navigates between pages
When an event fires you have to send the message to the correct client
If that client is between pages (offline) at the moment that message have to be stored until the client gets back online and then be sent to him/her.
EDIT: It seemed like a fun thing to write so a wrote a simple notification application. You can probably port it to SignalR pretty easy. Realtime Notification Sample
You could change the approach, and use a windows service, emailing/sms'ing the user to remind them of the appointment, this means that the user doesn't need to be logged into the web application to receive a reminder.
If you wanted to use technology such as SignalR, you would need to keep a record of connected users (and their username) and then when an appointment is due, you would need to trigger an event to send to the user in question, based on the unique connectionId.
SignalR, out of the box, doesn't work like this - but, take a look at my question here for some help : Update UI with SignalR and Knockout when manually updating DB
Edit: To add to this, if you're looking for a very nice notification plugin, then take a look at John Papa's ToastR, it's a small JS/Css plugin which notifies via a 'timed, outlook style notification'.

Windows service to send mail on certain days [duplicate]

I want to send email on certain calendar days say 20th of everymonth. How can i do this?
The problem is i am not so sure that this appliction will be browsed by users on 20th of the month. If not opened on this day, perhaps the mail can not be sent. Is there any way i can send it even if application is not running.
Thanks.
For this requirement I will write Windows Service Application. Service will run on server without user intervention and will be dependent on users to login.
High level Action Steps will be
Store Calendar Days
Allow Service to access this store and send emails (using predefined template?) on requested Date time.

Categories

Resources