private void SaveSectionWithDepartment()
        {
            CloseFlg = true;

            if (!string.IsNullOrWhiteSpace(txtDepartmentFrom.Text) ||
                !string.IsNullOrWhiteSpace(txtDepartmentTo.Text))
            {
                Task <bool> containsNew = AddSectionWithDepartment();
                ProgressDialog.Start(ParentForm, containsNew, false, SessionKey);
                if (!containsNew.Result)
                {
                    ShowWarningDialog(MsgWngNoData, "追加");
                    ClearInput();
                    CloseFlg = false;
                    return;
                }
            }

            bool success = false;
            List <SectionWithDepartment> list = null;
            var task = ServiceProxyFactory.LifeTime(async factory =>
            {
                var deleteList = GetPrepareSaveData();
                var service    = factory.Create <SectionWithDepartmentMasterClient>();
                SectionWithDepartmentResult result = await service.SaveAsync(SessionKey, ModifySectionWithDepList.ToArray(), deleteList.ToArray());

                success = result?.ProcessResult.Result ?? false;

                if (success)
                {
                    list = await LoadGridListAsync();
                }
            });

            ProgressDialog.Start(ParentForm, task, false, SessionKey);

            if (success)
            {
                DispStatusMessage(MsgInfSaveSuccess);
                ModifySectionWithDepList.Clear();

                OriginSectionWithDepList       = list;
                ModifySectionWithDepList       = OriginSectionWithDepList;
                grdDepartmentModify.DataSource = new BindingSource(OriginSectionWithDepList, null);
                grdDepartmentOrigin.DataSource = new BindingSource(ModifySectionWithDepList, null);
                txtDepartmentFrom.Focus();
                ClearInput();
                Modified = false;
            }
            else
            {
                ShowWarningDialog(MsgErrSaveError);
            }
        }
        /// <summary> DepartmentIdでSectionWithDepartmetからデータを取得 </summary>
        /// <param name="departmentId"> 入力項目にある請求部門コードのId </param>
        /// <returns> SectionWithDepartmentデータ </returns>
        private async Task <SectionWithDepartment> GetDepartmentIdInSWD(int departmentId)
        {
            SectionWithDepartment depValue = null;

            if (departmentId != 0)
            {
                await ServiceProxyFactory.LifeTime(async factory =>
                {
                    var service = factory.Create <SectionWithDepartmentMasterClient>();
                    SectionWithDepartmentResult result = await service.GetByDepartmentAsync(SessionKey, CompanyId, departmentId);

                    if (result.ProcessResult.Result)
                    {
                        depValue = result.SectionDepartment;
                    }
                });
            }
            return(depValue);
        }