Ejemplo n.º 1
0
        private async Task <List <SectionWithLoginUser> > SectionWithLoginUserData()
        {
            var list = new List <SectionWithLoginUser>();

            await ServiceProxyFactory.LifeTime(async factory =>
            {
                var service = factory.Create <SectionWithLoginUserMasterClient>();

                SectionWithLoginUsersResult result = await service.GetItemsAsync(SessionKey, CompanyId, new SectionWithLoginUserSearch());

                if (result.ProcessResult.Result)
                {
                    list = result.SectionWithLoginUsers;
                }
            });

            return(list ?? new List <SectionWithLoginUser>());
        }
Ejemplo n.º 2
0
        private async Task <List <PaymentAgency> > GetPaymentAgency(string[] CustomerCode)
        {
            List <PaymentAgency> list = null;
            await ServiceProxyFactory.LifeTime(async factory =>
            {
                var service = factory.Create <PaymentAgencyMasterClient>();
                PaymentAgenciesResult result = await service.GetByCodeAsync(
                    Login.SessionKey,
                    Login.CompanyId,
                    CustomerCode);
                if (result.ProcessResult.Result)
                {
                    list = result.PaymentAgencies;
                }
            });

            return(list ?? new List <PaymentAgency>());
        }
Ejemplo n.º 3
0
        /// <summary>追加処理</summary>
        private async Task <bool> SaveCalendar()
        {
            var holidayCalendar = new HolidayCalendar();

            holidayCalendar.CompanyId = CompanyId;
            holidayCalendar.Holiday   = datAddDate.Value.Value;
            var succeeded = false;

            await ServiceProxyFactory.LifeTime(async factory =>
            {
                var service = factory.Create <HolidayCalendarMasterClient>();
                HolidayCalendarResult result = await service.SaveAsync(SessionKey, holidayCalendar);

                succeeded = result.ProcessResult.Result && result.HolidayCalendar != null;
            });

            return(succeeded);
        }
Ejemplo n.º 4
0
        private async Task <List <Staff> > LoadListAsync()
        {
            List <Staff> list = null;
            await ServiceProxyFactory.LifeTime(async factory =>
            {
                var service         = factory.Create <StaffMasterClient>();
                StaffsResult result = await service.GetItemsAsync(SessionKey, new StaffSearch {
                    CompanyId = CompanyId
                });

                if (result.ProcessResult.Result)
                {
                    list = result.Staffs;
                }
            });

            return(list ?? new List <Staff>());
        }
Ejemplo n.º 5
0
        private async Task <string> GetServerPath()
        {
            var serverPath = string.Empty;

            await ServiceProxyFactory.LifeTime(async factory =>
            {
                var service = factory.Create <GeneralSettingMasterClient>();
                var result  = await service.GetByCodeAsync(
                    SessionKey, CompanyId, "サーバパス");

                if (result.ProcessResult.Result)
                {
                    serverPath = result.GeneralSetting?.Value;
                }
            });

            return(serverPath);
        }
Ejemplo n.º 6
0
        private async Task <List <AccountTitle> > LoadGridAsync()
        {
            List <AccountTitle> list = null;
            await ServiceProxyFactory.LifeTime(async factory =>
            {
                var service = factory.Create <AccountTitleMasterClient>();
                var result  = await service.GetItemsAsync(SessionKey, new AccountTitleSearch {
                    CompanyId = CompanyId,
                });

                if (result.ProcessResult.Result)
                {
                    list = result.AccountTitles;
                }
            });

            return(list ?? new List <AccountTitle>());
        }
