private IReader CreateReader() { var filePath = txtImportFilePath.Text; var paymentAgency = PaymentAgencyList.First(pa => pa.Code == txtPaymentAgencyCode.Text); var aggregateBillings = Company.TransferAggregate != 0; var transferYear = int.Parse(txtTransferYear.Text); var formatId = (AccountTransferFileFormatId)paymentAgency.FileFormatId; var helper = new Helper { GetBillings = (companyId, paymentAgencyId, dueAt) => ServiceProxyFactory.Do((BillingService.BillingServiceClient client) => { var result = client.GetAccountTransferMatchingTargetList(SessionKey, companyId, paymentAgencyId, dueAt); if (result.ProcessResult.Result) { return(result.Billings); } return(new List <Billing>()); }), GetCustomers = (ids) => ServiceProxyFactory.Do((CustomerMasterService.CustomerMasterClient client) => { var result = client.Get(SessionKey, ids); if (result.ProcessResult.Result) { return(result.Customers.ToDictionary(x => x.Id)); } return(new Dictionary <int, Customer>()); }), }; var reader = helper.CreateReader(formatId); reader.CompanyId = CompanyId; reader.PaymentAgencyId = paymentAgency.Id; reader.AggregateBillings = aggregateBillings; reader.TransferYear = transferYear; return(reader); }
public static EBFileSetting GetEBFileSetting(ILogin login, int id) => ServiceProxyFactory.Do((EBFileSettingMasterService.EBFileSettingMasterClient client) => { var result = client.GetItem(login.SessionKey, id); if (result.ProcessResult.Result) { return(result.EBFileSetting); } return(null); });
private ExistResult IsExistNonAssignmentReceipt(DateTime closingFrom, DateTime closingTo) => ServiceProxyFactory.Do((ReceiptServiceClient client) => { var result = client.ExistNonAssignmentReceipt(Login.SessionKey, Login.CompanyId, closingFrom, closingTo); return(result); });
private Web.Models.Customer GetCustomerByCode(string code) => ServiceProxyFactory.Do((CustomerMasterClient client) => { var result = client.GetByCode(SessionKey, Login.CompanyId, new string[] { code }); if (result == null || result.ProcessResult.Result == false) { return(null); } return(result.Customers.FirstOrDefault()); });
public static ClosingInformation GetClosingInformation(string sessionKey, int companyId) => ServiceProxyFactory.Do((ClosingServiceClient client) => { var result = client.GetClosingInformation(sessionKey, companyId); if (result == null || !result.ProcessResult.Result) { return(null); } return(result.ClosingInformation); });
public static List <Customer> GetCustomerList(ILogin login, IEnumerable <string> codes) => ServiceProxyFactory.Do((CustomerMasterService.CustomerMasterClient client) => { var result = client.GetByCode(login.SessionKey, login.CompanyId, codes.ToArray()); if (result.ProcessResult.Result) { return(result.Customers); } return(new List <Customer>()); });
public static List <TaskSchedule> GetTaskSchedule(ILogin login) => ServiceProxyFactory.Do((TaskScheduleMasterService.TaskScheduleMasterClient client) => { var result = client.GetItems(login.SessionKey, login.CompanyId); if (result.ProcessResult.Result) { return(result.TaskSchedules); } return(new List <TaskSchedule>()); });
public static ApplicationControl GetApplicationControl(ILogin login) => ServiceProxyFactory.Do((ApplicationControlMasterService.ApplicationControlMasterClient client) => { var result = client.Get(login.SessionKey, login.CompanyId); if (result.ProcessResult.Result) { return(result.ApplicationControl); } return(null); });
public static Company GetCompany(ILogin login, string companyCode) => ServiceProxyFactory.Do((CompanyMasterService.CompanyMasterClient client) => { var result = client.GetByCode(login.SessionKey, companyCode); if (result.ProcessResult.Result) { return(result.Company); } return(null); });
private WebApiSetting GetWebApiSetting() => ServiceProxyFactory.Do((WebApiSettingMasterClient client) => { var result = client.GetByIdAsync(SessionKey, CompanyId, WebApiType.MoneyForward); if (result == null || result.Result.ProcessResult.Result == false) { return(null); } return(result.Result.WebApiSetting); });
private Category GetCategory(int Id) => ServiceProxyFactory.Do((CategoryMasterClient client) => { var result = client.Get(SessionKey, new int[] { Id }); if (result == null || result.ProcessResult.Result == false) { return(null); } return(result.Categories.FirstOrDefault()); });
private Staff GetStaff(int Id) => ServiceProxyFactory.Do((StaffMasterClient client) => { var result = client.Get(SessionKey, new int[] { Id }); if (result == null || result.ProcessResult.Result == false) { return(null); } return(result.Staffs.FirstOrDefault()); });
public static List <LoginUserLicense> GetLoginUserLicenses(ILogin login, int?companyId = null) => ServiceProxyFactory.Do((LoginUserLicenseMasterService.LoginUserLicenseMasterClient client) => { var result = client.GetItems(login.SessionKey, companyId ?? login.CompanyId); if (result == null || result.ProcessResult.Result == false) { return(null); } return(result.LoginUserLicenses); });
private List <LoginUser> GetLoginUser_UseClient(int companyId) => ServiceProxyFactory.Do((LoginUserMasterService.LoginUserMasterClient client) => { var result = client.GetItems(ApplicationContext.Login.SessionKey, companyId, new LoginUserSearch { UseClient = 1 }); if (result == null || result.ProcessResult.Result == false) { return(null); } return(result.Users); });
/// <summary> /// パスワードポリシー取得処理(PasswordPolicyMaster.svc:Get)を呼び出して結果を取得する。 /// </summary> private static PasswordPolicy GetPasswordPolicy(string sessionKey, int companyId) { PasswordPolicyResult result = null; ServiceProxyFactory.Do <PasswordPolicyMasterService.PasswordPolicyMasterClient>(client => result = client.Get(sessionKey, companyId)); if (result == null || result.ProcessResult.Result == false) { return(null); } return(result.PasswordPolicy); }
/// <summary> /// 会社情報取得処理(CompanyMaster.svc:GetByCode)を呼び出して結果を取得する。 /// </summary> private CompanyResult GetCompanyByCode(string sessionKey, string companyCode) { return(ServiceProxyFactory.Do((CompanyMasterService.CompanyMasterClient client) => { try { return client.GetByCode(sessionKey, companyCode); } catch (Exception ex) { NLogHandler.WriteErrorLog(this, ex, sessionKey); } return null; })); }
private PdfOutputSetting GetPdfOutputSetting() => ServiceProxyFactory.Do((PdfOutputSettingMasterClient client) => { var result = client.Get( SessionKey, Login.CompanyId, (int)PdfOutputSettingReportType.Reminder, Login.UserId); if (result == null || result.ProcessResult == null || !result.ProcessResult.Result) { return(null); } return(result.PdfOutputSetting); });
/// <summary>Get Server Path </summary> /// <returns>Server Path</returns> private string GetServerPath() { string serverPath = string.Empty; ServiceProxyFactory.Do <GeneralSettingMasterClient>(client => { GeneralSettingResult result = client.GetByCode(SessionKey, CompanyId, "サーバパス"); if (result.ProcessResult.Result) { serverPath = result.GeneralSetting?.Value; } }); return(serverPath); }
/// <summary> /// 担当者情報取得処理(LoginUserMaster.svc:GetByCode)を呼び出して結果を取得する。 /// </summary> private UsersResult GetLoginUserByCode(string sessionKey, int companyId, string userCode) { return(ServiceProxyFactory.Do((LoginUserMasterService.LoginUserMasterClient client) => { try { return client.GetByCode(sessionKey, companyId, new[] { userCode }); } catch (Exception ex) { NLogHandler.WriteErrorLog(this, ex, sessionKey); } return null; })); }
/// <summary> /// ログイン処理(LoginUserPasswordMaster.svc:Login)を呼び出して結果を取得する。 /// </summary> private LoginResult?Login(string sessionKey, int companyId, int loginUserId, string password) { LoginProcessResult result = null; ServiceProxyFactory.Do <LoginUserPasswordMasterService.LoginUserPasswordMasterClient>(client => { try { result = client.Login(sessionKey, companyId, loginUserId, password); } catch (Exception ex) { NLogHandler.WriteErrorLog(this, ex, sessionKey); } }); return(result?.Result); }
private void InitializeGrid() { var builder = ApplicationContext.CreateGcMultirowTemplateBuilder(ColorContext); var height = builder.DefaultRowHeight; var middleCenter = MultiRowContentAlignment.MiddleCenter; var widthCcy = UseForeignCurrency ? 60 : 0; var templateComboCell = builder.GetComboBoxCell(); ServiceProxyFactory.Do <ReminderSettingServiceClient>(client => { var result = client.GetReminderTemplateSettings(SessionKey, CompanyId); if (result.ProcessResult.Result) { templateComboCell.DataSource = result.ReminderTemplateSettings; templateComboCell.ValueMember = nameof(ReminderTemplateSetting.Id); templateComboCell.DisplayMember = nameof(ReminderTemplateSetting.Name); } }); builder.Items.Add(new CellSetting(height, 30, nameof(ReminderOutputed.Checked), dataField: nameof(ReminderOutputed.Checked), caption: "選択", cell: builder.GetCheckBoxCell(isBoolType: true), readOnly: false)); builder.Items.Add(new CellSetting(height, 140, nameof(ReminderOutputed.OutputAt), dataField: nameof(ReminderOutputed.OutputAt), caption: "発行日時", cell: builder.GetDateCell_yyyyMMddHHmmss(), sortable: true)); builder.Items.Add(new CellSetting(height, 70, nameof(ReminderOutputed.OutputNoPaddingZero), dataField: nameof(ReminderOutputed.OutputNoPaddingZero), caption: "発行番号", cell: builder.GetTextBoxCell(middleCenter), sortable: true)); builder.Items.Add(new CellSetting(height, 115, nameof(ReminderOutputed.CustomerCode), dataField: nameof(ReminderOutputed.CustomerCode), caption: "得意先コード", cell: builder.GetTextBoxCell(MultiRowContentAlignment.MiddleCenter), sortable: true)); builder.Items.Add(new CellSetting(height, 150, nameof(ReminderOutputed.CustomerName), dataField: nameof(ReminderOutputed.CustomerName), caption: "得意先名", cell: builder.GetTextBoxCell(), sortable: true)); builder.Items.Add(new CellSetting(height, 70, nameof(ReminderOutputed.BillingCount), dataField: nameof(ReminderOutputed.BillingCount), caption: "明細件数", cell: builder.GetNumberCell(), sortable: true)); builder.Items.Add(new CellSetting(height, widthCcy, nameof(ReminderOutputed.CurrencyCode), dataField: nameof(ReminderOutputed.CurrencyCode), caption: "通貨コード", cell: builder.GetTextBoxCell(middleCenter), sortable: true)); builder.Items.Add(new CellSetting(height, 120, nameof(ReminderOutputed.RemainAmount), dataField: nameof(ReminderOutputed.RemainAmount), caption: "滞留金額", cell: builder.GetNumberCellCurrency(Precision, Precision, 0), sortable: true)); builder.Items.Add(new CellSetting(height, 180, nameof(ReminderOutputed.ReminderTemplateId), dataField: nameof(ReminderOutputed.ReminderTemplateId), caption: "文面パターン", cell: templateComboCell, readOnly: false)); if (UseDestinationSummarized) { builder.Items.Add(new CellSetting(height, 40, nameof(ReminderOutputed.DestinationCode), dataField: nameof(ReminderOutputed.DestinationCode), caption: "", cell: builder.GetTextBoxCell(middleCenter), sortable: true)); builder.Items.Add(new CellSetting(height, 240, nameof(ReminderOutputed.DestinationDisplay), dataField: nameof(ReminderOutputed.DestinationDisplay), caption: "送付先", cell: builder.GetTextBoxCell())); } builder.Items.Add(new CellSetting(height, 60, "Preview", caption: "プレビュー", cell: builder.GetButtonCell(), readOnly: false)); grdReminder.Template = builder.Build(); grdReminder.HideSelection = true; grdReminder.AllowAutoExtend = false; if (UseDestinationSummarized) { grdReminder.FreezeLeftCellName = CellName(nameof(ReminderOutputed.Checked)); } }
/// <summary> /// パスワード変更処理(LoginUserPasswordMaster.svc:Change)を呼び出して結果を取得する。 /// </summary> /// <param name="newPassword">null/empty時はArgumentExceptionをスロー。要事前チェック。</param> private static PasswordChangeResult?ChangePassword(string sessionKey, int companyId, int userId, string oldPassword, string newPassword) { if (string.IsNullOrEmpty(newPassword)) { new ArgumentException("null/empty password can't be allowed.", nameof(newPassword)); } LoginPasswordChangeResult result = null; ServiceProxyFactory.Do <LoginUserPasswordMasterService.LoginUserPasswordMasterClient>(client => result = client.Change(sessionKey, companyId, userId, oldPassword, newPassword)); if (result == null || result.ProcessResult.Result == false) { return(null); } return(result.Result); }
private void InitializeGrid() { var builder = ApplicationContext.CreateGcMultirowTemplateBuilder(ColorContext); var templateComboCell = builder.GetComboBoxCell(); ServiceProxyFactory.Do <ReminderSettingServiceClient>(client => { var result = client.GetReminderTemplateSettings(SessionKey, CompanyId); if (result.ProcessResult.Result) { templateComboCell.DataSource = result.ReminderTemplateSettings; templateComboCell.ValueMember = nameof(ReminderTemplateSetting.Id); templateComboCell.DisplayMember = nameof(ReminderTemplateSetting.Name); } }); GridSettingList = GetGridSettingList(); GetGridCells(builder); grid.Template = builder.Build(); grid.HideSelection = true; }
/// <summary> /// メニュー項目取得処理(MenuAuthorityMaster.svc:GetItems)を呼び出して結果を取得する。 /// 権限が判定されるので、取得項目はユーザーによって可変。 /// </summary> private static MenuAuthoritiesResult GetMenuItems(string sessionKey, int companyId, int loginUserId) { MenuAuthoritiesResult result = null; Exception error = null; ServiceProxyFactory.Do <MenuAuthorityMasterService.MenuAuthorityMasterClient>(client => { try { result = client.GetItems(sessionKey, companyId, loginUserId); } catch (Exception ex) { error = ex; } }); if (result == null || error != null || result.ProcessResult.Result == false) { return(null); } return(result); }
public EbDataImporter() : base() { Helper.Initialize = () => { ServiceProxyFactory.Do((ApplicationControlMasterClient client) => { var result = client.Get(SessionKey, Login.CompanyId); if (result.ProcessResult.Result) { Helper.ApplicationControl = result.ApplicationControl; } }); ServiceProxyFactory.Do((CollationSettingMasterClient client) => { var result = client.Get(SessionKey, Login.CompanyId); if (result.ProcessResult.Result) { Helper.CollationSetting = result.CollationSetting; } }); ServiceProxyFactory.Do((CategoryMasterClient client) => { var result = client.GetByCode(SessionKey, Login.CompanyId, CategoryType.Receipt, new[] { "01" }); if (result.ProcessResult.Result) { Helper.DefaultReceiptCategory = result.Categories.First(); } }); ServiceProxyFactory.Do((CurrencyMasterClient client) => { var result = client.GetByCode(SessionKey, Login.CompanyId, new[] { Constants.DefaultCurrencyCode }); if (result.ProcessResult.Result) { Helper.DefaultCurrency = result.Currencies.First(); } }); ServiceProxyFactory.Do((JuridicalPersonalityMasterClient client) => { var result = client.GetItems(SessionKey, Login.CompanyId); if (result.ProcessResult.Result) { Helper.LegalPersonalities = result.JuridicalPersonalities.Select(x => x.Kana).ToArray(); } else { Helper.LegalPersonalities = new string[] { } }; }); }; Helper.InitializeAsync = async token => { var applicationControlTask = ServiceProxyFactory.DoAsync(async(ApplicationControlMasterClient client) => (await client.GetAsync(SessionKey, Login.CompanyId)).ApplicationControl); var collationSettingTask = ServiceProxyFactory.DoAsync(async(CollationSettingMasterClient client) => (await client.GetAsync(SessionKey, Login.CompanyId)).CollationSetting); var defaultCurrencyTask = ServiceProxyFactory.DoAsync(async(CurrencyMasterClient client) => (await client.GetByCodeAsync(SessionKey, Login.CompanyId, new[] { Constants.DefaultCurrencyCode })).Currencies.First()); var defaultReceiptCategoryTask = ServiceProxyFactory.DoAsync(async(CategoryMasterClient client) => (await client.GetByCodeAsync(SessionKey, Login.CompanyId, CategoryType.Receipt, new[] { "01" })).Categories.First()); var juridicalPersonalityTask = ServiceProxyFactory.DoAsync(async(JuridicalPersonalityMasterClient client) => (await client.GetItemsAsync(SessionKey, Login.CompanyId))?.JuridicalPersonalities.Select(x => x.Kana).ToArray() ?? new string[] { }); await Task.WhenAll( applicationControlTask, collationSettingTask, defaultCurrencyTask, defaultReceiptCategoryTask, juridicalPersonalityTask); Helper.ApplicationControl = applicationControlTask.Result; Helper.CollationSetting = collationSettingTask.Result; Helper.DefaultCurrency = defaultCurrencyTask.Result; Helper.DefaultReceiptCategory = defaultReceiptCategoryTask.Result; Helper.LegalPersonalities = juridicalPersonalityTask.Result; }; Helper.GetBankAccount = (bankCode, branchCode, accountTypeId, accountNumber) => ServiceProxyFactory.Do((BankAccountMasterClient client) => client.GetByCode(SessionKey, Login.CompanyId, bankCode, branchCode, accountTypeId, accountNumber).BankAccount); Helper.GetBankAccountAsync = (bankCode, branchCode, accountTypeId, accountNumber, token) => ServiceProxyFactory.DoAsync(async(BankAccountMasterClient client) => (await client.GetByCodeAsync(SessionKey, Login.CompanyId, bankCode, branchCode, accountTypeId, accountNumber)).BankAccount); Helper.GetBankAccountByBankName = (bankName, branchName, accountTypeId, accountNumber) => ServiceProxyFactory.Do((BankAccountMasterClient client) => { var result = client.GetItems(SessionKey, Login.CompanyId, new BankAccountSearch { CompanyId = Login.CompanyId, BankName = bankName, BranchName = branchName, AccountTypeId = accountTypeId, AccountNumber = accountNumber, }); return(result.BankAccounts?.FirstOrDefault()); }); Helper.GetBankAccountByBankNameAsync = (bankName, branchName, accountTypeId, accountNumber, token) => ServiceProxyFactory.DoAsync(async(BankAccountMasterClient client) => { var result = await client.GetItemsAsync(SessionKey, Login.CompanyId, new BankAccountSearch { CompanyId = Login.CompanyId, BankName = bankName, BranchName = branchName, AccountTypeId = accountTypeId, AccountNumber = accountNumber, }); return(result.BankAccounts?.FirstOrDefault()); }); Helper.GetBankAccountByBranchName = (bankCode, branchName) => ServiceProxyFactory.Do((BankAccountMasterClient client) => { var result = client.GetItems(SessionKey, Login.CompanyId, new BankAccountSearch { CompanyId = Login.CompanyId, BankCodes = new[] { bankCode }, BranchName = branchName, }); return(result.BankAccounts?.FirstOrDefault()); }); Helper.GetBankAccountByBranchNameAsync = (bankCode, branchName, token) => ServiceProxyFactory.DoAsync(async(BankAccountMasterClient client) => { var result = await client.GetItemsAsync(SessionKey, Login.CompanyId, new BankAccountSearch { CompanyId = Login.CompanyId, BankCodes = new[] { bankCode }, BranchName = branchName, }); return(result.BankAccounts?.FirstOrDefault()); }); Helper.GetBankAccountByBranchNameAndNumber = (bankCode, branchName, accountTypeId, accountNumber) => ServiceProxyFactory.Do((BankAccountMasterClient client) => client.GetByBranchName(SessionKey, Login.CompanyId, bankCode, branchName, accountTypeId, accountNumber).BankAccount); Helper.GetBankAccountByBranchNameAndNumberAsync = (bankCode, branchName, accountTypeId, accountNumber, token) => ServiceProxyFactory.DoAsync(async(BankAccountMasterClient client) => (await client.GetByBranchNameAsync(SessionKey, Login.CompanyId, bankCode, branchName, accountTypeId, accountNumber)).BankAccount); Helper.GetCustomerIdByExclusiveInfo = (bankCode, branchCode, payerCode) => ServiceProxyFactory.Do((CustomerMasterClient client) => { var result = client.GetTopCustomer(SessionKey, new Customer { CompanyId = Login.CompanyId, ExclusiveBankCode = bankCode, ExclusiveBranchCode = branchCode, ExclusiveAccountNumber = payerCode, }); return(result.Customer?.Id); }); Helper.GetCustomerIdByExclusiveInfoAsync = (bankCode, branchCode, payerCode, token) => ServiceProxyFactory.DoAsync(async(CustomerMasterClient client) => { var result = await client.GetTopCustomerAsync(SessionKey, new Customer { CompanyId = Login.CompanyId, ExclusiveBankCode = bankCode, ExclusiveBranchCode = branchCode, ExclusiveAccountNumber = payerCode, }); return(result.Customer?.Id); }); Helper.GetSectionIdByPayerCode = payerCode => ServiceProxyFactory.Do((SectionMasterClient client) => { var result = client.GetImportItemsForSection(SessionKey, Login.CompanyId, new[] { payerCode }); return(result.Sections?.FirstOrDefault()?.Id); }); Helper.GetSectionIdByPayerCodeAsync = (payerCode, token) => ServiceProxyFactory.DoAsync(async(SectionMasterClient client) => { var result = await client.GetImportItemsForSectionAsync(SessionKey, Login.CompanyId, new[] { payerCode }); return(result.Sections?.FirstOrDefault()?.Id); }); Helper.GetExcludeCategoryId = payerName => ServiceProxyFactory.Do((IgnoreKanaMasterClient client) => { var result = client.Get(SessionKey, Login.CompanyId, payerName); return(result?.IgnoreKana?.ExcludeCategoryId); }); Helper.GetExcludeCategoryIdAsync = (payerName, token) => ServiceProxyFactory.DoAsync(async(IgnoreKanaMasterClient client) => { var result = await client.GetAsync(SessionKey, Login.CompanyId, payerName); return(result?.IgnoreKana?.ExcludeCategoryId); }); Helper.GetEBExcludeAccountSettingList = () => ServiceProxyFactory.Do((EBExcludeAccountSettingMasterClient client) => { var result = client.GetItems(SessionKey, Login.CompanyId); return(result?.EBExcludeAccountSettingList); }); Helper.GetEBExcludeAccountSettingListAsync = token => ServiceProxyFactory.DoAsync(async(EBExcludeAccountSettingMasterClient client) => { var result = await client.GetItemsAsync(SessionKey, Login.CompanyId); return(result?.EBExcludeAccountSettingList); }); Helper.SaveDataInner = logs => ServiceProxyFactory.Do((ImportFileLogServiceClient client) => { var result = client.SaveImportFileLog(SessionKey, logs.ToArray()); return(result.ImportFileLogs); }); Helper.SaveDataInnerAsync = (logs, token) => ServiceProxyFactory.DoAsync(async(ImportFileLogServiceClient client) => { var result = await client.SaveImportFileLogAsync(SessionKey, logs.ToArray()); return(result.ImportFileLogs); }); }
/// <summary>認証処理</summary> /// <param name="args"></param> /// <returns></returns> private static DataSet AuthenticateInner(DataSet args) => ServiceProxyFactory.Do((AuthenticationService.AuthenticationClient client) => client.Authenticate(args));
public static TaskScheduleHistoryResult SaveTaskScheduleHistory(ILogin login, TaskScheduleHistory history) => ServiceProxyFactory.Do((TaskScheduleHistoryService.TaskScheduleHistoryServiceClient client) => { var result = client.Save(login.SessionKey, history); return(result); });