private void ServiceTimer_Tick(object sender, System.Timers.ElapsedEventArgs e)
        {
            try
            {
                this._timer.Stop();
                Log("timer stopped");

                try
                {
                    int instances = 0;

                    //Check for more then one instance of program running
                    foreach (Process P in Process.GetProcessesByName("WaldenFaxProgram"))
                    {
                        instances++;
                    }

                    //Do not run more then one instance of program
                    if (instances > 1)
                    {
                        return;
                    }

                    applicationPath =
                       Process.GetCurrentProcess().MainModule.FileName
                       .Replace("WaldenFaxProgram.exe", "")
                       .Replace("WaldenFaxProgram.vshost.exe", "");

                    Common.Log("Begin WaldenFaxProgram");

                    useNine = System.Configuration
                        .ConfigurationManager.AppSettings["UseNine"];
                    Common.AccountID = int.Parse(System.Configuration
                        .ConfigurationManager.AppSettings["practiceID"]);

                    //Common.GetScanningInformation();                
                    Common.StoreComputer = System.Configuration
                        .ConfigurationManager.AppSettings["StoreComputer"];
                    Common.StoreShare = System.Configuration
                        .ConfigurationManager.AppSettings["StoreShare"];

                    Database.WaldenConnect = System.Configuration
                        .ConfigurationManager.AppSettings["walden"];

                    tsid = System.Configuration
                        .ConfigurationManager.AppSettings["TSID"];

                    Logging.ApplicationPath = applicationPath + "\\";
                    Common.ApplicationPath = applicationPath + "\\";

                    Common.FaxFolder = System.Configuration
                      .ConfigurationManager.AppSettings["FaxFolder"];


                    SendOutGoingFaxesV2();

                    sendMultiTechFax = new SendFaxMultitech();


                    sendMultiTechFax.GetFaxResults(applicationPath);


                }
                catch { }

                this._timer.Start();
                Log("timer started");
            }
            catch (Exception er)
            {

                this._timer.Start();
                Log("timer started Error 6");
            }
        }
        public static void SendOutGoingFaxesV2()
        {
            string returnString = string.Empty;
            try
            {
                using (SqlConnection cn = new SqlConnection(Database.WaldenConnect))
                {
                    cn.Open();
                    using (SqlCommand cm = cn.CreateCommand())
                    {
                        cm.CommandText = "SELECT FaxName,FaxPath,"
                        + " RecipientName,FaxNumber,SendID,FaxPath"
                        + " from FaxesSendServer"
                        + " where AccountID = " + Common.AccountID
                        + " and FaxSent = 'N'"
                        + " and sendid = 58263"

                        + "order by faxsent,createtime desc";

                        SqlDataReader dr = cm.ExecuteReader();
                        while (dr.Read())
                        {
                            sendMultiTechFax = new SendFaxMultitech();

                            returnString = string.Empty;

                            returnString = sendMultiTechFax.SendTheFax(dr.GetString(0), dr.GetString(1),
                                dr.GetString(2), dr.GetString(3),
                                dr.GetInt32(4).ToString(), applicationPath);

                            if (returnString == "OK")
                            {
                                //Debug.WriteLine("update FaxesSend "
                                //    + " set FaxSent = 'Y'"
                                //    + " where SendID = "
                                //    + dr.GetInt32(4).ToString());
                                ExecuteInsertUpdateDelete(
                                    "update FaxesSendServer "
                                    + " set FaxSent = 'Y'"
                                    + " where SendID = "
                                    + dr.GetInt32(4).ToString());
                            }
                            else
                            {
                                Logging.Log(returnString);
                            }
                        }
                    }
                }
            }
            catch (Exception er)
            {
                try
                {
                    //Debug.WriteLine(er.Message);
                    Common.Log(er.Message);
                }
                catch (Exception mer)
                {
                    Common.Log(mer.Message);
                }
            }
        }