コード例 #1
0
        public Task <IEnumerable <SectionWithLoginUser> > GetAsync(SectionWithLoginUserSearch option, CancellationToken token = default(CancellationToken))
        {
            var query = @"
SELECT        sl.*
            , sc.Code           SectionCode
            , sc.Name           SectionName
            , lu.Code           LoginUserCode
            , lu.Name           LoginUserName
FROM        SectionWithLoginUser sl
INNER JOIN  Section sc      ON sc.Id    = sl.SectionId
INNER JOIN  LoginUser lu    ON lu.Id    = sl.LoginUserId
WHERE       sl.LoginUserId      = sl.LoginUserId";

            if (option.CompanyId.HasValue)
            {
                query += @"
AND         sc.CompanyId        = @CompanyId";
            }
            if (option.SectionId.HasValue)
            {
                query += @"
AND         sl.SectionId        = @SectionId";
            }
            if (option.LoginUserId.HasValue)
            {
                query += @"
AND         sl.LoginUserId      = @LoginUserId";
            }
            if (option.SectionCodes?.Any() ?? false)
            {
                query += @"
AND         sc.Code             IN (SELECT Code FROM @SectionCodes)";
            }
            query += @"
ORDER BY      sc.Code           ASC
            , lu.Code           ASC";
            return(dbHelper.GetItemsAsync <SectionWithLoginUser>(query, new {
                option.CompanyId,
                option.SectionId,
                option.LoginUserId,
                SectionCodes = option.SectionCodes.GetTableParameter(),
            }, token));
        }
コード例 #2
0
 public async Task <ActionResult <IEnumerable <SectionWithLoginUser> > > GetItems(SectionWithLoginUserSearch option, CancellationToken token)
 => (await sectionWithLoginUserProcessor.GetAsync(option, token)).ToArray();
コード例 #3
0
        public async Task <SectionWithLoginUsersResult> GetItemsAsync(string SessionKey, int CompanyId, SectionWithLoginUserSearch SectionWithLoginUserSearch)
        {
            return(await authorizationProcessor.DoAuthorizeAsync(SessionKey, async token =>
            {
                var result = (await sectionWithLoginUserProcessor.GetAsync(SectionWithLoginUserSearch, token)).ToList();

                return new SectionWithLoginUsersResult
                {
                    ProcessResult = new ProcessResult {
                        Result = true
                    },
                    SectionWithLoginUsers = result,
                };
            }, logger));
        }
コード例 #4
0
 public async Task <IEnumerable <SectionWithLoginUser> > GetAsync(SectionWithLoginUserSearch option, CancellationToken token = default(CancellationToken))
 => await sectionWithLoginUserQueryProcessor.GetAsync(option, token);