Ejemplo n.º 7
0
 private async Task LoadImporterSettingAsync(string code)
 {
     await ServiceProxyFactory.LifeTime(async factory =>
     {
         var service = factory.Create <ImporterSettingServiceClient>();
         if (!string.IsNullOrEmpty(code))
         {
             var result = await service.GetHeaderByCodeAsync(SessionKey, CompanyId, FormatId, code);
             if (result.ImporterSetting != null)
             {
                 Invoke(new System.Action(() =>
                 {
                     ImporterSetting         = result.ImporterSetting;
                     txtFilePath.Text        = ImporterSetting.InitialDirectory;
                     lblName.Text            = ImporterSetting.Name;
                     txtFilePath.Enabled     = !LimitAccessFolder;
                     txtFilePath.ReadOnly    = LimitAccessFolder;
                     btnFilePath.Enabled     = true;
                     txtPatternNo.Enabled    = false;
                     btnNumberSearch.Enabled = false;
                     if (!LimitAccessFolder)
                     {
                         ActiveControl = txtFilePath; txtFilePath.Focus();
                     }
                     ClearStatusMessage();
                     errorFlag = 0;
                     BaseContext.SetFunction05Enabled(false);
                 }));
                 Modified = false;
             }
             else
             {
                 ImporterSetting = new ImporterSetting();
                 txtPatternNo.Clear();
                 lblName.Clear();
                 txtFilePath.Clear();
                 errorFlag = 1;
                 Modified  = true;
                 BaseContext.SetFunction05Enabled(true);
                 ShowWarningDialog(MsgWngNotRegistPatternNo, code);
             }
         }
     });
 }
Ejemplo n.º 8
0
        private void txtExcludeCategoryCode_Validated(object sender, EventArgs e)
        {
            try
            {
                Category result = null;
                if (string.IsNullOrEmpty(txtExcludeCategoryCode.Text))
                {
                    SetCategory(null);
                    ClearStatusMessage();
                    return;
                }

                Task task = ServiceProxyFactory.LifeTime(async factory =>
                {
                    var service          = factory.Create <CategoryMasterClient>();
                    CategoriesResult res = await service.GetByCodeAsync(SessionKey, CompanyId,
                                                                        ExcludeCategoryType, new[] { txtExcludeCategoryCode.Text });

                    if (res.ProcessResult.Result)
                    {
                        result = res.Categories.FirstOrDefault();
                    }
                });
                ProgressDialog.Start(ParentForm, task, false, SessionKey);

                if (result == null)
                {
                    ShowWarningDialog(MsgWngMasterNotExist, "対象外区分", txtExcludeCategoryCode.Text);
                    txtExcludeCategoryCode.Clear();
                    lblExcludeCategoryName.Clear();
                    txtExcludeCategoryCode.Focus();
                }
                else
                {
                    ClearStatusMessage();
                    SetCategory(result);
                }
            }
            catch (Exception ex)
            {
                Debug.Fail(ex.ToString());
                NLogHandler.WriteErrorLog(this, ex, SessionKey);
            }
        }
Ejemplo n.º 9
0
        private async Task SaveDepartment()
        {
            var depInsert = new Department();

            depInsert.CompanyId = Login.CompanyId;
            depInsert.Code      = txtDepartmentCode.Text;
            depInsert.Name      = txtDepartmentName.Text.Trim();

            if (txtStaffCode.Text != "")
            {
                depInsert.StaffId = StaffID;
            }
            else
            {
                depInsert.StaffId = null;
            }

            depInsert.Note     = txtNote.Text.Trim();
            depInsert.UpdateBy = Login.UserId;
            depInsert.UpdateAt = DateTime.Now;
            depInsert.CreateBy = Login.UserId;
            depInsert.CreateAt = DateTime.Now;
            depInsert.Id       = DepartmentId;

            DepartmentResult  result = null;
            List <Department> list   = null;
            await ServiceProxyFactory.LifeTime(async factory =>
            {
                var service = factory.Create <DepartmentMasterClient>();
                result      = await service.SaveAsync(SessionKey, depInsert);
                list        = await GetDepartmentListAsync();
            });

            if (result.ProcessResult.Result)
            {
                DispStatusMessage(MsgInfSaveSuccess);
            }
            else
            {
                ShowWarningDialog(MsgErrSaveError);
            }
            grdDepartment.DataSource = new BindingSource(list, null);
            return;
        }
