Click here to Skip to main content
15,896,207 members
Home / Discussions / C#
   

C#

 
GeneralRe: Reports every Monday at 7am. Pin
Jacob Dixon25-May-09 7:30
Jacob Dixon25-May-09 7:30 
GeneralRe: Reports every Monday at 7am. Pin
Luc Pattyn25-May-09 7:37
sitebuilderLuc Pattyn25-May-09 7:37 
GeneralRe: Reports every Monday at 7am. Pin
Le centriste28-May-09 8:33
Le centriste28-May-09 8:33 
GeneralRe: Reports every Monday at 7am. Pin
Jacob Dixon25-May-09 15:20
Jacob Dixon25-May-09 15:20 
AnswerRe: Reports every Monday at 7am. Pin
Le centriste25-May-09 7:18
Le centriste25-May-09 7:18 
AnswerRe: Reports every Monday at 7am. Pin
_Maxxx_25-May-09 12:27
professional_Maxxx_25-May-09 12:27 
GeneralRe: Reports every Monday at 7am. Pin
Jacob Dixon25-May-09 15:26
Jacob Dixon25-May-09 15:26 
AnswerRe: Reports every Monday at 7am. Pin
Jacob Dixon25-May-09 15:36
Jacob Dixon25-May-09 15:36 
What if I did this?

There is only one email I want to send at (or around) 7 am on Monday mornings.

So what if i set a boolean to false

private bool Ran = false;


Then on timer tick (every 2 minutes)

private void timerReport_Tick(object sender, EventArgs e)
{
    if (DateTime.Today.DayOfWeek == DayOfWeek.Monday)
    {
        if (!Ran)
        {
            PrepareReport();
            Ran = true;
        }
    }
    else Ran = false;
}


Basically every time the timer ticks and the day isn't Monday, it says Ran to false. Meaning that it hasnt Ran.
So if the day IS Monday and the boolean is FALSE, then it prepares and sends the report, then sets RAN to true.

So RAN wouldn't get set to FALSE until the day isn't Monday...

What do you guys think about this?

Waste of resources?
GeneralRe: Reports every Monday at 7am. Pin
_Maxxx_25-May-09 19:05
professional_Maxxx_25-May-09 19:05 
QuestionPop ContextMenu on NotifyIcon without mouse activity Pin
jackgeek25-May-09 5:58
jackgeek25-May-09 5:58 
QuestionRe: Pop ContextMenu on NotifyIcon without mouse activity Pin
jackgeek29-May-09 12:23
jackgeek29-May-09 12:23 
QuestionNeed help with TableAdapter problem [modified] Pin
kensai25-May-09 5:01
kensai25-May-09 5:01 
AnswerRe: Need help with TableAdapter problem Pin
Fahad Sadah25-May-09 7:28
Fahad Sadah25-May-09 7:28 
GeneralRe: Need help with TableAdapter problem Pin
kensai25-May-09 23:48
kensai25-May-09 23:48 
AnswerRe: Need help with TableAdapter problem Pin
kensai26-May-09 0:13
kensai26-May-09 0:13 
QuestionFile types Pin
viciouskinid25-May-09 4:13
viciouskinid25-May-09 4:13 
AnswerRe: File types Pin
harold aptroot25-May-09 4:44
harold aptroot25-May-09 4:44 
GeneralRe: File types Pin
viciouskinid25-May-09 5:17
viciouskinid25-May-09 5:17 
GeneralRe: File types Pin
harold aptroot25-May-09 5:31
harold aptroot25-May-09 5:31 
GeneralRe: File types Pin
viciouskinid25-May-09 7:07
viciouskinid25-May-09 7:07 
GeneralRe: File types Pin
harold aptroot25-May-09 7:28
harold aptroot25-May-09 7:28 
GeneralRe: File types Pin
viciouskinid25-May-09 8:19
viciouskinid25-May-09 8:19 
GeneralRe: File types Pin
harold aptroot25-May-09 8:35
harold aptroot25-May-09 8:35 
GeneralRe: File types Pin
viciouskinid25-May-09 10:19
viciouskinid25-May-09 10:19 
GeneralRe: File types Pin
harold aptroot25-May-09 10:42
harold aptroot25-May-09 10:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.