public void DeletePersonalizedGreeting(CallButlerAuthInfo authInfo, Guid personalizedGreetingID)
        {
            if (Authenticate(authInfo))
            {
                dataProvider.DeletePersonalizedGreeting(authInfo.CustomerID, personalizedGreetingID);

                // Delete any greeting associated with this
                DeleteGreeting(authInfo, personalizedGreetingID);
            }
        }
 public string GetLogErrorEmail(CallButlerAuthInfo authInfo)
 {
     if (Authenticate(authInfo))
         return Properties.Settings.Default.LogErrorEmailAddress;
     else
         return null;
 }
 public bool GetMultilingual(CallButlerAuthInfo authInfo)
 {
     return Authenticate(authInfo) ? Properties.Settings.Default.Multilingual : false;
 }
 public string GetLanguages(CallButlerAuthInfo authInfo)
 {
     return Authenticate(authInfo) ? Properties.Settings.Default.Languages : null;
 }
 public CallButlerDataset.LocalizedGreetingsDataTable GetLocalizedGreetingInDefaultLanguage(CallButlerAuthInfo authInfo, Guid greetingID)
 {
     return Authenticate(authInfo) ? GetLocalizedGreeting(authInfo, greetingID, GetDefaultLanguage(authInfo)) : null;
 }
 public CallButlerDataset.LocalizedGreetingsDataTable GetExtensionVoicemailGreeting(CallButlerAuthInfo authInfo, Guid extensionID)
 {
     return Authenticate(authInfo) ? GetLocalizedGreeting(authInfo, extensionID, GetDefaultLanguage(authInfo)) : null;
 }
        public string[] GetHoldMusic(CallButlerAuthInfo authInfo)
        {
            string[] fileList = new string[0];

            if (Authenticate(authInfo))
            {
                string holdMusicLocation = WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.HoldMusicRootDirectory);

                if (Directory.Exists(holdMusicLocation))
                {
                    fileList = Directory.GetFiles(holdMusicLocation);
                }
            }

            return fileList;
        }
 public int GetAnswerTimeout(CallButlerAuthInfo authInfo)
 {
     if (Authenticate(authInfo))
         return Properties.Settings.Default.AnswerTimeout;
     else
         return 0;
 }
 public string GetApplicationPermissions(CallButlerAuthInfo authInfo)
 {
     return Authenticate(authInfo) ? Properties.Resources.Permissions : null;
 }
        public bool DoesEmployeeHaveNewVoicemails(CallButlerAuthInfo authInfo, Guid extensionId)
        {
            if (Authenticate(authInfo))
            {
                CallButlerDataset.VoicemailsDataTable voicemailTable = dataProvider.GetVoicemails(extensionId);

                if (voicemailTable.Select("IsNew = True").Length > 0)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            else
            {
                return false;
            }
        }
        public object ExchangePluginData(CallButlerAuthInfo authInfo, Guid pluginID, string method, object data)
        {
            if (Authenticate(authInfo))
            {
                foreach (CallButler.Service.Plugin.CallButlerServicePlugin plugin in pluginManager.Plugins)
                {
                    if (plugin.PluginID == pluginID)
                        return plugin.ExchangePluginData(method, data);
                }
            }

            return null;
        }
 public void DeleteVoicemail(CallButlerAuthInfo authInfo, Guid extensionID, Guid voicemailID)
 {
     if (Authenticate(authInfo))
     {
         vmService.DeleteVoicemail(extensionID, voicemailID);
     }
 }
 public void DeleteScriptSchedule(CallButlerAuthInfo authInfo, Guid scriptScheduleID)
 {
     if (Authenticate(authInfo))
     {
         dataProvider.DeleteScriptSchedule(authInfo.CustomerID, scriptScheduleID);
     }
 }
        public void DeleteProvider(CallButlerAuthInfo authInfo, Guid providerID)
        {
            if (Authenticate(authInfo))
            {
                // Unregister our provider
                telecomProvider.Unregister(providerID);

                dataProvider.DeleteProvider(authInfo.CustomerID, providerID);
            }
        }
        public CallButlerDataset.ExtensionsDataTable GetExtensionNumber(CallButlerAuthInfo authInfo, int extensionNumber)
        {
            if (Authenticate(authInfo))
            {
                WOSI.CallButler.Data.CallButlerDataset.ExtensionsDataTable extensionTable = new CallButlerDataset.ExtensionsDataTable();
                WOSI.CallButler.Data.CallButlerDataset.ExtensionsRow extension = dataProvider.GetExtensionNumber(authInfo.CustomerID, extensionNumber);

                if (extension != null)
                    extensionTable.ImportRow(extension);

                return extensionTable;
            }
            else
            {
                return null;
            }
        }
        //public bool FirstTimeRun
        //{
        //    get
        //    {
        //        return Properties.Settings.Default.FirstTimeRun;
        //    }
        //    set
        //    {
        //        Properties.Settings.Default.FirstTimeRun = value;
        //        Properties.Settings.Default.Save();
        //    }
        //}
        public AudioCodecInformation[] GetAudioCodecs(CallButlerAuthInfo authInfo)
        {
            if (Authenticate(authInfo))
            {
                List<AudioCodecInformation> codecs = new List<AudioCodecInformation>();

                foreach (CallButler.Telecom.AudioCodecInformation acInfo in telecomProvider.GetAudioCodecs())
                {
                    WOSI.CallButler.ManagementInterface.AudioCodecInformation newAcInfo = new AudioCodecInformation();

                    newAcInfo.Enabled = acInfo.Enabled;
                    newAcInfo.Name = acInfo.Name;

                    codecs.Add(newAcInfo);
                }

                return codecs.ToArray();
            }
            else
                return null;
        }
        public CallButlerDataset.ExtensionsDataTable GetExtensions(CallButlerAuthInfo authInfo)
        {
            if (Authenticate(authInfo))
            {
                int maxExtensions = 100; // Licensing.Management.AppPermissions.StatGetPermissionScalar("Extensions");

                if (maxExtensions != 0)
                    return (CallButlerDataset.ExtensionsDataTable)TrimRows(dataProvider.GetExtensions(authInfo.CustomerID), maxExtensions);
                else
                    return dataProvider.GetExtensions(authInfo.CustomerID);
            }
            else
                return null;
        }
 public string GetBusyRedirectServer(CallButlerAuthInfo authInfo)
 {
     if (Authenticate(authInfo))
         return Properties.Settings.Default.BusyRedirectServer;
     else
         return null;
 }
        public bool GetFirstTimeRun(CallButlerAuthInfo authInfo)
        {
            if (Authenticate(authInfo))
            {
                return Properties.Settings.Default.FirstTimeRun;
            }

            return true;
        }
 public WOSI.CallButler.Data.CallButlerDataset.CallHistoryDataTable GetCallHistory(CallButlerAuthInfo authInfo)
 {
     return Authenticate(authInfo) ? dataProvider.GetCallHistory(authInfo.CustomerID) : null;
 }
 public string GetHostedTestAddress(CallButlerAuthInfo authInfo)
 {
     return String.Empty;
 }
        //public string DefaultTTSVoice
        //{
        //    get
        //    {
        //        return Properties.Settings.Default.DefaultTTSVoice;
        //    }
        //    set
        //    {
        //        Properties.Settings.Default.DefaultTTSVoice = value;
        //        Properties.Settings.Default.Save();
        //    }
        //}
        public string GetDefaultVoice(CallButlerAuthInfo authInfo)
        {
            string defaultVoice = "";
            if (Authenticate(authInfo))
            {
                defaultVoice = Properties.Settings.Default.DefaultTTSVoice;
            }

            return defaultVoice;
        }
        public CallButlerDataset.LocalizedGreetingsDataTable GetLocalizedGreeting(CallButlerAuthInfo authInfo, Guid greetingID, Guid localizedGreetingID)
        {
            if (Authenticate(authInfo))
            {
                CallButlerDataset.LocalizedGreetingsDataTable lgTable = new CallButlerDataset.LocalizedGreetingsDataTable();
                CallButlerDataset.LocalizedGreetingsRow localizedGreeting = dataProvider.GetLocalizedGreeting(authInfo.CustomerID, greetingID, localizedGreetingID);

                if (localizedGreeting != null)
                    lgTable.ImportRow(localizedGreeting);

                return lgTable;
            }
            else
            {
                return null;
            }
        }
 public CallButlerDataset.DepartmentsDataTable GetDepartments(CallButlerAuthInfo authInfo)
 {
     return Authenticate(authInfo) ? dataProvider.GetDepartments(authInfo.CustomerID) : null;
 }
        public byte[] GetLocalizedGreetingSound(CallButlerAuthInfo authInfo, Guid greetingID, Guid localizedGreetingID)
        {
            if (Authenticate(authInfo))
            {
                // First, find our greeting
                WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsRow localizedGreeting = dataProvider.GetLocalizedGreeting(authInfo.CustomerID, greetingID, localizedGreetingID);

                if (localizedGreeting != null)
                {
                    string greetingFilename = WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.GreetingSoundRootDirectory) + "\\" + localizedGreeting.LanguageID + "\\" + localizedGreeting.GreetingID.ToString() + ".snd";

                    if (File.Exists(greetingFilename))
                        return WOSI.Utilities.FileUtils.GetFileBytes(greetingFilename);
                }
                return null;
            }
            else
            {
                return null;
            }
        }
        public CallButlerDataset.ExtensionsDataTable GetEmployeeExtension(CallButlerAuthInfo authInfo, int extension, string password)
        {
            if (Authenticate(authInfo))
            {
                WOSI.CallButler.Data.CallButlerDataset.ExtensionsDataTable extensionsTable = GetExtensionNumber(authInfo, extension);

                if (extensionsTable.Count > 0)
                {
                    // If the passwords don't match, send an empty data table
                    if (extensionsTable[0].Password != password)
                    {
                        return new CallButlerDataset.ExtensionsDataTable();
                    }
                }

                return extensionsTable;
            }
            else
            {
                return null;
            }
        }
 public string GetManagementPassword(CallButlerAuthInfo authInfo)
 {
     return Properties.Settings.Default.ManagementPassword;
 }
 public CallButlerDataset.ExtensionContactNumbersDataTable GetExtensionContactNumbers(CallButlerAuthInfo authInfo, Guid extensionID)
 {
     return Authenticate(authInfo) ? dataProvider.GetExtensionContactNumbers(extensionID) : null;
 }
 public CallButlerDataset.VoicemailsDataTable GetNewEmployeeVoicemails(CallButlerAuthInfo authInfo, Guid extensionId)
 {
     if (Authenticate(authInfo))
     {
         CallButlerDataset.VoicemailsDataTable vmTable = GetVoicemails(authInfo, extensionId);
         CallButlerDataset.VoicemailsDataTable newVmTable = new CallButlerDataset.VoicemailsDataTable();
         DataRow[] rows = vmTable.Select("IsNew=true");
         return MergeVoicemailDataRows(rows);
     }
     else
     {
         return null;
     }
 }
        public void DeleteHoldMusic(CallButlerAuthInfo authInfo, string fileName)
        {
            if (Authenticate(authInfo))
            {
                string fileLocation = WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.HoldMusicRootDirectory);
                fileLocation = Path.Combine(fileLocation, fileName);

                if (File.Exists(fileLocation))
                {
                    File.SetAttributes(fileLocation, FileAttributes.Normal);
                    File.Delete(fileLocation);
                }
            }
        }