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()); } } }
private static void CreateVoiceFile(string toBeVoiced, string nameID, string companyID, string department, string dateOfAppointment,string timeOfAppointment) { string fileName = string.Empty; string sequence = string.Empty; string liveOrVoice = string.Empty; fileName = 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 = 200; // reader.Rate = 200; reader.SelectVoice("Microsoft Zira Desktop"); reader.SelectVoice(System.Configuration.ConfigurationManager.AppSettings["voiceName"]); try { reader.SetOutputToWaveFile(System.Configuration.ConfigurationManager.AppSettings["voiceFilePath"] + fileName, new SpeechAudioFormatInfo(11025, AudioBitsPerSample.Eight, AudioChannel.Mono)); //******************************************************************************** //used for testing //reader.SetOutputToWaveFile("\\\\1lake-reminder2\\c\\Waldenltd\\voicetest\\" + department + ".wav", new SpeechAudioFormatInfo(11025, AudioBitsPerSample.Eight, AudioChannel.Mono)); //**************************************************************************************** reader.Speak(toBeVoiced); } catch (Exception er) { string s1 = er.Message; } //insert live sequence = "1"; liveOrVoice = "L"; try { voicing = new Voicing(); voicing.NameID = int.Parse(nameID); voicing.CompanyID = int.Parse(companyID); voicing.AppDate = dateOfAppointment; voicing.AppTime = timeOfAppointment; voicing.FileName = fileName; 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 Voicing(); voicing.NameID = int.Parse(nameID); voicing.CompanyID = int.Parse(companyID); voicing.AppDate = dateOfAppointment; voicing.AppTime = timeOfAppointment; voicing.FileName = fileName; 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()); } }