private void PersistDepartmentGreeting(WOSI.CallButler.Data.CallButlerDataset.DepartmentsRow department, WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsRow localizedGreeting, Forms.DepartmentForm dpForm) { // If the department is a greeting, add a new localized greeting if (department.Type == (short)WOSI.CallButler.Data.DepartmentTypes.Greeting) { WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsDataTable localizedGreetingTable = new WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsDataTable(); bool newRowCreated = false; if (localizedGreeting == null) { localizedGreeting = localizedGreetingTable.NewLocalizedGreetingsRow(); localizedGreeting.LocalizedGreetingID = Guid.NewGuid(); localizedGreeting.GreetingID = department.DepartmentID; localizedGreeting.LanguageID = GetCurrentLanguage(); localizedGreetingTable.AddLocalizedGreetingsRow(localizedGreeting); newRowCreated = true; } //else dpForm.GreetingControl.SaveGreeting(WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.GreetingsSoundCache), localizedGreeting); if (newRowCreated == false) { localizedGreetingTable.ImportRow(localizedGreeting); } ManagementInterfaceClient.ManagementInterface.PersistLocalizedGreeting(ManagementInterfaceClient.AuthInfo, localizedGreetingTable); // Send our greeting sound file Utils.GreetingUtils.PersistLocalizedGreetingSound(localizedGreeting); } }
private void EditPersonalizedGreeting(WOSI.CallButler.Data.CallButlerDataset.PersonalizedGreetingsRow pgRow) { // Get our localized greeting WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsDataTable lgTable = ManagementInterfaceClient.ManagementInterface.GetLocalizedGreetingInDefaultLanguage(ManagementInterfaceClient.AuthInfo, pgRow.PersonalizedGreetingID); if (lgTable.Count == 0) { // If no localized greeting exists, add a new one WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsRow lgRow = lgTable.NewLocalizedGreetingsRow(); lgRow.LocalizedGreetingID = Guid.NewGuid(); lgRow.GreetingID = pgRow.PersonalizedGreetingID; lgRow.LanguageID = ManagementInterfaceClient.ManagementInterface.GetDefaultLanguage(ManagementInterfaceClient.AuthInfo); lgRow.Type = (short)WOSI.CallButler.Data.GreetingType.SoundGreeting; lgTable.AddLocalizedGreetingsRow(lgRow); } Forms.PersonalizedGreetingForm pgForm = new CallButler.Manager.Forms.PersonalizedGreetingForm(pgRow, callButlerDataset.Extensions); pgForm.GreetingControl.LoadGreeting(lgTable[0], WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.GreetingsSoundCache)); if (pgForm.ShowDialog(this) == DialogResult.OK) { pgForm.GreetingControl.SaveGreeting(WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.GreetingsSoundCache)); // Persist remotely ManagementInterfaceClient.ManagementInterface.PersistPersonalizedGreeting(ManagementInterfaceClient.AuthInfo, Utils.TableUtils <WOSI.CallButler.Data.CallButlerDataset.PersonalizedGreetingsDataTable> .CreateTableFromRow(pgRow)); ManagementInterfaceClient.ManagementInterface.PersistLocalizedGreeting(ManagementInterfaceClient.AuthInfo, lgTable); // Send our localized greeting sound file Utils.GreetingUtils.PersistLocalizedGreetingSound(lgTable[0]); callButlerDataset.AcceptChanges(); } }
private void EditExtension(WOSI.CallButler.Data.CallButlerDataset.ExtensionsRow extension) { short currentExt = extension.ExtensionNumber; // Get our extension contact numbers WOSI.CallButler.Data.CallButlerDataset.ExtensionContactNumbersDataTable contactNumbersTable = ManagementInterfaceClient.ManagementInterface.GetExtensionContactNumbers(ManagementInterfaceClient.AuthInfo, extension.ExtensionID); // Get our extension greeting WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsDataTable voicemailGreetings = ManagementInterfaceClient.ManagementInterface.GetLocalizedGreeting(ManagementInterfaceClient.AuthInfo, extension.ExtensionID, ManagementInterfaceClient.ManagementInterface.GetDefaultLanguage(ManagementInterfaceClient.AuthInfo)); WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsRow voicemailGreeting = null; if (voicemailGreetings.Count > 0) { voicemailGreeting = voicemailGreetings[0]; // Download our greeting sound if it exists Utils.GreetingUtils.GetLocalizedGreetingSound(voicemailGreeting); } else { // If the greeting doesn't exist, create a new one voicemailGreeting = voicemailGreetings.NewLocalizedGreetingsRow(); voicemailGreeting.GreetingID = extension.ExtensionID; voicemailGreeting.LocalizedGreetingID = Guid.NewGuid(); voicemailGreeting.LanguageID = ManagementInterfaceClient.ManagementInterface.GetDefaultLanguage(ManagementInterfaceClient.AuthInfo); voicemailGreeting.Type = (short)WOSI.CallButler.Data.GreetingType.SoundGreeting; voicemailGreetings.AddLocalizedGreetingsRow(voicemailGreeting); } WOSI.CallButler.Data.CallButlerDataset.ExtensionsDataTable origExt = (WOSI.CallButler.Data.CallButlerDataset.ExtensionsDataTable)callButlerDataset.Extensions.Copy(); // Show our extension editor form Forms.ExtensionEditorForm extensionForm = new CallButler.Manager.Forms.ExtensionEditorForm(callButlerDataset.Extensions, extension, contactNumbersTable, voicemailGreeting); if (extensionForm.ShowDialog(this) == DialogResult.OK) { // Check to make sure the extension isn't already taken if (currentExt != extension.ExtensionNumber && origExt.Select("ExtensionNumber = " + extension.ExtensionNumber).Length > 0) { MessageBox.Show(this, String.Format(CallButler.Manager.Utils.PrivateLabelUtils.ReplaceProductName(Properties.LocalizedStrings.ExtensionView_ExtTaken), extension.ExtensionNumber, currentExt), CallButler.Manager.Utils.PrivateLabelUtils.ReplaceProductName(Properties.LocalizedStrings.ExtensionView_ExtConflict), MessageBoxButtons.OK, MessageBoxIcon.Warning); extension.ExtensionNumber = currentExt; } // Edit our remote extension WOSI.CallButler.Data.CallButlerDataset.ExtensionsDataTable extensionDataTable = Utils.TableUtils <WOSI.CallButler.Data.CallButlerDataset.ExtensionsDataTable> .CreateTableFromRow(extension); ManagementInterfaceClient.ManagementInterface.PersistExtension(ManagementInterfaceClient.AuthInfo, extensionDataTable); // Edit our remote greeting ManagementInterfaceClient.ManagementInterface.PersistLocalizedGreeting(ManagementInterfaceClient.AuthInfo, voicemailGreetings); // Send our voicemail greeting sound file Utils.GreetingUtils.PersistLocalizedGreetingSound(voicemailGreeting); ManagementInterfaceClient.ManagementInterface.PersistExtensionContactNumbers(ManagementInterfaceClient.AuthInfo, contactNumbersTable); } }
public static void EditLocalizedGreeting(WOSI.CallButler.Data.CallButlerDataset greetingsData, Guid greetingID, string languageID, string suggestedText) { global::Controls.LoadingDialog.ShowDialog(null, CallButler.Manager.Utils.PrivateLabelUtils.ReplaceProductName(Properties.LocalizedStrings.GreetingUtils_SavingSounds), Properties.Resources.loading, false, 1000); WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsDataTable localizedGreetings = ManagementInterfaceClient.ManagementInterface.GetLocalizedGreeting(ManagementInterfaceClient.AuthInfo, greetingID, languageID); WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsRow localizedGreeting; // If the localized greeting doesn't exist, create one if (localizedGreetings.Count > 0) { localizedGreeting = localizedGreetings[0]; } else { localizedGreeting = localizedGreetings.NewLocalizedGreetingsRow(); localizedGreeting.GreetingID = greetingID; localizedGreeting.LocalizedGreetingID = Guid.NewGuid(); localizedGreeting.LanguageID = languageID; localizedGreeting.Type = (short)WOSI.CallButler.Data.GreetingType.TextGreeting; localizedGreetings.AddLocalizedGreetingsRow(localizedGreeting); } // Download our localized greeting sound GetLocalizedGreetingSound(localizedGreeting); Forms.GreetingForm greetingForm = new CallButler.Manager.Forms.GreetingForm(); greetingForm.SuggestedText = suggestedText; greetingForm.GreetingControl.LoadGreeting(localizedGreeting, WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.GreetingsSoundCache)); if (greetingForm.ShowDialog() == DialogResult.OK) { greetingForm.GreetingControl.SaveGreeting(WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.GreetingsSoundCache)); // Save our greeting remotely ManagementInterfaceClient.ManagementInterface.PersistLocalizedGreeting(ManagementInterfaceClient.AuthInfo, localizedGreetings); // Upload our greeting file PersistLocalizedGreetingSound(localizedGreeting); } global::Controls.LoadingDialog.HideDialog(); }
internal void AddPersonalizedGreeting() { // Create a new personalized greeting row and table WOSI.CallButler.Data.CallButlerDataset.PersonalizedGreetingsDataTable pgTable = new WOSI.CallButler.Data.CallButlerDataset.PersonalizedGreetingsDataTable(); WOSI.CallButler.Data.CallButlerDataset.PersonalizedGreetingsRow pgRow = pgTable.NewPersonalizedGreetingsRow(); pgRow.PersonalizedGreetingID = Guid.NewGuid(); pgRow.Type = (short)WOSI.CallButler.Data.PersonalizedGreetingType.Continue; pgTable.AddPersonalizedGreetingsRow(pgRow); // Create a new localized greeting row and table WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsDataTable lgTable = new WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsDataTable(); WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsRow lgRow = lgTable.NewLocalizedGreetingsRow(); lgRow.LocalizedGreetingID = Guid.NewGuid(); lgRow.GreetingID = pgRow.PersonalizedGreetingID; lgRow.LanguageID = ManagementInterfaceClient.ManagementInterface.GetDefaultLanguage( ManagementInterfaceClient.AuthInfo ); lgRow.Type = (short)WOSI.CallButler.Data.GreetingType.SoundGreeting; lgTable.AddLocalizedGreetingsRow(lgRow); Forms.PersonalizedGreetingForm pgForm = new CallButler.Manager.Forms.PersonalizedGreetingForm(pgRow, callButlerDataset.Extensions); pgForm.GreetingControl.LoadGreeting(lgRow, WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.GreetingsSoundCache)); if (pgForm.ShowDialog(this) == DialogResult.OK) { pgForm.GreetingControl.SaveGreeting(WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.GreetingsSoundCache)); // Add remotely ManagementInterfaceClient.ManagementInterface.PersistPersonalizedGreeting(ManagementInterfaceClient.AuthInfo, pgTable); ManagementInterfaceClient.ManagementInterface.PersistLocalizedGreeting(ManagementInterfaceClient.AuthInfo, lgTable); // Send our localized greeting sound file Utils.GreetingUtils.PersistLocalizedGreetingSound(lgRow); // Add locally callButlerDataset.PersonalizedGreetings.ImportRow(pgRow); callButlerDataset.AcceptChanges(); } }
internal void AddNewExtension() { // Check to make sure we can add a new extension int maxExtensions = 100; if (maxExtensions > 0 && maxExtensions <= callButlerDataset.Extensions.Count) { MessageBox.Show(this, String.Format(CallButler.Manager.Utils.PrivateLabelUtils.ReplaceProductName(Properties.LocalizedStrings.ExtensionsView_ExtLimit), maxExtensions), CallButler.Manager.Utils.PrivateLabelUtils.ReplaceProductName(Properties.LocalizedStrings.Common_PermissionDenied), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } // Create a new Extension row WOSI.CallButler.Data.CallButlerDataset.ExtensionsRow extension = callButlerDataset.Extensions.NewExtensionsRow(); extension.CustomerID = Properties.Settings.Default.CustomerID; extension.ExtensionID = Guid.NewGuid(); short extensionNum = 0; // Find us an unused extension number for (short index = Properties.Settings.Default.MinExtensionNumber; index < short.MaxValue; index++) { if (callButlerDataset.Extensions.Select("ExtensionNumber = " + index).Length == 0) { extensionNum = index; extension.ExtensionNumber = index; break; } } // Create a new voicemail greeting WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsDataTable voicemailGreetingTable = new WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsDataTable(); WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsRow voicemailGreeting = voicemailGreetingTable.NewLocalizedGreetingsRow(); voicemailGreeting.GreetingID = extension.ExtensionID; voicemailGreeting.LocalizedGreetingID = Guid.NewGuid(); voicemailGreeting.LanguageID = ManagementInterfaceClient.ManagementInterface.GetDefaultLanguage(ManagementInterfaceClient.AuthInfo); voicemailGreeting.Type = (short)WOSI.CallButler.Data.GreetingType.SoundGreeting; voicemailGreetingTable.AddLocalizedGreetingsRow(voicemailGreeting); // Create a new extension contact numbers table WOSI.CallButler.Data.CallButlerDataset.ExtensionContactNumbersDataTable extensionContactNumbers = new WOSI.CallButler.Data.CallButlerDataset.ExtensionContactNumbersDataTable(); // Show our extension editor form Forms.ExtensionEditorForm extensionForm = new CallButler.Manager.Forms.ExtensionEditorForm(callButlerDataset.Extensions, extension, extensionContactNumbers, voicemailGreeting); WOSI.CallButler.Data.CallButlerDataset.ExtensionsDataTable origExt = (WOSI.CallButler.Data.CallButlerDataset.ExtensionsDataTable)callButlerDataset.Extensions.Copy(); if (extensionForm.ShowDialog(this) == DialogResult.OK) { // Check to make sure the extension isn't already taken if (origExt.Select("ExtensionNumber = " + extension.ExtensionNumber).Length > 0) { MessageBox.Show(this, String.Format(CallButler.Manager.Utils.PrivateLabelUtils.ReplaceProductName(Properties.LocalizedStrings.ExtensionView_ExtTaken), extension.ExtensionNumber, extensionNum), CallButler.Manager.Utils.PrivateLabelUtils.ReplaceProductName(Properties.LocalizedStrings.ExtensionView_ExtConflict), MessageBoxButtons.OK, MessageBoxIcon.Warning); extension.ExtensionNumber = extensionNum; } // Add our local extension callButlerDataset.Extensions.AddExtensionsRow(extension); // Add our remote extension WOSI.CallButler.Data.CallButlerDataset.ExtensionsDataTable extensionDataTable = Utils.TableUtils <WOSI.CallButler.Data.CallButlerDataset.ExtensionsDataTable> .CreateTableFromRow(extension); ManagementInterfaceClient.ManagementInterface.PersistExtension(ManagementInterfaceClient.AuthInfo, extensionDataTable); // Add our voicemail greeting ManagementInterfaceClient.ManagementInterface.PersistLocalizedGreeting(ManagementInterfaceClient.AuthInfo, voicemailGreetingTable); // Send our voicemail greeting sound file Utils.GreetingUtils.PersistLocalizedGreetingSound(voicemailGreeting); // Persist our contact numbers ManagementInterfaceClient.ManagementInterface.PersistExtensionContactNumbers(ManagementInterfaceClient.AuthInfo, extensionContactNumbers); } }
internal void AddPersonalizedGreeting() { // Create a new personalized greeting row and table WOSI.CallButler.Data.CallButlerDataset.PersonalizedGreetingsDataTable pgTable = new WOSI.CallButler.Data.CallButlerDataset.PersonalizedGreetingsDataTable(); WOSI.CallButler.Data.CallButlerDataset.PersonalizedGreetingsRow pgRow = pgTable.NewPersonalizedGreetingsRow(); pgRow.PersonalizedGreetingID = Guid.NewGuid(); pgRow.Type = (short)WOSI.CallButler.Data.PersonalizedGreetingType.Continue; pgTable.AddPersonalizedGreetingsRow(pgRow); // Create a new localized greeting row and table WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsDataTable lgTable = new WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsDataTable(); WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsRow lgRow = lgTable.NewLocalizedGreetingsRow(); lgRow.LocalizedGreetingID = Guid.NewGuid(); lgRow.GreetingID = pgRow.PersonalizedGreetingID; lgRow.LanguageID = ManagementInterfaceClient.ManagementInterface.GetDefaultLanguage(ManagementInterfaceClient.AuthInfo); lgRow.Type = (short)WOSI.CallButler.Data.GreetingType.SoundGreeting; lgTable.AddLocalizedGreetingsRow(lgRow); Forms.PersonalizedGreetingForm pgForm = new CallButler.Manager.Forms.PersonalizedGreetingForm(pgRow, callButlerDataset.Extensions); pgForm.GreetingControl.LoadGreeting(lgRow, WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.GreetingsSoundCache)); if (pgForm.ShowDialog(this) == DialogResult.OK) { pgForm.GreetingControl.SaveGreeting(WOSI.Utilities.FileUtils.GetApplicationRelativePath(Properties.Settings.Default.GreetingsSoundCache)); // Add remotely ManagementInterfaceClient.ManagementInterface.PersistPersonalizedGreeting(ManagementInterfaceClient.AuthInfo, pgTable); ManagementInterfaceClient.ManagementInterface.PersistLocalizedGreeting(ManagementInterfaceClient.AuthInfo, lgTable); // Send our localized greeting sound file Utils.GreetingUtils.PersistLocalizedGreetingSound(lgRow); // Add locally callButlerDataset.PersonalizedGreetings.ImportRow(pgRow); callButlerDataset.AcceptChanges(); } }
internal void AddNewExtension() { // Check to make sure we can add a new extension int maxExtensions = 100; if (maxExtensions > 0 && maxExtensions <= callButlerDataset.Extensions.Count) { MessageBox.Show(this, String.Format(CallButler.Manager.Utils.PrivateLabelUtils.ReplaceProductName(Properties.LocalizedStrings.ExtensionsView_ExtLimit), maxExtensions), CallButler.Manager.Utils.PrivateLabelUtils.ReplaceProductName(Properties.LocalizedStrings.Common_PermissionDenied), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } // Create a new Extension row WOSI.CallButler.Data.CallButlerDataset.ExtensionsRow extension = callButlerDataset.Extensions.NewExtensionsRow(); extension.CustomerID = Properties.Settings.Default.CustomerID; extension.ExtensionID = Guid.NewGuid(); short extensionNum = 0; // Find us an unused extension number for (short index = Properties.Settings.Default.MinExtensionNumber; index < short.MaxValue; index++) { if (callButlerDataset.Extensions.Select("ExtensionNumber = " + index).Length == 0) { extensionNum = index; extension.ExtensionNumber = index; break; } } // Create a new voicemail greeting WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsDataTable voicemailGreetingTable = new WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsDataTable(); WOSI.CallButler.Data.CallButlerDataset.LocalizedGreetingsRow voicemailGreeting = voicemailGreetingTable.NewLocalizedGreetingsRow(); voicemailGreeting.GreetingID = extension.ExtensionID; voicemailGreeting.LocalizedGreetingID = Guid.NewGuid(); voicemailGreeting.LanguageID = ManagementInterfaceClient.ManagementInterface.GetDefaultLanguage(ManagementInterfaceClient.AuthInfo); voicemailGreeting.Type = (short)WOSI.CallButler.Data.GreetingType.SoundGreeting; voicemailGreetingTable.AddLocalizedGreetingsRow(voicemailGreeting); // Create a new extension contact numbers table WOSI.CallButler.Data.CallButlerDataset.ExtensionContactNumbersDataTable extensionContactNumbers = new WOSI.CallButler.Data.CallButlerDataset.ExtensionContactNumbersDataTable(); // Show our extension editor form Forms.ExtensionEditorForm extensionForm = new CallButler.Manager.Forms.ExtensionEditorForm(callButlerDataset.Extensions, extension, extensionContactNumbers, voicemailGreeting); WOSI.CallButler.Data.CallButlerDataset.ExtensionsDataTable origExt = (WOSI.CallButler.Data.CallButlerDataset.ExtensionsDataTable) callButlerDataset.Extensions.Copy(); if (extensionForm.ShowDialog(this) == DialogResult.OK) { // Check to make sure the extension isn't already taken if (origExt.Select("ExtensionNumber = " + extension.ExtensionNumber).Length > 0) { MessageBox.Show(this, String.Format(CallButler.Manager.Utils.PrivateLabelUtils.ReplaceProductName(Properties.LocalizedStrings.ExtensionView_ExtTaken), extension.ExtensionNumber, extensionNum), CallButler.Manager.Utils.PrivateLabelUtils.ReplaceProductName(Properties.LocalizedStrings.ExtensionView_ExtConflict), MessageBoxButtons.OK, MessageBoxIcon.Warning); extension.ExtensionNumber = extensionNum; } // Add our local extension callButlerDataset.Extensions.AddExtensionsRow(extension); // Add our remote extension WOSI.CallButler.Data.CallButlerDataset.ExtensionsDataTable extensionDataTable = Utils.TableUtils<WOSI.CallButler.Data.CallButlerDataset.ExtensionsDataTable>.CreateTableFromRow(extension); ManagementInterfaceClient.ManagementInterface.PersistExtension(ManagementInterfaceClient.AuthInfo, extensionDataTable); // Add our voicemail greeting ManagementInterfaceClient.ManagementInterface.PersistLocalizedGreeting(ManagementInterfaceClient.AuthInfo, voicemailGreetingTable); // Send our voicemail greeting sound file Utils.GreetingUtils.PersistLocalizedGreetingSound(voicemailGreeting); // Persist our contact numbers ManagementInterfaceClient.ManagementInterface.PersistExtensionContactNumbers(ManagementInterfaceClient.AuthInfo, extensionContactNumbers); } }