Ejemplo n.º 10
0
        private void txtLoginUserCode_Validated(object sender, EventArgs e)
        {
            try
            {
                ClearStatusMessage();

                if (string.IsNullOrWhiteSpace(txtLoginUserCode.Text))
                {
                    lblLoginUserNames.Clear();
                    return;
                }

                var success = true;
                var task    = ServiceProxyFactory.LifeTime(async factory =>
                {
                    var service        = factory.Create <LoginUserMasterClient>();
                    UsersResult result = await service.GetByCodeAsync(
                        SessionKey, CompanyId, new[] { txtLoginUserCode.Text });

                    if (result.ProcessResult.Result && result.Users.Any())
                    {
                        await SetSectionWithLoginUser(result.Users[0]);
                    }
                    else
                    {
                        ShowWarningDialog(MsgWngMasterNotExist, "ログインユーザー", txtLoginUserCode.Text);
                        success = false;
                    }
                });
                ProgressDialog.Start(ParentForm, task, false, SessionKey);

                if (!success)
                {
                    txtLoginUserCode.Clear();
                    lblLoginUserNames.Clear();
                    txtLoginUserCode.Focus();
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.StackTrace);
                NLogHandler.WriteErrorLog(this, ex, SessionKey);
            }
        }
Ejemplo n.º 11
0
        private async Task <List <CustomerGroup> > GetChildCustomersByParentId(int parentCustomerId)
        {
            List <CustomerGroup> list = null;

            if (parentCustomerId != 0)
            {
                await ServiceProxyFactory.LifeTime(async factory =>
                {
                    var service = factory.Create <CustomerGroupMasterClient>();
                    CustomerGroupsResult result = await service.GetByParentAsync(
                        SessionKey, parentCustomerId);
                    if (result.ProcessResult.Result)
                    {
                        list = result.CustomerGroups;
                    }
                });
            }
            return(list ?? new List <CustomerGroup>());
        }
Ejemplo n.º 12
0
        public async Task <IEnumerable <AccountTitle> > SearchInfo()
        {
            List <AccountTitle> list = null;
            await ServiceProxyFactory.LifeTime(async factory =>
            {
                var service = factory.Create <AccountTitleMasterClient>();
                AccountTitlesResult result = await service.GetItemsAsync(
                    Application.Login.SessionKey, new AccountTitleSearch {
                    CompanyId = Application.Login.CompanyId,
                });

                if (result.ProcessResult.Result)
                {
                    list = result.AccountTitles;
                }
            });

            return(list);
        }
        /// <summary> ほうかのSectionIdとJoinすることをチェックのため </summary>
        private async Task <List <Department> > GetDepartmentDataForCheckAsync()
        {
            List <Department> departmentList = null;

            if (SectionId != null)
            {
                await ServiceProxyFactory.LifeTime(async factory =>
                {
                    var service = factory.Create <DepartmentMasterClient>();
                    DepartmentsResult result = await service.GetWithoutSectionAsync(SessionKey, CompanyId, SectionId.Value);

                    if (result.ProcessResult.Result)
                    {
                        departmentList = result.Departments;
                    }
                });
            }
            return(departmentList ?? new List <Department>());
        }
