Ejemplo n.º 1
0
        public Boolean SendFileCheck(string _filetofind)
        {
            Logger.DebugLog("SendFileCheck", false, false);


            if (SendFiles.CheckforFile(_filetofind) == true)
            {
                return(true);
            }
            else
            {
                Logger.DebugLog("***** Failed to send file *****", false, false);
                return(false);
            }
        }
Ejemplo n.º 2
0
        public void SendFilesNow(Boolean _fileErrortofindSend,
                                 Boolean _filesentfound,
                                 Boolean _filetofindSend,
                                 string _fileErrortofind,
                                 string _filetofind)
        {
            if (_fileErrortofindSend == true)
            {
                Logger.DebugLog("ERROR FILE FOUND: " + _fileErrortofind + "  Path: " + System.Configuration.ConfigurationManager.AppSettings["errorlogpath"], false, false);
                //only send an error message
                GPIEmail.SendEmail(
                    System.Configuration.ConfigurationManager.AppSettings["emailAdministratorList"],
                    "*****@*****.**",
                    "Daily Paper Machines KPI FAILURE Report - " + _fileErrortofind,
                    "No files were sent.");
            }
            else
            {
                if (_filesentfound == true)
                {
                    GPIEmail.SendEmail(
                        System.Configuration.ConfigurationManager.AppSettings["emailAdministratorList"],
                        "*****@*****.**",
                        "Daily Paper Machines KPI FAILURE Report - " + _filetofind,
                        "File was already sent.");
                }



                else if (_filetofindSend == true)
                {
                    // send the file
                    SendFiles.SendFilesNow(_filetofind);
                }


                else
                {
                    //no files found and time has exceeded
                    //send an email
                    NoFilesFound(_filetofind);
                }
            }
        }
        private void FormEmail_Load(object sender, EventArgs e)
        {
            Logger.DebugLog("Load", true, false);

            _filesentfound = SendFiles.CheckForSentFile(_filetofind); //check to see if file is already sent

            if (_filesentfound == true)
            {
                GPIEmail.SendEmail(
                    System.Configuration.ConfigurationManager.AppSettings["emailAdministratorList"],
                    "*****@*****.**",
                    "Daily Paper Machines KPI Report Already Sent: " + _filetofind,
                    "File was already sent.");
                StopApplication();
            }


            timer.Elapsed += new System.Timers.ElapsedEventHandler(Timer_Tick); // Every time timer ticks, timer_Tick will be called
            timer.Interval = (10) * (1);                                        // turn timer on now for a check
            timer.Start();
        }
        void Timer_Tick(object sender, EventArgs e)
        {
            //stop the timer to check for file
            timer.Enabled = false;


            //make sure the error log has not already been sent
            if (__fileErrorLogtofindSend == false)
            {
                //check to see if error file is there
                _fileLogErrorfound = SendFiles.CheckforErrorLog(_fileLogErrortofind);


                // if error log found send an email
                if (_fileLogErrorfound == true)
                {
                    //send the error log now
                    milldaily.SendErrorLog(_fileLogErrortofind);

                    //set to true so it will not be sent while the progrma is running.
                    __fileErrorLogtofindSend = true;
                }
            }



            if (_filetofindSend == false) //make sure the file has not been found

            {
                _filefound = SendFiles.CheckforFile(_filetofind); //check to see if file is there
                if (_filefound == true)
                {
                    // GO SEND THE FILES
                    _filetofindSend = true;  // file was found
                    milldaily.SendFilesNow(_fileErrortofindSend, _filesentfound, _filetofindSend, _fileErrortofind, _filetofind);



                    StopApplication();
                }



                //if (_fileErrortofindSend == false)  //make sure the error file has not been sent
                //{
                //    _fileErrorfound = SendFiles.CheckforFile(_fileErrortofind); //check to see if error file is there

                //    //looking for an pdf error file - this file may not always be there
                //    // if found an only an email will be sent later
                //    if (_fileErrorfound == true)
                //    {

                //        _fileErrortofindSend = true;
                //    }
                //}



                if (milldaily.CheckTimeExceeded(CheckMaxiumTimeToRun) == true)
                {
                    // need to send the files now
                    milldaily.SendFilesNow(_fileErrortofindSend, _filesentfound, _filetofindSend, _fileErrortofind, _filetofind);


                    StopApplication();
                }

                timer.Interval = (10) * (2000); // Timer will tick every 20 seconds
                timer.Enabled  = true;          //start timer back up
            }
        }