public async Task <IEnumerable <PaymentAgency> > SearchInfo() { List <PaymentAgency> list = null; await ServiceProxyFactory.LifeTime(async factory => { var service = factory.Create <PaymentAgencyMasterClient>(); PaymentAgenciesResult result = await service.GetItemsAsync(Application.Login.SessionKey, Application.Login.CompanyId); if (result.ProcessResult.Result) { list = result.PaymentAgencies; } }); return(list); }
private static async Task <List <PaymentAgency> > GetPaymentAgencyListAsync(string sessionKey, int companyId, params string[] codes) { PaymentAgenciesResult result = null; await ServiceProxyFactory.LifeTime(async factory => { var client = factory.Create <PaymentAgencyMasterService.PaymentAgencyMasterClient>(); result = await client.GetByCodeAsync(sessionKey, companyId, codes); }); if (result == null || result.ProcessResult.Result == false) { return(null); } return(result.PaymentAgencies); }
private void ImportKanaHistoryPaymentAgency() { ImportSetting importSetting = null; var task = Util.GetMasterImportSettingAsync(Login, ImportFileType.KanaHistory); ProgressDialog.Start(ParentForm, task, false, SessionKey); importSetting = task.Result; var definition = new KanaHistoryPaymentAgencyFileDefinition(new DataExpression(ApplicationControl)); definition.PaymentAgencyIdField.GetModelsByCode = val => { Dictionary <string, PaymentAgency> product = null; ServiceProxyFactory.LifeTime(factory => { var paymentMaster = factory.Create <PaymentAgencyMasterClient>(); PaymentAgenciesResult result = paymentMaster.GetByCode( Login.SessionKey, Login.CompanyId, val); if (result.ProcessResult.Result) { product = result.PaymentAgencies .ToDictionary(c => c.Code); } }); return(product ?? new Dictionary <string, PaymentAgency>()); }; var importer = definition.CreateImporter(m => new { m.PayerName, m.SourceBankName, m.SourceBranchName, m.PaymentAgencyId }); importer.UserId = Login.UserId; importer.UserCode = Login.UserCode; importer.CompanyId = Login.CompanyId; importer.CompanyCode = Login.CompanyCode; importer.LoadAsync = async() => await GetKanaHistoryPaymentAgencyAsync(); importer.RegisterAsync = async unitOfWork => await RegisterForPaymentAgencyImportAsync(unitOfWork); var importResult = DoImport(importer, importSetting); if (!importResult) { return; } grdKanaHistoryCustomer.Rows.Clear(); rdoCustomer.Focus(); }
private async Task <List <PaymentAgency> > GetPaymentAgency(string[] CustomerCode) { List <PaymentAgency> list = null; await ServiceProxyFactory.LifeTime(async factory => { var service = factory.Create <PaymentAgencyMasterClient>(); PaymentAgenciesResult result = await service.GetByCodeAsync( Login.SessionKey, Login.CompanyId, CustomerCode); if (result.ProcessResult.Result) { list = result.PaymentAgencies; } }); return(list ?? new List <PaymentAgency>()); }
public async Task <IEnumerable <PaymentAgency> > SearchByKey(params string[] keys) { List <PaymentAgency> list = null; await ServiceProxyFactory.LifeTime(async factory => { var service = factory.Create <PaymentAgencyMasterClient>(); PaymentAgenciesResult result = await service.GetItemsAsync(Application.Login.SessionKey, Application.Login.CompanyId); if (result.ProcessResult.Result) { list = result.PaymentAgencies; } }); if (list != null) { list = list.FindAll( f => (!string.IsNullOrEmpty(f.Name) && f.Name.RoughlyContains(keys[0])) || (!string.IsNullOrEmpty(f.Kana) && f.Kana.RoughlyContains(keys[0])) ); } return(list); }