Ejemplo n.º 14
0
        /// <summary>Set Category Items When CategoryCode Cell Leave</summary>
        /// <param name="index"> Row Index of CategoryCode Cell</param>
        private void SetCategoryItems(int index)
        {
            if (index >= 0)
            {
                string code = Convert.ToString(grdNettingInput.Rows[index]["celCategoryCode"].EditedFormattedValue);

                if (code != "")
                {
                    code = code.PadLeft(2, '0');
                    grdNettingInput.Rows[index]["celCategoryCode"].Value = code;
                }

                UseLimitDate = 0;

                CategoriesResult result = null;
                var task = ServiceProxyFactory.LifeTime(async factory =>
                {
                    var service = factory.Create <CategoryMasterClient>();
                    result      = await service.GetByCodeAsync(SessionKey, CompanyId, 2, new[] { code });
                });

                ProgressDialog.Start(ParentForm, Task.Run(() => task), false, SessionKey);
                if (result.ProcessResult.Result && result.Categories != null && result.Categories.Any())
                {
                    UseLimitDate = result.Categories[0].UseLimitDate;
                    grdNettingInput.Rows[index]["celCategoryCode"].Value     = result.Categories[0].Code;
                    grdNettingInput.Rows[index]["celCategoryCodeName"].Value = result.Categories[0].Code + ":" + result.Categories[0].Name;
                    grdNettingInput.Rows[index]["celId"].Value           = result.Categories[0].Id;
                    grdNettingInput.Rows[index]["celUseLimitDate"].Value = result.Categories[0].UseLimitDate;
                }
                else
                {
                    grdNettingInput.Rows[index]["celId"].Value               = "";
                    grdNettingInput.Rows[index]["celCategoryCode"].Value     = "";
                    grdNettingInput.Rows[index]["celCategoryCodeName"].Value = "";
                    grdNettingInput.Rows[index]["celUseLimitDate"].Value     = "";
                }
            }
            if (UseLimitDate != 1)
            {
                grdNettingInput.Rows[index]["celDueAt"].Value = null;
            }
        }
Ejemplo n.º 15
0
        /// <summary> 得意先名取得 </summary>
        /// <param name="code"> 得意先コード</param>
        /// <returns>得意先名</returns>
        private string GetCustomerName(string code)
        {
            var             name   = string.Empty;
            CustomersResult result = null;
            Task            task   = ServiceProxyFactory.LifeTime(async factory =>
            {
                var service = factory.Create <CustomerMasterClient>();
                result      = await service.GetByCodeAsync(SessionKey, CompanyId, new string[] { code });
            });

            ProgressDialog.Start(ParentForm, task, false, SessionKey);
            var customer = result?.Customers?.FirstOrDefault(x => x != null);

            if (customer != null)
            {
                name = customer.Name;
            }
            return(name);
        }
Ejemplo n.º 16
0
        private void GetReceiptSearch()
        {
            ReceiptExcludesResult result = null;

            var task = ServiceProxyFactory.LifeTime(async factory =>
            {
                var service = factory.Create <ReceiptExcludeServiceClient>();

                result = await service.GetByReceiptIdAsync(SessionKey, CurrentReceipt.Id);
            });

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

            if (result.ProcessResult.Result)
            {
                SearchResult = result.ReceiptExcludes;
                SearchDataBind(SearchResult);
            }
        }
Ejemplo n.º 17
0
        /// <summary>Get Server Path </summary>
        /// <returns>Server Path</returns>
        private string GetServerPath()
        {
            var serverPath = "";
            var login      = ApplicationContext.Login;
            var task       = ServiceProxyFactory.LifeTime(async factory =>
            {
                var service = factory.Create <GeneralSettingMasterClient>();
                var result  = await service.GetByCodeAsync(
                    login.SessionKey, login.CompanyId, "サーバパス");

                if (result.ProcessResult.Result)
                {
                    serverPath = result.GeneralSetting?.Value;
                }
            });

            ProgressDialog.Start(ParentForm, task, false, SessionKey);
            return(serverPath);
        }
Ejemplo n.º 18
0
        private async Task <List <Currency> > LoadListAsync()
        {
            List <Currency>  list   = null;
            CurrenciesResult result = null;

            await ServiceProxyFactory.LifeTime(async factory =>
            {
                var service = factory.Create <CurrencyMasterClient>();
                result      = await service.GetItemsAsync(SessionKey, CompanyId, new CurrencySearch());

                if (result.ProcessResult.Result)
                {
                    list = result.Currencies.OrderBy(b => b.DisplayOrder)
                           .ThenBy(b => b.Code).ToList();
                }
            });

            return(list ?? new List <Currency>());
        }
Ejemplo n.º 19
0
        private async Task <List <BankAccount> > LoadListAsync()
        {
            List <BankAccount> list = null;
            await ServiceProxyFactory.LifeTime(async factory =>
            {
                var service = factory.Create <BankAccountMasterClient>();
                BankAccountsResult result = await service.GetItemsAsync(
                    Login.SessionKey,
                    Login.CompanyId,
                    new BankAccountSearch());

                if (result.ProcessResult.Result)
                {
                    list = result.BankAccounts;
                }
            });

            return(list ?? new List <BankAccount>());
        }
