private void btnServerFileChoose_Click(object sender, EventArgs e) { this.ButtonClicked(btnServerFileChoose, alternativeText: lblServer.Text + ":" + btnServerFileChoose.Text); ClearStatusMessage(); try { var serverPath = !string.IsNullOrEmpty(txtServerPath.Text) ? txtServerPath.Text : ServerDesktopDirectory; var rootBrowserPath = new List <string>(); if (!ShowRootFolderBrowserDialog(serverPath, out rootBrowserPath, FolderBrowserType.SelectAndEditFolder)) { return; } txtServerPath.Text = rootBrowserPath.FirstOrDefault(); ServerFileList.Clear(); ServerFileList = GetFiles(rootBrowserPath.FirstOrDefault()); grdServer.DataSource = new BindingSource(ServerFileList, null); btnDL.Enabled = false; btnServerCheckAll.Enabled = ServerFileList.Count > 0; btnServerUncheckAll.Enabled = ServerFileList.Count > 0; } catch (Exception ex) { if (ex is IOException || ex is UnauthorizedAccessException) { grdServer.DataSource = null; btnDL.Enabled = false; btnServerCheckAll.Enabled = false; btnServerUncheckAll.Enabled = false; } else { Debug.Fail(ex.ToString()); NLogHandler.WriteErrorLog(this, ex, SessionKey); } } }
private void Authorize() { ClearStatusMessage(); if (!ShowConfirmDialog(MsgQstConfirmStartXXX, "再認証")) { DispStatusMessage(MsgInfProcessCanceled); return; } if (!AuthorizeInner(force: true)) { DispStatusMessage(MsgInfProcessCanceled); return; } if (!LoadPcaCompanyInfo()) { DispStatusMessage(MsgErrSomethingError, "再認証"); return; } var saveTask = SaveAsync(Setting); ProgressDialog.Start(ParentForm, saveTask, false, SessionKey); if (saveTask.Exception != null || !saveTask.Result) { if (saveTask.Exception != null) { NLogHandler.WriteErrorLog(this, saveTask.Exception, SessionKey); } ShowWarningDialog(MsgErrSaveError); return; } if (ParentScreen is PE0901) { ParentForm.DialogResult = DialogResult.OK; } Modified = false; client.TokenRefreshed = false; }
private void Save() { try { if (!ValidateChildren()) { return; } if (!ValidateInput()) { return; } if (!ShowConfirmDialog(MsgQstConfirmSave)) { DispStatusMessage(MsgInfProcessCanceled); return; } var setting = GetSettingFromControls(); var saveTask = SaveAsync(setting); ProgressDialog.Start(ParentForm, saveTask, false, SessionKey); if (!saveTask.Result) { DispStatusMessage(MsgErrSaveError); return; } ClearAll(); ParentForm.DialogResult = DialogResult.OK; } catch (Exception ex) { DispStatusMessage(MsgErrSaveError); NLogHandler.WriteErrorLog(this, ex, SessionKey); } }
private void Registration() { try { ClearStatusMessage(); if (!CheckForUpdate()) { return; } if (!ShowConfirmDialog(MsgQstConfirmSave)) { DispStatusMessage(MsgInfProcessCanceled); return; } var task = CreateBillings(); var result = ProgressDialog.Start(ParentForm, task, false, SessionKey); if (task.Result) { ShowWarningDialog(MsgInfSaveSuccess); grid.Enabled = false; BaseContext.SetFunction04Enabled(false); BaseContext.SetFunction08Enabled(false); BaseContext.SetFunction09Enabled(false); } else { ShowWarningDialog(MsgErrSomethingError, "登録"); } } catch (Exception ex) { ShowWarningDialog(MsgErrSomethingError, "登録"); Debug.Fail(ex.ToString()); NLogHandler.WriteErrorLog(this, ex, SessionKey); } }
public void Print() { try { ClearStatusMessage(); var customerGroupReport = new CustomerGroupSectionReport(); var serverPath = string.Empty; var messageId = string.Empty; ProgressDialog.Start(ParentForm, Task.Run(async() => { serverPath = await GetServerPath(); List <CustomerGroup> result = await GetPrintDataAsync(); if (!result.Any()) { messageId = MsgWngPrintDataNotExist; return; } customerGroupReport.SetBasicPageSetting(Login.CompanyCode, Login.CompanyName); customerGroupReport.Name = "債権代表者マスター" + DateTime.Today.ToString("yyyyMMdd"); customerGroupReport.DataSource = result; customerGroupReport.Run(true); }), false, SessionKey); if (!string.IsNullOrEmpty(messageId)) { ShowWarningDialog(messageId); return; } ShowDialogPreview(ParentForm, customerGroupReport, serverPath); } catch (Exception ex) { Debug.Fail(ex.ToString()); NLogHandler.WriteErrorLog(this, ex, SessionKey); ShowWarningDialog(MsgErrCreateReportError); } }
private void RePrint() { try { var outputAtArr = grdBilling.Rows .Where(x => Convert.ToBoolean(x[CellName("SelectFlag")].Value)) .Select(x => x.DataBoundItem as JournalizingSummary).Select(x => x.OutputAt).ToArray(); DateTime[] outputAts = outputAtArr.Cast <DateTime>().ToArray(); List <BillingJournalizing> rePrintList = GetBillingJournalizing(outputAts); Invoke(new System.Action(() => { var billingJournalizingReport = new BillingJournalizingSectionReport(); billingJournalizingReport.SetBasicPageSetting(Login.CompanyCode, Login.CompanyName); billingJournalizingReport.Name = "再出力請求仕訳_" + DateTime.Now.ToString("yyyyMMdd_HHmmss"); billingJournalizingReport.SetData(rePrintList, UseForeignCurrency, Precision, ColumnNameList); ProgressDialog.Start(ParentForm, Task.Run(() => { billingJournalizingReport.Run(false); }), false, SessionKey); var result = ShowDialogPreview(ParentForm, billingJournalizingReport, GetServerPath()); if (result == DialogResult.Cancel) { DispStatusMessage(MsgInfReprintedSelectData); } })); } catch (Exception ex) { Debug.Fail(ex.ToString()); NLogHandler.WriteErrorLog(this, ex, SessionKey); ShowWarningDialog(MsgErrCreateReportError); } }
private void PB0201_Load(object sender, EventArgs e) { try { SetScreenName(); var loadTask = new List <Task>(); if (ApplicationControl == null) { loadTask.Add(LoadApplicationControlAsync()); } loadTask.Add(LoadControlColorAsync()); if (Company == null) { loadTask.Add(LoadCompanyAsync()); } Task <List <Department> > departmentTask = GetDepartmentListAsync(); loadTask.Add(departmentTask); loadTask.Add(LoadFunctionAuthorities(MasterImport, MasterExport)); ProgressDialog.Start(ParentForm, Task.WhenAll(loadTask), false, SessionKey); SetFormatData(); InitializeGrid(); grdDepartment.DataSource = new BindingSource(departmentTask.Result, null); Clear(); Modified = false; txtDepartmentCode.Focus(); } catch (Exception ex) { Debug.Fail(ex.ToString()); NLogHandler.WriteErrorLog(this, ex, SessionKey); } }
private void Save() { ClearStatusMessage(); if (!RequireFieldsChecking()) { return; } ZeroLeftPaddingWithoutValidated(); if (!ShowConfirmDialog(MsgQstConfirmSave)) { DispStatusMessage(MsgInfProcessCanceled); return; } try { Task <bool> task = SaveDestination(); ProgressDialog.Start(ParentForm, task, false, SessionKey); if (task.Result) { DispStatusMessage(MsgInfSaveSuccess); Modified = false; txtDestinationCode.Focus(); } else { ShowWarningDialog(MsgErrSaveError); } } catch (Exception ex) { Debug.Fail(ex.ToString()); NLogHandler.WriteErrorLog(this, ex, SessionKey); } }
private void Delete() { if (!ValidateForDelete()) { return; } if (!ShowConfirmDialog(MsgQstConfirmDelete)) { DispStatusMessage(MsgInfProcessCanceled); return; } try { ProgressDialog.Start(ParentForm, DeleteDestination(), false, SessionKey); txtDestinationCode.Focus(); } catch (Exception ex) { Debug.Fail(ex.ToString()); NLogHandler.WriteErrorLog(this, ex, SessionKey); } }
private void Output() { ClearStatusMessage(); if (!ValidateForExport() || !ValidateAuthorization()) { return; } var task = OutputJournalizingAsync(); ProgressDialog.Start(ParentForm, task, false, SessionKey); if (task.Exception != null) { NLogHandler.WriteErrorLog(this, task.Exception, SessionKey); return; } if (task.Result) { DispStatusMessage(MsgInfFinishDataExtracting); } }
private void Cancel() { ClearStatusMessage(); if (!ShowConfirmDialog(MsgQstConfirmCancelJournalizing)) { return; } var task = CancelInnerAsync(); ProgressDialog.Start(ParentForm, task, false, SessionKey); if (!task.Result) { ShowWarningDialog(MsgErrSomethingError, "取消"); return; } if (task.Exception != null) { ShowWarningDialog(MsgErrSomethingError, "取消"); NLogHandler.WriteErrorLog(this, task.Exception, SessionKey); return; } DispStatusMessage(MsgInfFinishedSuccessJournalizingCancelingProcess); }
private void ReloadCompany() { try { ClearStatusMessage(); if (Changed && !ShowConfirmDialog(MsgQstConfirmUpdateData)) { return; } var loadTask = new List <Task>(); loadTask.Add(LoadCompanyAsync()); loadTask.Add(LoadCompanyLogosAsync()); ProgressDialog.Start(ParentForm, Task.WhenAll(loadTask), false, SessionKey); SettingFormData(); } catch (Exception ex) { Debug.Fail(ex.ToString()); NLogHandler.WriteErrorLog(this, ex, SessionKey); } }
private void Delete() { try { ClearStatusMessage(); if (!ValidateDeleteData()) { return; } if (!ShowConfirmDialog(MsgQstConfirmDelete)) { DispStatusMessage(MsgInfProcessCanceled); return; } DeleteNettingItems(); } catch (Exception ex) { Debug.Fail(ex.ToString()); NLogHandler.WriteErrorLog(this, ex, SessionKey); } }
private void PH0601_Load(object sender, EventArgs e) { try { SetScreenName(); InitializeGridForSearch(); InitializeGridForInput(); InitializeGridSequencialMatching(); InitializeGridIndividualBilling(); InitializeGridIndividualReceipt(); var loadTask = new List <Task>(); if (Company == null) { Task loadCompany = LoadCompanyAsync(); loadTask.Add(loadCompany); } if (ApplicationControl == null) { loadTask.Add(LoadApplicationControlAsync()); } ProgressDialog.Start(ParentForm, Task.WhenAll(loadTask), false, SessionKey); SetControlColor(); DisableSelectable(); grdMatchingSequential.Rows[3][3].Style.ForeColor = Color.Red; btnGridRow.Focus(); } catch (Exception ex) { Debug.Fail(ex.ToString()); NLogHandler.WriteErrorLog(this, ex, SessionKey); } }
private void PI0203_Load(object sender, EventArgs e) { try { SetScreenName(); var loadTask = new List <Task>(); if (ApplicationControl == null) { loadTask.Add(LoadApplicationControlAsync() .ContinueWith(t => { return(LoadGridSetting()); }) .Unwrap()); } loadTask.Add(LoadControlColorAsync()); if (Company == null) { loadTask.Add(LoadCompanyAsync()); } loadTask.Add(LoadReminderSummarySetting()); ProgressDialog.Start(ParentForm, Task.WhenAll(loadTask), false, SessionKey); SuspendLayout(); tbcReminder.SelectedIndex = 0; ResumeLayout(); SetInitialSetting(); InitializeGrid(); grdReminder.Text = ""; } catch (Exception ex) { Debug.Fail(ex.ToString()); NLogHandler.WriteErrorLog(this, ex, SessionKey); } }
private void txtCustomerCode_Validated(object sender, EventArgs e) { ClearStatusMessage(); var customerResult = new Customer(); if (string.IsNullOrEmpty(txtCustomerCode.Text)) { return; } try { var task = ServiceProxyFactory.LifeTime(async factory => { var service = factory.Create <CustomerMasterClient>(); CustomersResult result = await service.GetByCodeAsync(SessionKey, CompanyId, new string[] { txtCustomerCode.Text }); customerResult = result.Customers.FirstOrDefault(); if (customerResult != null) { txtCustomerCode.Text = customerResult.Code; txtCustomerName.Text = customerResult.Name; } else { txtCustomerName.Clear(); } }); ProgressDialog.Start(ParentForm, task, false, SessionKey); } catch (Exception ex) { Debug.Fail(ex.ToString()); NLogHandler.WriteErrorLog(this, ex, SessionKey); } }
private void PB1101_Load(object sender, EventArgs e) { try { SetScreenName(); AddHandlers(); var loadTask = new List <Task>(); SectionList = new List <Section>(); if (ApplicationControl == null) { loadTask.Add(LoadApplicationControlAsync()); } loadTask.Add(LoadControlColorAsync()); loadTask.Add(LoadFunctionAuthorities(MasterImport, MasterExport)); if (Company == null) { loadTask.Add(LoadCompanyAsync()); } Task loadListTask = LoadGridAsync() .ContinueWith(task => SectionList.AddRange(task.Result)); loadTask.Add(loadListTask); ProgressDialog.Start(ParentForm, Task.WhenAll(loadTask), false, SessionKey); InitializeGridLoad(); grdSectionMaster.DataSource = new BindingSource(SectionList, null); SetFormat(); Clears(); } catch (Exception ex) { Debug.Fail(ex.ToString()); NLogHandler.WriteErrorLog(this, ex, SessionKey); } }
private void PB1001_Load(object sender, EventArgs e) { try { SetScreenName(); var tasks = new List <Task>(); if (Company == null) { tasks.Add(LoadCompanyAsync()); } if (ApplicationControl == null) { tasks.Add(LoadApplicationControlAsync()); } tasks.Add(LoadControlColorAsync()); tasks.Add(LoadFunctionAuthorities(MasterImport, MasterExport)); tasks.Add(GetLegalPersonalitiesAsync()); ProgressDialog.Start(ParentForm, Task.WhenAll(tasks), false, SessionKey); Settings.SetCheckBoxValue <PB1001>(Login, cbxKana); SetFormat(); BaseContext.SetFunction05Enabled(Authorities[MasterImport]); BaseContext.SetFunction06Enabled(Authorities[MasterExport]); txtPayerName.Focus(); InitializeKanaHistoryGrid(); } catch (Exception ex) { Debug.Fail(ex.ToString()); NLogHandler.WriteErrorLog(this, ex, SessionKey); } }
private void PB0504_Load(object sender, EventArgs e) { try { var loadTasks = new List <Task>(); if (Company == null) { loadTasks.Add(LoadCompanyAsync()); } if (ApplicationControl == null) { loadTasks.Add(LoadApplicationControlAsync()); } loadTasks.Add(LoadControlColorAsync()); ProgressDialog.Start(ParentForm, Task.WhenAll(loadTasks), false, SessionKey); InitializeGrid(); if (!UseForeignCurrency) { ProgressDialog.Start(ParentForm, LoadCurrencyCode(DefaultCurrencyCode), false, SessionKey); txtCurrencyCode.Focus(); } BaseContext.SetFunction01Enabled(RegFee); pnlCurrency.Visible = UseForeignCurrency; if (UseForeignCurrency) { ActiveControl = txtCurrencyCode; } } catch (Exception ex) { Debug.Fail(ex.ToString()); NLogHandler.WriteErrorLog(this, ex, SessionKey); } }
private void Delete() { try { if (!ValidateChildren()) { return; } ClearStatusMessage(); if (!ShowConfirmDialog(MsgQstConfirmDelete)) { DispStatusMessage(MsgInfProcessCanceled); return; } var result = DeleteExclude(); if (!result) { return; } Modified = false; CurrentReceipt.RemainAmount = Convert.ToDecimal(lblDifferenceAmountTotal.Text) + Convert.ToDecimal(lblExcludeAmountTotal.Text); CurrentReceipt.ExcludeAmount = 0; GetReceiptSearch(); DispStatusMessage(MsgInfDeleteSuccess); } catch (Exception ex) { Debug.Fail(ex.ToString()); NLogHandler.WriteErrorLog(this, ex, SessionKey); } }
private void PB1401_Load(object sender, EventArgs e) { try { SetScreenName(); this.ActiveControl = txtValue; txtValue.Select(); var loadTask = new List <Task>(); if (Company == null) { loadTask.Add(LoadCompanyAsync()); } if (ApplicationControl == null) { loadTask.Add(LoadApplicationControlAsync()); } loadTask.Add(LoadControlColorAsync()); ProgressDialog.Start(ParentForm, Task.WhenAll(loadTask).ContinueWith(async t => { GeneralSettingList = await GetGeneralSettingListAsync(); }, TaskScheduler.FromCurrentSynchronizationContext()).Unwrap(), false, SessionKey); InitializeGeneralSettingGrid(); grdGeneralSetting.Rows.Clear(); grdGeneralSetting.DataSource = new BindingSource(GeneralSettingList, null); } catch (Exception ex) { Debug.Fail(ex.ToString()); NLogHandler.WriteErrorLog(this, ex, SessionKey); } }
private List <ListItem> GetFiles(string selectedPath) { List <ListItem> files = new List <ListItem>(); try { if (string.IsNullOrEmpty(selectedPath) || !Directory.Exists(selectedPath)) { return(files); } var directory = new DirectoryInfo(selectedPath); var filePath = directory.GetFiles() .Where(f => !f.Attributes.HasFlag(FileAttributes.System) && !f.Attributes.HasFlag(FileAttributes.Hidden)) .OrderByDescending(p => p.LastWriteTime) .ToList(); foreach (var path in filePath) { files.Add(new ListItem(Path.GetFileName(path.Name))); } } catch (Exception ex) { if (ex is IOException || ex is UnauthorizedAccessException) { throw; } else { Debug.Fail(ex.ToString()); } NLogHandler.WriteErrorLog(this, ex, SessionKey); } return(files); }
private void Delete() { ClearStatusMessage(); if (!ShowConfirmDialog(MsgQstConfirmDelete)) { DispStatusMessage(MsgInfProcessCanceled); return; } var deleteTask = DeleteAsync(); ProgressDialog.Start(ParentForm, deleteTask, false, SessionKey); if (deleteTask.Exception != null || !deleteTask.Result) { if (deleteTask.Exception != null) { NLogHandler.WriteErrorLog(this, deleteTask.Exception, SessionKey); } ShowWarningDialog(MsgErrDeleteError); return; } ClearControlValues(); DispStatusMessage(MsgInfDeleteSuccess); }
private void txtStaffCode_Validated(object sender, EventArgs e) { try { if (txtStaffCode.Text == "") { selectedstaffCode = ""; lblStaffName.Clear(); ClearStatusMessage(); Setting.StaffId = null; return; } if (selectedstaffCode == txtStaffCode.Text) { return; } SetStaffCodeVal(); } catch (Exception ex) { Debug.Fail(ex.ToString()); NLogHandler.WriteErrorLog(this, ex, SessionKey); } }
private void Delete() { try { grdHolidayCalendar.EndEdit(); ClearStatusMessage(); if (!ValidateDeleteData()) { return; } if (!ShowConfirmDialog(MsgQstConfirmDelete)) { DispStatusMessage(MsgInfProcessCanceled); return; } var task = DeleteDate(); ProgressDialog.Start(ParentForm, task, false, SessionKey); bool succeeded = task.Result; if (succeeded) { DispStatusMessage(MsgInfDeleteSuccess); } else { ShowWarningDialog(MsgErrDeleteError); } } catch (Exception ex) { Debug.Fail(ex.ToString()); NLogHandler.WriteErrorLog(this, ex, SessionKey); } }
private void PB1601_Load(object sender, EventArgs e) { try { SetScreenName(); var loadTask = new List <Task>(); loadTask.Add(LoadControlColorAsync()); if (Company == null) { loadTask.Add(LoadCompanyAsync()); } if (ApplicationControl == null) { loadTask.Add(LoadApplicationControlAsync()); } loadTask.Add(LoadFunctionAuthorities(MasterImport, MasterExport)); ProgressDialog.Start(ParentForm, Task.WhenAll(loadTask), false, SessionKey); InitializeCalendarGrid(); Clear(); BaseContext.SetFunction05Enabled(Authorities[MasterImport]); BaseContext.SetFunction06Enabled(Authorities[MasterExport]); this.ActiveControl = datFromHoliday; datFromHoliday.Focus(); } catch (Exception ex) { Debug.Fail(ex.ToString()); NLogHandler.WriteErrorLog(this, ex, SessionKey); } }
private void PH0401_Load(object sender, EventArgs e) { try { SetScreenName(); var loadTask = new List <Task>(); if (Company == null) { loadTask.Add(LoadCompanyAsync()); } if (ApplicationControl == null) { loadTask.Add(LoadApplicationControlAsync()); } loadTask.Add(LoadControlColorAsync()); ProgressDialog.Start(ParentForm, Task.WhenAll(loadTask.ToArray()), false, SessionKey); ClientFileList = new List <ListItem>(); ServerFileList = new List <ListItem>(); ClientDesktopDirectory = DefaultClient; ServerDesktopDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); InitializeGridTemplate(grdClient); InitializeGridTemplate(grdServer); SetClient(); SetServer(); } catch (Exception ex) { Debug.Fail(ex.ToString()); NLogHandler.WriteErrorLog(this, ex, SessionKey); } }
private void PH9905_Load(object sender, EventArgs e) { try { FromCustomerLedger = FormName == nameof(PF0501); FromCollectionSchedule = FormName == nameof(PF0601); ProgressDialog.Start(ParentForm, InitializeLoadDataAsync(), false, SessionKey); SetOrderedList(); InitializeGridTemplate(); SetGridTemplate(); ClearStatusMessage(); Modified = false; grid.CellValueChanged += grdSearchSettingData_CellValueChanged; grid.CurrentCellDirtyStateChanged += grdSearchSettingData_CurrentCellDirtyStateChanged; } catch (Exception ex) { Debug.Fail(ex.ToString()); NLogHandler.WriteErrorLog(this, ex, SessionKey); } }
private void Save() { try { var inputGridType = InputGridTypeId == InputGridType.Billing ? "請求" : "入金"; if (!ShowConfirmDialog(MsgQstConfirmClearEditedXXXData, inputGridType)) { return; } SetInputControlInfo(); InputControlsResult result = null; ProgressDialog.Start(ParentForm, Task.Run(async() => { result = await ServiceProxyFactory.DoAsync(async(InputControlMasterClient client) => await client.SaveAsync(SessionKey, CompanyId, Login.UserId, InputGridTypeId, InputControlList.ToArray())); }), false, SessionKey); if (result.ProcessResult.Result) { Modified = false; ParentForm.DialogResult = DialogResult.OK; } else { ShowWarningDialog(MsgErrSaveError); } } catch (Exception ex) { Debug.Fail(ex.ToString()); NLogHandler.WriteErrorLog(this, ex, SessionKey); } }
private void txtStaffCode_Validated(object sender, EventArgs e) { try { var code = txtStaffCode.Text; var staffName = ""; if (code != "") { staffName = GetStaffNameByCode(code); if (!string.IsNullOrEmpty(staffName)) { lblStaffName.Text = staffName; ClearStatusMessage(); } else { ShowWarningDialog(MsgWngMasterNotExist, "営業担当者", txtStaffCode.Text); txtStaffCode.Clear(); txtStaffCode.Focus(); lblStaffName.Clear(); } } else { lblStaffName.Clear(); ClearStatusMessage(); } } catch (Exception ex) { Debug.Fail(ex.ToString()); NLogHandler.WriteErrorLog(this, ex, SessionKey); } }