예제 #1
0
    private void SetWebpartsUp()
    {
        // Load parent webpart settings stored in DB.
        ChatPopupWindowSettingsInfo settings = ChatPopupWindowSettingsHelper.GetPopupWindowSettings(PopupSettingsId);

        // If no settings are stored use default values.
        if (settings == null)
        {
            settings = new ChatPopupWindowSettingsInfo();
            settings.MessageTransformationName    = ChatHelper.TransformationRoomMessages;
            settings.UserTransformationName       = ChatHelper.TransformationRoomUsers;
            settings.ErrorTransformationName      = ChatHelper.TransformationErrors;
            settings.ErrorClearTransformationName = ChatHelper.TransformationErrorsDeleteAll;
        }
        else
        {
            if (string.IsNullOrEmpty(settings.MessageTransformationName))
            {
                settings.MessageTransformationName = ChatHelper.TransformationRoomMessages;
            }
            if (string.IsNullOrEmpty(settings.UserTransformationName))
            {
                settings.UserTransformationName = ChatHelper.TransformationRoomUsers;
            }
            if (string.IsNullOrEmpty(settings.ErrorTransformationName))
            {
                settings.ErrorTransformationName = ChatHelper.TransformationErrors;
            }
            if (string.IsNullOrEmpty(settings.ErrorClearTransformationName))
            {
                settings.ErrorClearTransformationName = ChatHelper.TransformationErrorsDeleteAll;
            }
        }

        // Set errors webpart up.
        ChatErrorsElem.ErrorTransformationName           = settings.ErrorTransformationName;
        ChatErrorsElem.ButtonDeleteAllTransformationName = settings.ErrorClearTransformationName;
        ChatErrorsElem.ShowDeleteAllBtn = true;

        // Set messages webpart up.
        ChatRoomMessagesElem.ChatMessageTransformationName = settings.MessageTransformationName;
        ChatRoomMessagesElem.Direction = ChatRoomMessagesDirectionEnum.Down;
        ChatRoomMessagesElem.Count     = ChatHelper.FirstLoadMessagesCountSetting;

        // Set users webpart up.
        ChatRoomUsersElem.ChatUserTransformationName = settings.UserTransformationName;
        ChatRoomUsersElem.EnablePaging    = true;
        ChatRoomUsersElem.PagingItems     = 5;
        ChatRoomUsersElem.EnableFiltering = true;
        ChatRoomUsersElem.ShowFilterItems = 6;
        ChatRoomUsersElem.SortByStatus    = true;

        // Set send webpart up.
        ChatMessageSendElem.IsSupport  = IsSupport;
        ChatRoomUsersElem.IsSupport    = IsSupport;
        ChatRoomMessagesElem.IsSupport = IsSupport;
        ChatErrorsElem.IsSupport       = IsSupport;
    }
    private void SetWebpartsUp()
    {
        // Load parent webpart settings stored in DB.
        ChatPopupWindowSettingsInfo settings = ChatPopupWindowSettingsHelper.GetPopupWindowSettings(PopupSettingsId);

        // If no settings are stored use default values.
        if (settings == null)
        {
            settings = new ChatPopupWindowSettingsInfo();
            settings.MessageTransformationName = ChatHelper.TransformationRoomMessages;
            settings.UserTransformationName = ChatHelper.TransformationRoomUsers;
            settings.ErrorTransformationName = ChatHelper.TransformationErrors;
            settings.ErrorClearTransformationName = ChatHelper.TransformationErrorsDeleteAll;
        }
        else
        {
            if (string.IsNullOrEmpty(settings.MessageTransformationName))
            {
                settings.MessageTransformationName = ChatHelper.TransformationRoomMessages;
            }
            if (string.IsNullOrEmpty(settings.UserTransformationName))
            {
                settings.UserTransformationName = ChatHelper.TransformationRoomUsers;
            }
            if (string.IsNullOrEmpty(settings.ErrorTransformationName))
            {
                settings.ErrorTransformationName = ChatHelper.TransformationErrors;
            }
            if (string.IsNullOrEmpty(settings.ErrorClearTransformationName))
            {
                settings.ErrorClearTransformationName = ChatHelper.TransformationErrorsDeleteAll;
            }
        }

        // Set errors webpart up.
        ChatErrorsElem.ErrorTransformationName = settings.ErrorTransformationName;
        ChatErrorsElem.ButtonDeleteAllTransformationName = settings.ErrorClearTransformationName;
        ChatErrorsElem.ShowDeleteAllBtn = true;

        // Set messages webpart up.
        ChatRoomMessagesElem.ChatMessageTransformationName = settings.MessageTransformationName;
        ChatRoomMessagesElem.Direction = ChatRoomMessagesDirectionEnum.Down;
        ChatRoomMessagesElem.Count = ChatHelper.FirstLoadMessagesCountSetting;

        // Set users webpart up.
        ChatRoomUsersElem.ChatUserTransformationName = settings.UserTransformationName;
        ChatRoomUsersElem.EnablePaging = true;
        ChatRoomUsersElem.PagingItems = 5;
        ChatRoomUsersElem.GroupPagesBy = 10;
        ChatRoomUsersElem.EnableFiltering = true;
        ChatRoomUsersElem.ShowFilterItems = 6;
        ChatRoomUsersElem.SortByStatus = true;
    }