Ejemplo n.º 20
0
        private void UpdateOutputAt()
        {
            DateTime?dateFrom = datBillingFrom.Value;

            dateFrom = dateFrom?.Date;
            DateTime?dateTo = datBillingTo.Value;

            dateTo = dateTo?.Date.AddDays(1).AddMilliseconds(-1);

            BillingsResult result     = null;
            var            updateTask = ServiceProxyFactory.LifeTime(async factory =>
            {
                var service = factory.Create <BillingServiceClient>();
                result      = await service.UpdateOutputAtAsync(SessionKey, CompanyId,
                                                                dateFrom, dateTo, CurrencyId, Login.UserId);
            });

            ProgressDialog.Start(ParentForm, updateTask, false, SessionKey);
        }
Ejemplo n.º 21
0
        /// <summary> 通貨データを取得 </summary>
        /// <param name="code"> 通貨コード </param>
        /// <returns> Currency List</returns>
        private List <Currency> GetCurrencyData(string[] code)
        {
            List <Currency>  currency = null;
            CurrenciesResult result   = null;
            var task = ServiceProxyFactory.LifeTime(async factory =>
            {
                var service = factory.Create <CurrencyMasterClient>();
                result      = await service.GetByCodeAsync(SessionKey, CompanyId, code);

                if (result.ProcessResult.Result)
                {
                    currency = result.Currencies;
                }
            });

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

            return(currency);
        }
Ejemplo n.º 22
0
        private void SaveDiscount()
        {
            var task = ServiceProxyFactory.LifeTime(async factory =>
            {
                var service = factory.Create <BillingServiceClient>();

                BillingDiscount billDiscount = new BillingDiscount();
                billDiscount.BillingId       = BillingId;
                billDiscount.DiscountAmount1 = Discount1;
                billDiscount.DiscountAmount2 = Discount2;
                billDiscount.DiscountAmount3 = Discount3;
                billDiscount.DiscountAmount4 = Discount4;
                billDiscount.DiscountAmount5 = Discount5;

                var result = await service.SaveDiscountAsync(SessionKey, billDiscount);
            });

            ProgressDialog.Start(ParentForm, task, false, SessionKey);
        }
        /// <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);
        }
Ejemplo n.º 24
0
        private async Task LoadGrid()
        {
            AccountTitlesResult result = null;
            await ServiceProxyFactory.LifeTime(async factory =>
            {
                var service = factory.Create <AccountTitleMasterClient>();
                result      = await service.GetItemsAsync(SessionKey, new AccountTitleSearch {
                    CompanyId = CompanyId
                });
            });

            if (result.ProcessResult.Result)
            {
                AccountTitleList = result.AccountTitles;
                grdAccountTitleMaster.DataSource            = new BindingSource(AccountTitleList, null);
                grdAccountTitleMaster.CurrentCellBorderLine = new Line(LineStyle.None, Color.Empty);
                grdAccountTitleMaster.CurrentRowBorderLine  = new Line(LineStyle.None, Color.Empty);
            }
        }
Ejemplo n.º 25
0
        private void DeleteJuridicalPersonality()
        {
            ClearStatusMessage();

            try
            {
                if (!ValidateInput())
                {
                    return;
                }

                if (!ShowConfirmDialog(MsgQstConfirmDelete))
                {
                    DispStatusMessage(MsgInfProcessCanceled);
                    return;
                }

                JuridicalPersonalityResult result = null;
                var task = ServiceProxyFactory.LifeTime(async factory =>
                {
                    var service = factory.Create <JuridicalPersonalityMasterClient>();
                    result      = await service.GetAsync(SessionKey, CompanyId, txtKana.Text);
                });
                ProgressDialog.Start(ParentForm, task, false, SessionKey);

                if (result.ProcessResult.Result && result.JuridicalPersonality != null)
                {
                    DeleteKana();
                    Modified           = false;
                    this.ActiveControl = txtKana;
                }
                else
                {
                    ShowWarningDialog(MsgWngNoDeleteData);
                }
            }
            catch (Exception ex)
            {
                Debug.Fail(ex.ToString());
                NLogHandler.WriteErrorLog(this, ex, SessionKey);
            }
        }
