ASP.NET Routine to make a Select everyday at midnight [closed] - c#

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
So, I'm creating a system in ASP.NET using SQL Server that sends email notification to people about their expiring documents. The user inputs the date of the document and it will warn the user about it's due time 5 days before.
I thought about creating some routine that runs everyday at midnight and (SELECT *) comparing the actual date and the due date. Should I create a Stored Procedure on SQL? Or something in my .CS file that runs with Microsoft Task Scheduler?

As far as I can see it, you don't need an ASP.NET app for this. You can simply have a SQL job running on your SQL Server that runs at midnight, runs your SP (stored procedure) which sends the appropriate email as required. SQL Server has facilities to send emails via SMTP.
If however you want to create something more sophisticated in ASP.NET I would definitely look into using Hangfire, which allows you to have jobs running in background in an ASP.NET application (or not). Hangfire can handle pretty complex job scenarios, have a look here: http://hangfire.io

Related

service in c# to connect to sql , [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have a database, and I need to write in c# a script to execute some statements and save the result of these statements to another database, and each statement has a condition like run daily or weekly.
Then I need to save this script like a service in the window server to run it automatically.
so 1 service, for many statements, and each statement has condition inside the service.
any suggestions, or examples for this scenario?
thank you
There are multiple options:
Write your code in a console application and convert it to a windows server. If you write the code perfectly and create some timer or or function to handle the jobs they whould be run exactly at the desired time. Manual here
Using windows task scheduler for each job and create a scheduler for them. For example if you have 3 jobs (hourly,daily and weekly) you can create three separated console application and create 3 scheduled jobs in windows task scheduler. Here you have a log of last execution time, the result, the erorr etc... More info here

Which is better, a scheduled task or windows service? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I have created a console program that transfers data from a database to a server. This program must run every day at a certain time. At first I thought of a scheduled task but the problem is that it depends on a user being logged in. However, as it is rather tricky and the service has to run every day, I came to the Windows service through my research.
However, most of the information comes from 2009 and 2010 and may already be outdated? I also found a guide explaining how to create a scheduled service:
https://www.aspsnippets.com/Articles/Simple-Windows-Service-that-runs-periodically-and-once-a-day-at-specific-time-using-C-and-VBNet.aspx
Is that still best practice to do it that way? What would you recommend?
Your first thought was right, use a scheduled task and select the 'Run whether user is logged on or not'.
If you use a Windows Service you have to code the trigger yourself which could be fraught with errors.
If you'd like something more 'enterprise' I'd suggest looking at Quartz.NET. It's an open source scheduling library, although it's probably overkill for what you're trying to achieve.

coldfusion Web vs c# Desktop [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
My employer writes intranet applications in coldfusion. I was writing a basic page that fetches sql data and saves it as a csv file, and kept thinking I would have preferred to write it in c# as a desktop application. Now, my company has reasons for using coldfusion, and reasons to continuing to use coldfusion, but I was wondering - I pulled about 50 calculated columns from 2 databases (one was oracle, the other ms sql) and saved the info as a csv file (which the end users open with excel) - Would a windows form have done this faster, or does the coldfusion code run faster (I used no client-side code)
Or, would it have been faster to just do the coldfusion portion as asp?
If you're asking desktop app vs. web app, web app will win out more times the not. Deploying code to a server that everyone can access vs. prompting users to upgrade a program on their desktop? Web wins out.
Is it faster to run a query and convert it to a CSV in web language A vs. web language B? That's trivial in any modern web language, the overhead is negligible.
If you want to argue for moving from web language A to web language B, then you have to prove the ROI in doing so. What's it going to cost to convert the intranet you have now to a different code base?

asp.net MVC automatic sending mail every day (without windows service) [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I am searching for the best way to create a automatic mail system which fires every day (e.g. 00:00:00) and sends a list of mails.
Which is the best option to perform this task without slow down my application or harm to the server.
I don't want to use windows service to achieve this task. because i am using a shared windows hosting and they don't allow me to run it on the server
Thank you.
Which database do you use ? If its MS Sql Server You can use
THE sp_send_dbmail as a part of a stored procedure to send email.
http://technet.microsoft.com/en-us/library/ms190307.aspx
You can then set up the stored procedure as a Sql Server Agent job to run at regular intervals as shown below
http://www.c-sharpcorner.com/UploadFile/raj1979/create-and-schedule-a-job-in-sql-server-2008/
You could put WCF service with Quartz.NET http://quartznet.sourceforge.net/ aboard on the same IIS or on another machine.
This approach also allows you to have API to control your scheduler.
Regrads.

Backend or database system for small business application [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I'm coding a program for a small business. The application's going to be used for store-keeping and the ordering of parts for a mechanical shop. I need some type of backend to store orders, article numbers & prices, customers and so on (obviously). Right now I'm using a local MySQL server and running queries directly from the code. This is not ideal because of the risk of a system meltdown or similar. I've thought about running a local MySQL server - with a scheduled backup on a remote host, but I'm hoping there's a better solution. For previous applications I've written a PHP wrapper, and used a web hotel to host the MySQL server - Which isn't ideal either for security reasons. I suppose I should mention the application's written with windows forms in the VS .net environment(in C#). My question's this: How do I set up a MySQL server (or other type of database system) on a remote host - that I can run queries on and then return the result back to the application? Preferably I wouldn't want to handle the MySQL server myself but outsource it. I don't mind renting a server from some host - if it will spare me the hassle of setting up a local server machine to run separately. Are there any solutions that you can rent for this purpose? I'm sure there must be tons of information about this on the interwebs but I can't find anything. I would be very thankful if anyone could give me some pointers!
One way you could do this is rent a cheap VPS and host mysql in there. I have been using DigitalOcean, and it is pretty good. For your needs a $5 per month VPS would be enough.
Or you could use Azure. http://www.windowsazure.com/en-us/services/data-management/

Categories