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);
            }
        }
        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);
            }
        }
Пример #3
0
        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);
            }
        }
Пример #4
0
        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);
            }
        }