Ejemplo n.º 26
0
        private static async Task <bool> ImportAccountTransferResultAsync(string sessionKey,
                                                                          IEnumerable <AccountTransferImportData> importDataList,
                                                                          int?dueDateOffset,
                                                                          int?collectCategoryId)
        {
            AccountTransferImportResult result = null;

            await ServiceProxyFactory.LifeTime(async factory =>
            {
                var client = factory.Create <BillingService.BillingServiceClient>();
                result     = await client.ImportAccountTransferResultAsync(sessionKey, importDataList.ToArray(), dueDateOffset, collectCategoryId);
            });

            if (result == null || result.ProcessResult.Result == false)
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 27
0
        /// <summary> 請求区分設定 </summary>
        private async Task LoadBillingCategoryCombo()
        {
            CategoriesResult result = null;
            await ServiceProxyFactory.LifeTime(async factory =>
            {
                var service = factory.Create <CategoryMasterClient>();
                result      = await service.GetByCodeAsync(SessionKey, CompanyId, 1, new string[] { });
            });

            if (result.ProcessResult.Result)
            {
                CategoryList = result.Categories;
                cmbSeikyuKubun.Items.Add(new ListItem("すべて", 0));
                for (int i = 0; i < CategoryList.Count(); i++)
                {
                    cmbSeikyuKubun.Items.Add(new ListItem(CategoryList[i].Code + " : " + CategoryList[i].Name, CategoryList[i].Id));
                }
                cmbSeikyuKubun.SelectedIndex = 0;
            }
        }
Ejemplo n.º 28
0
        /// <summary> 請求部門名取得 </summary>
        /// <param name="code"> 請求部門コード</param>
        /// <returns>請求部門名</returns>
        private string GetDepartmentName(string code)
        {
            var name = string.Empty;
            DepartmentsResult result = null;
            var task = ServiceProxyFactory.LifeTime(async factory =>
            {
                var service = factory.Create <DepartmentMasterClient>();
                result      = await service.GetByCodeAsync(SessionKey, CompanyId, new string[] { code });
            });

            ProgressDialog.Start(ParentForm, task, false, SessionKey);
            var department = result?.Departments?.FirstOrDefault(x => x != null);

            if (department != null)
            {
                name = department.Name;
                ClearStatusMessage();
            }
            return(name);
        }
Ejemplo n.º 29
0
        /// <summary>法人格除去用</summary>
        private async Task <IEnumerable <string> > GetLegalPersonalitiesAsync()
        {
            if (legalPersonalities == null &&
                Login != null &&
                !string.IsNullOrEmpty(Login.SessionKey))
            {
                await ServiceProxyFactory.LifeTime(async factory =>
                {
                    var client = factory.Create <JuridicalPersonalityMasterClient>();
                    var result = await client.GetItemsAsync(Login.SessionKey,
                                                            Login.CompanyId);

                    if (result.ProcessResult.Result)
                    {
                        legalPersonalities = result.JuridicalPersonalities.Select(x => x.Kana);
                    }
                });
            }
            return(legalPersonalities);
        }
Ejemplo n.º 30
0
        private async Task LoadLastCarryOverAt()
        {
            await ServiceProxyFactory.LifeTime(async factory =>
            {
                var service = factory.Create <BillingBalanceServiceClient>();
                var result  = await service.GetLastCarryOverAtAsync(SessionKey, CompanyId);

                if (result.LastCarryOverAt.HasValue)
                {
                    datLastCarryOverAt.Value = result.LastCarryOverAt;
                    BaseContext.SetFunction02Enabled(true);
                }
                else
                {
                    BaseContext.SetFunction02Enabled(false);
                    datLastCarryOverAt.Clear();
                }
                datCarryOverAt.Clear();
            });
        }