コード例 #1
0
        public IEnumerable <ChildEntityPermissionListItem> List(int contentId, int?groupId, int?userId, ListCommand cmd, out int totalRecords)
        {
            using (var scope = new QPConnectionScope())
            {
                var titleField     = FieldRepository.GetTitleField(contentId);
                var titleFieldName = titleField == null ? FieldName.ContentItemId : titleField.Name;

                cmd.SortExpression = TranslateHelper.TranslateSortExpression(cmd.SortExpression);
                IEnumerable <DataRow> rows;
                totalRecords = 0;
                if (userId.HasValue)
                {
                    rows = Common.GetChildArticlePermissionsForUser(scope.DbConnection, contentId, userId.Value, titleFieldName, cmd.SortExpression, cmd.StartRecord, cmd.PageSize, out totalRecords);
                }
                else if (groupId.HasValue)
                {
                    rows = Common.GetChildArticlePermissionsForGroup(scope.DbConnection, contentId, groupId.Value, titleFieldName, cmd.SortExpression, cmd.StartRecord, cmd.PageSize, out totalRecords);
                }
                else
                {
                    throw new ArgumentNullException(nameof(groupId));
                }

                return(MapperFacade.ChildEntityPermissionListItemRowMapper.GetBizList(rows.ToList()));
            }
        }
コード例 #2
0
        public string TranslateSortExpression(string sortExpression)
        {
            var replaces = new Dictionary <string, string> {
                { "TypeName", "TypeCode" }
            };

            return(TranslateHelper.TranslateSortExpression(sortExpression, replaces));
        }
コード例 #3
0
 public IEnumerable <EntityPermissionListItem> List(ListCommand cmd, int parentId, out int totalRecords)
 {
     using (var scope = new QPConnectionScope())
     {
         cmd.SortExpression = TranslateHelper.TranslateSortExpression(cmd.SortExpression);
         var rows = Common.GetContentPermissionPage(scope.DbConnection, parentId, cmd.SortExpression, cmd.FilterExpression, cmd.StartRecord, cmd.PageSize, out totalRecords);
         return(MapperFacade.PermissionListItemRowMapper.GetBizList(rows.ToList()));
     }
 }
コード例 #4
0
ファイル: EntityObject.cs プロジェクト: QuantumArt/QP
        internal static string TranslateSortExpression(string sortExpression)
        {
            var replaces = new Dictionary <string, string>
            {
                { "ByUser", "ByUser.LogOn" }
            };

            return(TranslateHelper.TranslateSortExpression(sortExpression, replaces));
        }
コード例 #5
0
ファイル: ArticleVersion.cs プロジェクト: AuthorProxy/QP
        /// <summary>
        /// Траслирует SortExpression из Presentation в BLL
        /// </summary>
        /// <param name="sortExpression">SortExpression</param>
        /// <returns>SortExpression</returns>
        public new static string TranslateSortExpression(string sortExpression)
        {
            var result   = EntityObject.TranslateSortExpression(sortExpression);
            var replaces = new Dictionary <string, string>
            {
                { "Name", "Id" }
            };

            return(TranslateHelper.TranslateSortExpression(result, replaces));
        }
コード例 #6
0
        /// <summary>
        /// Траслирует SortExpression
        /// </summary>
        private static string TranslateSortExpression(string sortExpression)
        {
            var replaces = new Dictionary <string, string>
            {
                { "Text", "data.[rank]" },
                { "Id", "data.content_item_id" },
                { "Created", "ci.created" },
                { "Modified", "ci.modified" },
                { "LastModifiedByUser", "usr.[LOGIN]" },
                { "ParentName", "c.CONTENT_NAME" },
                { "StatusName", "st.STATUS_TYPE_NAME" }
            };

            return(TranslateHelper.TranslateSortExpression(sortExpression, replaces, "data.[rank] desc"));
        }
コード例 #7
0
        public static string TranslateSortExpression(string sortExpression)
        {
            var replaces = new Dictionary <string, string>
            {
                { "LastModifiedByUserId", FieldName.LastModifiedBy },
                { "LastModifiedByUser", "LAST_MODIFIED_BY_LOGIN" },
                { "FirstName", "FIRST_NAME" },
                { "LastName", "LAST_NAME" },
                { "LanguageId", "LANGUAGE_ID" },
                { "Language", "LANGUAGE_NAME" },
                { "LastLogOn", "LAST_LOGIN" }
            };

            return(TranslateHelper.TranslateSortExpression(sortExpression, replaces));
        }
コード例 #8
0
        public string TranslateSortExpression(string sortExpression)
        {
            if (string.IsNullOrEmpty(sortExpression))
            {
                sortExpression = "[ORDER] ASC";
            }

            var replaces = new Dictionary <string, string>
            {
                { "LastModifiedByUser", "LOGIN" },
                { "ActionTypeName", "ACTION_TYPE_NAME" },
                { "EntityTypeName", "ENTITY_TYPE_NAME" }
            };

            return(TranslateHelper.TranslateSortExpression(sortExpression, replaces));
        }
コード例 #9
0
        public string TranslateSortExpression(string sortExpression, DatabaseType dbType)
        {
            if (string.IsNullOrEmpty(sortExpression))
            {
                sortExpression = $"{SqlQuerySyntaxHelper.EscapeEntityName(dbType, "ORDER")} ASC";
            }

            var replaces = new Dictionary <string, string>
            {
                { "LastModifiedByUser", "LOGIN" },
                { "ActionTypeName", "ACTION_TYPE_NAME" },
                { "EntityTypeName", "ENTITY_TYPE_NAME" }
            };

            return(TranslateHelper.TranslateSortExpression(sortExpression, replaces));
        }
コード例 #10
0
        /// <summary>
        /// Траслирует SortExpression
        /// </summary>
        private static string TranslateSortExpression(string sortExpression)
        {
            var dbType = QPContext.DatabaseType;

            if (dbType == DatabaseType.Postgres)
            {
                if (String.IsNullOrEmpty(sortExpression))
                {
                    return($@"""Rank"" desc");
                }

                var parts = sortExpression.Split(' ');
                parts[0] = $@"""{parts[0]}""";
                return(string.Join(" ", parts));
            }
            var replaces = new Dictionary <string, string>()
            {
                { "Text", "Rank" }
            };

            return(TranslateHelper.TranslateSortExpression(sortExpression, replaces, $"Rank desc"));
        }
コード例 #11
0
 internal static IEnumerable <UserGroupListItem> List(ListCommand cmd, out int totalRecords, List <int> selectedIds)
 {
     using (var scope = new QPConnectionScope())
     {
         cmd.SortExpression = !string.IsNullOrWhiteSpace(cmd.SortExpression) ? TranslateHelper.TranslateSortExpression(cmd.SortExpression) : null;
         var rows = Common.GetUserGroupPage(scope.DbConnection, selectedIds, cmd.SortExpression, cmd.FilterExpression, cmd.StartRecord, cmd.PageSize, out totalRecords);
         return(MapperFacade.UserGroupListItemRowMapper.GetBizList(rows.ToList()));
     }
 }