예제 #1
0
        //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;
        }
예제 #2
0
        private void SetSectionData(Section section, VOneTextControl code, VOneDispLabelControl name, ref int?sectionId)
        {
            if (section == null)
            {
                code.Clear();
                name.Clear();
                sectionId = 0;
                return;
            }

            code.Text = section.Code;
            name.Text = section.Name;
            sectionId = section.Id;
        }
예제 #3
0
        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));
        }