public HttpResponseMessage UpdateBasicSettings(BasicSettingsDTO postData)
        {
            try
            {
                PortalController.UpdatePortalSetting(PortalSettings.PortalId, "MyDnnVisitorsOnlineEnabled", postData.PortalSettings["VisitorsOnlineEnabled"].ToString(), true);
                PortalController.UpdatePortalSetting(PortalSettings.PortalId, "MyDnnLiveChatEnabled", postData.PortalSettings["LiveChatEnabled"].ToString(), true);

                var moduleID = int.Parse(PortalController.GetPortalSetting("MyDnnLiveChatModuleID", PortalSettings.PortalId, "-1"));

                Requires.NotNegative("moduleID", moduleID);

                ModuleController.Instance.UpdateModuleSetting(moduleID, "UpdateBasicSettings", "True");

                ModuleController.Instance.UpdateModuleSetting(moduleID, "PlaySoundWhenNewMsg", postData.ModuleSettings["PlaySoundWhenNewMsg"].ToString());
                ModuleController.Instance.UpdateModuleSetting(moduleID, "ShowDekstopNotificationForIncoming", postData.ModuleSettings["ShowDekstopNotificationForIncoming"].ToString());
                ModuleController.Instance.UpdateModuleSetting(moduleID, "ShowDekstopNotificationForNewMsg", postData.ModuleSettings["ShowDekstopNotificationForNewMsg"].ToString());
                ModuleController.Instance.UpdateModuleSetting(moduleID, "AgentsViewPermission", postData.ModuleSettings["AgentsViewPermission"].ToString());
                ModuleController.Instance.UpdateModuleSetting(moduleID, "SendEmailForOffline", postData.ModuleSettings["SendEmailForOffline"].ToString());
                ModuleController.Instance.UpdateModuleSetting(moduleID, "SendEmailAfterChat", postData.ModuleSettings["SendEmailAfterChat"].ToString());
                ModuleController.Instance.UpdateModuleSetting(moduleID, "TranscriptEmailTemplate", postData.ModuleSettings["TranscriptEmailTemplate"].ToString());
                ModuleController.Instance.UpdateModuleSetting(moduleID, "OfflineEmailTemplate", postData.ModuleSettings["OfflineEmailTemplate"].ToString());

                return(Request.CreateResponse(HttpStatusCode.OK, new { Success = true }));
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
Example #2
0
        public HttpResponseMessage UpdateBasicSettings(BasicSettingsDTO postData)
        {
            try
            {
                PortalController.UpdatePortalSetting(PortalSettings.PortalId, "MyDnnVisitorsOnlineEnabled", postData.PortalSettings["VisitorsOnlineEnabled"].ToString(), true);
                PortalController.UpdatePortalSetting(PortalSettings.PortalId, "MyDnnLiveChatEnabled", postData.PortalSettings["LiveChatEnabled"].ToString(), true);

                var moduleID = int.Parse(PortalController.GetPortalSetting("MyDnnLiveChatModuleID", PortalSettings.PortalId, "-1"));

                Requires.NotNegative("moduleID", moduleID);

                ModuleController.Instance.UpdateModuleSetting(moduleID, "UpdateBasicSettings", "True");

                ModuleController.Instance.UpdateModuleSetting(moduleID, "PlaySoundWhenNewMsg", postData.ModuleSettings["PlaySoundWhenNewMsg"].ToString());
                ModuleController.Instance.UpdateModuleSetting(moduleID, "ShowDekstopNotificationForIncoming", postData.ModuleSettings["ShowDekstopNotificationForIncoming"].ToString());
                ModuleController.Instance.UpdateModuleSetting(moduleID, "ShowDekstopNotificationForNewMsg", postData.ModuleSettings["ShowDekstopNotificationForNewMsg"].ToString());
                ModuleController.Instance.UpdateModuleSetting(moduleID, "AgentsViewPermission", postData.ModuleSettings["AgentsViewPermission"].ToString());
                ModuleController.Instance.UpdateModuleSetting(moduleID, "SendEmailForOffline", postData.ModuleSettings["SendEmailForOffline"].ToString());
                ModuleController.Instance.UpdateModuleSetting(moduleID, "SendEmailAfterChat", postData.ModuleSettings["SendEmailAfterChat"].ToString());
                ModuleController.Instance.UpdateModuleSetting(moduleID, "TranscriptEmailTemplate", postData.ModuleSettings["TranscriptEmailTemplate"].ToString());
                ModuleController.Instance.UpdateModuleSetting(moduleID, "OfflineEmailTemplate", postData.ModuleSettings["OfflineEmailTemplate"].ToString());

                return Request.CreateResponse(HttpStatusCode.OK, new { Success = true });
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                return Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message);
            }
        }