private static void CreateVoiceFile(VoicingParameters voicingParameters, string toBeVoiced,string dateOfApplication,string timeOfApplication)
        {
            string fileName = string.Empty;
            string mp3FileName = string.Empty;
            SpeechSynthesizer reader;
            string sequence = string.Empty;
            string liveOrVoice = string.Empty;
            fileName = Common.GetFileNameFromDateTimeString() + ".wav";

            //Create voice file 
            //Save voice file
            //Insert live into voicing table
            //Insert vouce mail into voicing table
            reader = new SpeechSynthesizer();
            //  reader.
            reader.Volume = 100;
            reader.Rate = voicingParameters.Rate;
            reader.SelectVoice(voicingParameters.VoiceName);
            
            //reader.Rate = -2;
            //reader.SelectVoice("Microsoft Zira Desktop");
            
            try
            {
                //reader.SetOutputToWaveFile(voiceFilePath + fileName, new SpeechAudioFormatInfo(11025, AudioBitsPerSample.Sixteen, AudioChannel.Mono));
                //reader.SetOutputToWaveFile(voicingParameters.VoiceFilePath + fileName, new SpeechAudioFormatInfo(16025, AudioBitsPerSample.Sixteen, AudioChannel.Mono));
                reader.SetOutputToWaveFile(voicingParameters.VoiceFilePath + fileName, new SpeechAudioFormatInfo(48000, AudioBitsPerSample.Sixteen,AudioChannel.Stereo));
                //********************************************************************************
                //used for testing
                //reader.SetOutputToWaveFile("\\\\1lake-reminder2\\c\\Waldenltd\\voicetest\\" + department + ".wav", new SpeechAudioFormatInfo(11025, AudioBitsPerSample.Eight, AudioChannel.Mono));
                //****************************************************************************************
                reader.Speak(toBeVoiced);
                reader.Dispose();
                mp3FileName = fileName.Replace(".wav",".mp3");
                //ConvertWavFileTOMP3.WaveToMP3(voicingParameters.VoiceFilePath + fileName
                //    , voicingParameters.VoiceFilePath + mp3FileName);
                File.Delete(voicingParameters.VoiceFilePath + fileName);
            }
            catch (Exception er)
            {
                string s1 = er.Message;
            }

            //insert live
            sequence = "1";
            liveOrVoice = "L";
            HelpDeskTickets.Model.Voicing voicing = new HelpDeskTickets.Model.Voicing();
            PatientRecords patientRecords = new PatientRecords();
            try
            {
                voicing.NameID = int.Parse(voicingParameters.NameID);
                voicing.TelephoneID = int.Parse(voicingParameters.TelephoneID);
                voicing.CompanyID = int.Parse(voicingParameters.CompanyId);
                voicing.AppDate = dateOfApplication;
                voicing.AppTime = timeOfApplication;
                voicing.FileName = mp3FileName;
                voicing.Sequence = int.Parse(sequence);
                voicing.pPrevious = "Null";
                voicing.nNext = "Null";
                voicing.LiveorVoice = liveOrVoice;
                patientRecords.InsertVoiceRecord(voicing);
            }
            catch (Exception er)
            {
                //Log.WhichProgram = "Labcorp Interface";
                Log.LogMessage(er.ToString());
            }

            //insert voice
            sequence = "1";
            liveOrVoice = "V";

            try
            {
                voicing = new HelpDeskTickets.Model.Voicing();
                voicing.NameID = int.Parse(voicingParameters.NameID);
                voicing.TelephoneID = int.Parse(voicingParameters.TelephoneID);
                voicing.CompanyID = int.Parse(voicingParameters.CompanyId);
                voicing.AppDate = dateOfApplication;
                voicing.AppTime = timeOfApplication;
                voicing.FileName = mp3FileName;
                voicing.Sequence = int.Parse(sequence);
                voicing.pPrevious = "Null";
                voicing.nNext = "Null";
                voicing.LiveorVoice = liveOrVoice;
                patientRecords.InsertVoiceRecord(voicing);
            }
            catch (Exception er)
            {
                //Log.WhichProgram = "Labcorp Interface";
                Log.LogMessage(er.ToString());
            }
        }
        public void InsertVoiceRecord(Voicing voicing)
        {
            using (MySqlConnection db = new MySqlConnection(Database.ReminderConnection))
            {
                try
                {
                    const string query =
                        "insert into voicing(NameID,TelephoneID,CompanyId,AppDate,"
                        + "AppTime,FileName,Sequence,pPrevious,nNext,"
                        + "LiveorVoice)values("
                        + "@NameID,@TelephoneID,@CompanyId,@AppDate,"
                        + "@AppTime,@FileName,@Sequence,@pPrevious,@nNext,"
                        + "@LiveorVoice)";

                    int rowsAffectd = db.Execute(query, voicing);
                }
                catch (Exception er)
                {
                    string s1 = er.Message;
                    //Log.WhichProgram = "Labcorp Interface";
                    Log.LogMessage(er.ToString());
                }
            }
        }