コード例 #1
0
        public void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            DateTime current = DateTime.Now;

            //Setting the time to 7PM
            if ((current.Hour == 7 && current.Minute == 30 && current.Second == 00) || (current.Hour < 00 && current.Minute == 0 && current.Second == 0))
            {
                //MessageBox.Show("Reports have been generated.", "Check Notifications", MessageBoxButtons.OK, MessageBoxIcon.Information);
                file = Utilities3.generatePDF(); //Generates the pdf at 7PM (Or between 7PM and 12Midnight) and saves it in local computer.
                Utilities3.sendEmail(file);      //Sends the file to a given location (Location is specified at sendEmail() method.

                //file is a String where it comprises of the location (Address) where the generated PDF is located. You can change it in generatePDF() method.
                //check out sendEmail(String file) for more information.

                try
                {
                    //Thread managements. Have doubts on this.
                    UpdateMessageBox upd = UpdateTheMessageBox;
                    Invoke(upd);
                }
                catch (Exception ex)
                {
                    //MessageBox.Show(ex.ToString());
                }
            }
        }
コード例 #2
0
 void UpdateTheMessageBox(String str)
 {
     MessageBox.Show("Reports are generated for the day!");
     MessageBox.Show("Reports are generated for the day22222!");
     file = Utilities3.generatePDF();
     Utilities3.sendEmail(file);
     showNotification();
 }
コード例 #3
0
        private void cashier_form_Load(object sender, EventArgs e)
        {
            showNotification();
            //Initiating the timer
            if (DateTime.Now.Day == 28) //Ever29th of the month, a monthly report will get emailed.
            {
                file2 = Utilities3.generateMothlyReportS();
                Utilities3.sendEmail(file2);
            }

            timer          = new System.Timers.Timer();
            timer.Interval = 1000;
            timer.Elapsed += Timer_Elapsed;

            timer.Start();
        }
コード例 #4
0
 private void button2_Click_1(object sender, EventArgs e)
 {
     Utilities3.generateMothlyReport();
     //generateMothlyReport();
 }
コード例 #5
0
 private void button3_Click(object sender, EventArgs e)
 {
     //When the user presses this, he'd generate a PDF, saves it in his local computer and sends it to a designated email address.
     //generatePDFtoRange();
     Utilities3.generatePDFtoRange(date_chkbox.Checked, from_dtp.Value.ToString("yyyy-MM-dd"), to_dtp.Value.ToString("yyyy-MM-dd"));
 }