Exemple #1
0
        /// <summary>
        /// スケジュールデータを検索し、グリッドに表示する。
        /// </summary>
        private void SearchTaskScheduleHistory()
        {
            var importType    = (int?)cmbImportType.SelectedValue;
            var importSubType = (int?)cmbImportSubType.SelectedValue;
            var result        = (int?)cmbResult.SelectedValue;

            var searchCondition = new TaskScheduleHistorySearch
            {
                CompanyId = CompanyId,

                // 以下、条件無指定時はnull値
                ImportType    = (importType != -1) ? importType : null,
                ImportSubType = (importSubType != -1) ? importSubType : null,
                Result        = (result != -1) ? result : null,
                StartAt_From  = txtStartAt_From.Value,
                StartAt_To    = txtStartAt_To.Value,
                EndAt_From    = txtEndAt_From.Value,
                EndAt_To      = txtEndAt_To.Value,
            };

            if (!ValidateSearchConditions(searchCondition))
            {
                return;
            }

            List <TaskScheduleHistory> taskScheduleHistory = null;
            var task = Task.Run(async() =>
            {
                taskScheduleHistory = await SearchTaskScheduleHistoryAsync(SessionKey, searchCondition);
            });

            ProgressDialog.Start(BaseForm, task, false, SessionKey);

            if (taskScheduleHistory == null)
            {
                ShowWarningDialog(MsgWngNotExistSearchData);
                grdTaskScheduleHistory.DataSource = null;
                return;
            }

            var viewDataList = taskScheduleHistory.Select(row => new ViewData(row, DispValueDictionaries))
                               .OrderBy(data => data.StartAt)
                               .ToList();

            grdTaskScheduleHistory.DataSource = viewDataList;

            if (viewDataList.Count == 0)
            {
                ShowWarningDialog(MsgWngNotExistSearchData);
            }
        }
Exemple #2
0
        private string GetWhereConditionsForGetItems(TaskScheduleHistorySearch conditions)
        {
            var result = new List <string>
            {
                "CompanyId = @CompanyId"
            };

            if (conditions.ImportType.HasValue)
            {
                result.Add("ImportType = @ImportType");
            }
            if (conditions.ImportSubType.HasValue)
            {
                result.Add("ImportSubType = @ImportSubType");
            }
            if (conditions.Result.HasValue)
            {
                result.Add("Result = @Result");
            }

            if (conditions.StartAt_From.HasValue && conditions.StartAt_To.HasValue)
            {
                result.Add("StartAt BETWEEN @StartAt_From AND @StartAt_To");
            }
            else if (conditions.StartAt_From.HasValue)
            {
                result.Add("StartAt >= @StartAt_From");
            }
            else if (conditions.StartAt_To.HasValue)
            {
                result.Add("StartAt <= @StartAt_To");
            }

            if (conditions.EndAt_From.HasValue && conditions.EndAt_To.HasValue)
            {
                result.Add("EndAt BETWEEN @EndAt_From AND @EndAt_To");
            }
            else if (conditions.EndAt_From.HasValue)
            {
                result.Add("EndAt >= @EndAt_From");
            }
            else if (conditions.EndAt_To.HasValue)
            {
                result.Add("EndAt <= @EndAt_To");
            }

            return(string.Join(@"
AND ", result));
        }
Exemple #3
0
        public Task <IEnumerable <TaskScheduleHistory> > GetAsync(TaskScheduleHistorySearch option, CancellationToken token = default(CancellationToken))
        {
            var query = $@"
SELECT
    Id,
    CompanyId,
    ImportType,
    ImportSubType,
    StartAt,
    EndAt,
    Result,
    Errors
FROM
    TaskScheduleHistory
WHERE
    { GetWhereConditionsForGetItems(option) }
";

            return(dbHelper.GetItemsAsync <TaskScheduleHistory>(query, option, token));
        }
Exemple #4
0
        private bool ValidateSearchConditions(TaskScheduleHistorySearch search)
        {
            if (search.StartAt_From.HasValue && search.StartAt_To.HasValue)
            {
                if (search.StartAt_To < search.StartAt_From)
                {
                    ShowWarningDialog(MsgWngInputRangeChecked, "開始日時");
                    txtStartAt_From.Focus();
                    return(false);
                }
            }
            if (search.EndAt_From.HasValue && search.EndAt_To.HasValue)
            {
                if (search.EndAt_To < search.EndAt_From)
                {
                    ShowWarningDialog(MsgWngInputRangeChecked, "終了日時");
                    txtEndAt_From.Focus();
                    return(false);
                }
            }

            return(true);
        }
        public async Task <TaskScheduleHistoryResult> GetItemsAsync(string SessionKey, TaskScheduleHistorySearch searchConditions)
        {
            return(await authorizationProcess.DoAuthorizeAsync(SessionKey, async token =>
            {
                var result = (await taskScheduleHistoryProcessor.GetAsync(searchConditions, token)).ToList();

                return new TaskScheduleHistoryResult
                {
                    ProcessResult = new ProcessResult {
                        Result = true
                    },
                    TaskScheduleHistoryList = result,
                };
            }, logger));
        }
Exemple #6
0
        /// <summary>
        /// ログ検索処理(TaskScheduleHistoryService.svc:GetItems)を呼び出して結果を取得する。
        /// </summary>
        private static async Task <List <TaskScheduleHistory> > SearchTaskScheduleHistoryAsync(string sessionKey, TaskScheduleHistorySearch searchConditions)
        {
            TaskScheduleHistoryResult result = null;

            await ServiceProxyFactory.LifeTime(async factory =>
            {
                var client = factory.Create <TaskScheduleHistoryService.TaskScheduleHistoryServiceClient>();
                result     = await client.GetItemsAsync(sessionKey, searchConditions);
            });

            if (result == null || result.ProcessResult.Result == false)
            {
                return(null);
            }

            return(result.TaskScheduleHistoryList);
        }
Exemple #7
0
 public async Task <IEnumerable <TaskScheduleHistory> > GetAsync(TaskScheduleHistorySearch option, CancellationToken token = default(CancellationToken))
 => await taskScheduleHistoryQueryProcessor.GetAsync(option, token);
Exemple #8
0
 public async Task <IEnumerable <TaskScheduleHistory> > GetItems(TaskScheduleHistorySearch option, CancellationToken token)
 => (await taskScheduleHistoryProcessor.GetAsync(option, token)).ToArray();