/// <summary> /// Enables Exchange and updates the database /// </summary> private void EnableExchange() { ExchCmds cmds = null; try { cmds = new ExchCmds(Config.ExchangeURI, Config.Username, Config.Password, Config.ExchangeConnectionType, Config.PrimaryDC); // Create Exchange objects for company cmds.Enable_Company(CPContext.SelectedCompanyCode, "AllUsers@" + CPContext.SelectedCompanyCode, Retrieve.GetCompanyExchangeOU); // Update SQL SQLExchange.SetCompanyExchangeEnabled(CPContext.SelectedCompanyCode, true); // Update Status Message notification1.SetMessage(controls.notification.MessageType.Success, Resources.LocalizedText.NotificationSuccessEnableExchange); // Change panel enableExchange.Visible = false; disableExchange.Visible = true; // Set Random string lbDeleteLabel.Text = Retrieve.RandomString; } catch (Exception ex) { notification1.SetMessage(controls.notification.MessageType.Error, ex.Message); } finally { if (cmds != null) cmds.Dispose(); } }