Exemple #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;
        }
Exemple #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;
        }
        /// <summary> 取得したデータをコントロールに設定 </summary>
        private void SetDepartmentData(Department department, VOneTextControl code, VOneDispLabelControl name, ref int?id)
        {
            if (department == null)
            {
                code.Text = string.Empty;
                name.Text = string.Empty;
                id        = 0;
                return;
            }

            code.Text = department.Code;
            name.Text = department.Name;
            id        = department.Id;
        }
        /// <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;
            }
        }
Exemple #5
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));
        }
Exemple #6
0
 private int?GetCustomerId(Customer customer, VOneTextControl code, VOneDispLabelControl name)
 {
     code.Text = customer?.Code ?? string.Empty;
     name.Text = customer?.Name ?? string.Empty;
     return(customer?.Id);
 }