示例#1
0
        public async Task <IEnumerable <BankBranch> > SearchInfo()
        {
            List <BankBranch> list = null;
            await ServiceProxyFactory.LifeTime(async factory =>
            {
                var service = factory.Create <BankBranchMasterClient>();
                BankBranchsResult result = await service.GetItemsAsync(
                    Application.Login.SessionKey, Application.Login.CompanyId, new BankBranchSearch());

                if (result.ProcessResult.Result)
                {
                    list = result.BankBranches;
                }
            });

            return(list);
        }
示例#2
0
        public async Task <IEnumerable <BankBranch> > SearchByKey(params string[] keys)
        {
            List <BankBranch> list = null;
            await ServiceProxyFactory.LifeTime(async factory =>
            {
                var service = factory.Create <BankBranchMasterClient>();
                BankBranchsResult result = await service.GetItemsAsync(
                    Application.Login.SessionKey, Application.Login.CompanyId, new BankBranchSearch()
                {
                    UseCommonSearch = true,
                    BankName        = keys[0],
                    BranchName      = keys[1]
                });

                if (result.ProcessResult.Result)
                {
                    list = result.BankBranches;
                }
            });

            return(list);
        }
示例#3
0
        private void ExportData()
        {
            try
            {
                List <BankBranch> list = null;
                var serverPath         = "";
                var loadTask           = ServiceProxyFactory.LifeTime(async factory =>
                {
                    var service = factory.Create <BankBranchMasterClient>();

                    BankBranchsResult result = await service.GetItemsAsync(SessionKey, CompanyId, new BankBranchSearch());

                    if (result.ProcessResult.Result)
                    {
                        list = result.BankBranches;
                    }
                });

                var pathTask = ServiceProxyFactory.LifeTime(async factory =>
                {
                    var generalService          = factory.Create <GeneralSettingMasterClient>();
                    GeneralSettingResult result = await generalService.GetByCodeAsync(SessionKey, CompanyId, "サーバパス");

                    if (result.ProcessResult.Result)
                    {
                        serverPath = result.GeneralSetting?.Value;
                    }
                });
                ProgressDialog.Start(ParentForm, Task.WhenAll(loadTask, pathTask), false, SessionKey);

                if (!list.Any())
                {
                    ShowWarningDialog(MsgWngNoExportData);
                    return;
                }

                if (!Directory.Exists(serverPath))
                {
                    serverPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                }

                var filePath = string.Empty;
                var fileName = $"銀行・支店マスター{DateTime.Today:yyyyMMdd}.csv";
                if (!ShowSaveExportFileDialog(serverPath, fileName, out filePath))
                {
                    return;
                }

                var definition = new BankBranchFileDefinition(new DataExpression(ApplicationControl));
                var exporter   = definition.CreateExporter();
                exporter.UserId      = Login.UserId;
                exporter.UserCode    = Login.UserCode;
                exporter.CompanyId   = CompanyId;
                exporter.CompanyCode = Login.CompanyCode;

                ProgressDialog.Start(ParentForm, (cancel, progress) =>
                {
                    return(exporter.ExportAsync(filePath, list, cancel, progress));
                }, true, SessionKey);

                if (exporter.Exception != null)
                {
                    NLogHandler.WriteErrorLog(this, exporter.Exception, SessionKey);
                    ShowWarningDialog(MsgErrExportError);
                    return;
                }

                DispStatusMessage(MsgInfFinishExport);
            }
            catch (Exception ex)
            {
                Debug.Fail(ex.ToString());
                NLogHandler.WriteErrorLog(this, ex, SessionKey);
                DispStatusMessage(MsgErrExportError);
            }
        }