//From~ToテキストボックスのValidated private void GetDataFromValidate(VOneTextControl code, VOneDispLabelControl name, ref int?Id) { var secGetByCode = new List <Section>(); var task = ServiceProxyFactory.LifeTime(async factory => { var service = factory.Create <SectionMasterClient>(); SectionsResult result = await service.GetByCodeAsync(SessionKey, CompanyId, new string[] { code.Text }); if (result.ProcessResult.Result && result.Sections.Any()) { secGetByCode = result.Sections; } }); ProgressDialog.Start(ParentForm, task, false, SessionKey); if (secGetByCode.Any()) { SetSectionData(secGetByCode[0], code, name, ref Id); ClearStatusMessage(); } else { ShowWarningDialog(MsgWngMasterNotExist, "入金部門", code.Text); code.Focus(); name.Clear(); code.Clear(); } Modified = true; }
/// <summary> 請求部門コントロールにあるコードでデータを取得</summary> /// <param name="code">請求部門コントロールにあるコード</param> /// <param name="name">請求部門コントロールにあるコードの名前</param> /// <param name="id">請求部門コントロールにあるコードのId</param> private void GetDataFromValidate(VOneTextControl code, VOneDispLabelControl name, ref int?id) { var depResult = new List <Department>(); SectionWithDepartment sectionWithDepValue = null; var task = ServiceProxyFactory.LifeTime(async factory => { var service = factory.Create <DepartmentMasterClient>(); var result = await service.GetByCodeAsync(SessionKey, CompanyId, new string[] { code.Text }); if (result.ProcessResult.Result && result.Departments.Any()) { depResult = result.Departments; sectionWithDepValue = await GetDepartmentIdInSWD(depResult[0].Id); } }); ProgressDialog.Start(ParentForm, task, false, SessionKey); if (depResult.Any()) { ///項目にあるコードはGridにあるかどうかをチェックする var isExists = OriginSectionWithDepList.Exists( x => x.DepartmentId == sectionWithDepValue?.DepartmentId); if (sectionWithDepValue != null && isExists == false) { ShowWarningDialog(MsgWngAlreadyRegSection, code.Text); SetDepartmentData(null, code, name, ref id); code.Focus(); return; } SetDepartmentData(depResult[0], code, name, ref id); ClearStatusMessage(); } else { ShowWarningDialog(MsgWngMasterNotExist, "請求部門", code.Text); SetDepartmentData(null, code, name, ref id); code.Focus(); return; } }
private int?GetDataFromValidate(VOneTextControl code, VOneDispLabelControl name) { var task = GetCustomerForCustomerGroup(code.Text); ProgressDialog.Start(ParentForm, task, false, SessionKey); var result = task.Result; var id = string.Empty; var args = new string[] { }; if (result == null) { id = MsgWngMasterNotExist; args = new string[] { "得意先", code.Text }; } else if (result.ParentCustomerId != 0 && result.ParentCustomerId == result.ChildCustomerId) { id = MsgWngAlreadyParentCustomer; args = new string[] { code.Text }; } else if (result.ParentCustomerId != 0 && result.ParentCustomerId != ParentCustomerId) { id = MsgWngOtherChildCustomer; args = new string[] { code.Text }; } if (!string.IsNullOrEmpty(id)) { ShowWarningDialog(id, args); name.Clear(); code.Clear(); code.Focus(); return(null); } var customer = new Customer { Id = result.ChildCustomerId, Code = result.ChildCustomerCode, Name = result.ChildCustomerName, }; return(GetCustomerId(customer, code, name)); }