void ModifyApprover(VouchersClient voucher) { var cwEmployee = new CWEmployee(api); #if !SILVERLIGHT cwEmployee.DialogTableId = 2000000076; #endif cwEmployee.Closed += async delegate { if (cwEmployee.DialogResult == true) { var result = await docApi.ChangeApprover(voucher, cwEmployee.Employee, cwEmployee.Comment); if (result == ErrorCodes.Succes) { RemoveRow(voucher); } else { UtilDisplay.ShowErrorCode(result); } } }; cwEmployee.Show(); }
void Vouchers_BeforeClose() { cache = null; envelopes = null; voucherClient = null; this.BeforeClose -= Vouchers_BeforeClose; }
public void ImportVoucher(UnicontaBaseEntity selectedItem, VouchersClient voucher = null) { if (selectedItem == null) { return; } }
void SaveAttachment(GLTransClient selectedItem, VouchersClient doc) { CWForAllTrans cwconfirm = new CWForAllTrans(); cwconfirm.Closing += async delegate { if (cwconfirm.DialogResult == true) { if (selectedItem._DocumentRef != 0) { VoucherCache.RemoveGlobalVoucherCache(selectedItem.CompanyId, selectedItem._DocumentRef); } busyIndicator.IsBusy = true; var errorCodes = await postingApiInv.AddPhysicalVoucher(selectedItem, doc, cwconfirm.ForAllTransactions, cwconfirm.AppendDoc); busyIndicator.IsBusy = false; if (errorCodes == ErrorCodes.Succes) { BindGrid(); } else { UtilDisplay.ShowErrorCode(errorCodes); } } }; cwconfirm.Show(); }
private void AddVoucher(CreditorOrderClient selectedItem, string actionType) { var voucher = new VouchersClient(); voucher._Content = ContentTypes.PurchaseInvoice; voucher._PurchaseNumber = selectedItem._OrderNumber; voucher._Project = selectedItem._Project; voucher._Approver1 = selectedItem._Approver; voucher._CreditorAccount = selectedItem._InvoiceAccount ?? selectedItem._DCAccount; #if !SILVERLIGHT if (actionType == "DragDrop") { var dragDropWindow = new UnicontaDragDropWindow(false); dragDropWindow.Closed += delegate { if (dragDropWindow.DialogResult == true) { var fileInfo = dragDropWindow.FileInfoList?.SingleOrDefault(); if (fileInfo != null) { voucher._Data = fileInfo.FileBytes; voucher._Text = fileInfo.FileName; voucher._Fileextension = DocumentConvert.GetDocumentType(fileInfo.FileExtension); } Utility.ImportVoucher(selectedItem, api, voucher, true); } }; dragDropWindow.Show(); } else #endif Utility.ImportVoucher(selectedItem, api, voucher, false); }
private void UploadData(VouchersClient selectedItem) { var fileExt = selectedItem.Fileextension; var cwUpdateFile = new CWUpdateFile(fileExt, Uniconta.ClientTools.Localization.lookup("Voucher")); cwUpdateFile.Closed += async delegate { if (cwUpdateFile.DialogResult == true) { if (cwUpdateFile.Contents != null) { byte[] buffer = cwUpdateFile.Contents; if (buffer != null && selectedItem.RowId != 0) { selectedItem._Data = buffer; VoucherCache.SetGlobalVoucherCache(selectedItem); busyIndicator.IsBusy = true; await api.Update(selectedItem); busyIndicator.IsBusy = false; } } else { UnicontaMessageBox.Show(Uniconta.ClientTools.Localization.lookup("ViewerFailed"), Uniconta.ClientTools.Localization.lookup("Error"), MessageBoxButton.OK); return; } } }; cwUpdateFile.Show(); }
private async Task <ErrorCodes> SavePdfFileToVouchers( CrudAPI crudApi, docType_ns_VSKSkyrslaSvar reply) { var errorCode = ErrorCodes.NoSucces; byte[] docBytes = reply.PDFKvittun; var vc = new VouchersClient { _Data = docBytes, Fileextension = FileextensionsTypes.PDF, Text = "VSK skil", _Amount = reply.NidurstadaSkila.Fjarhaedir.TilGreidslu ?? 0, _Content = ContentTypes.Documents, }; var success = false; while (!success) { errorCode = await crudApi.Insert(vc); success = errorCode == ErrorCodes.Succes; if (!success) { UnicontaMessageBox.Show( Localization.GetLocalization(Uniconta.Common.Language.Is).Lookup(errorCode.ToString()) + "\nReyna aftur?", // Try again? "Villa við vistun", // Error while saving messageBoxImage: MessageBoxImage.Error, messageBoxButton: MessageBoxButton.YesNo ); } } return(errorCode); }
private void ViewProgram_Click(object sender, RoutedEventArgs e) { if (voucherClient == null) { return; } busyIndicator.IsBusy = true; if (voucherClient._Envelope) { if (selectedIndex > envelopes.Length - 1) { return; } VouchersClient vClient = envelopes[selectedIndex]; if (vClient._Data != null) { ViewInProgram(vClient.Buffer, vClient._Fileextension); } } else if (voucherClient._Data != null) { ViewInProgram(voucherClient.Buffer, voucherClient._Fileextension); } busyIndicator.IsBusy = false; }
private void InitPage(CrudAPI crudApi) { leAccount.api = lePayAccount.api = leCostAccount.api = leVat.api = leVatOpenration.api = leTransType.api = leApprover1.api = leApprover2.api = leProject.api = leProjectcat.api = crudApi; layoutControl = layoutItems; cmbDim1.api = cmbDim2.api = cmbDim3.api = cmbDim4.api = cmbDim5.api = crudApi; if (LoadedRow == null) { frmRibbon.DisableButtons("Delete"); } var Comp = api.CompanyEntity; if (Comp.NumberOfDimensions == 0) { usedim.Visibility = Visibility.Collapsed; } else { Utility.SetDimensions(crudApi, lbldim1, lbldim2, lbldim3, lbldim4, lbldim5, cmbDim1, cmbDim2, cmbDim3, cmbDim4, cmbDim5, usedim); } if (LoadedRow == null) { voucherClientRow = CreateNew() as VouchersClient; } if (!string.IsNullOrEmpty(viewInbin)) { voucherClientRow.ViewInFolder = viewInbin; } if (!api.CompanyEntity._UseVatOperation) { VatOPerationItem.Visibility = Visibility.Collapsed; } if (!api.CompanyEntity.Project) { ProjectItem.Visibility = Visibility.Collapsed; ProjectCategoryItem.Visibility = Visibility.Collapsed; } if (isFieldsAvailableForEdit) { browseCtrlColumn.Visibility = Visibility.Collapsed; } BusyIndicator = busyIndicator; layoutItems.DataContext = voucherClientRow; frmRibbon.OnItemClicked += frmRibbon_OnItemClicked; #if !SILVERLIGHT browseControl.CompressVisibility = Visibility.Visible; browseControl.PDFSplitVisibility = Visibility.Visible; txtPurchaseNumber.CrudApi = api; txtUrl.LostFocus += txtUrl_LostFocus; #endif voucherClientRow.PropertyChanged += VoucherClientRow_PropertyChanged; PaymentCache = Comp.GetCache(typeof(Uniconta.DataModel.PaymentTerm)); StartLoadCache(); }
public void export() { DateTime ExportFromDate = DateTime.Now.AddDays(-3); var crit = new List <PropValuePair>(); var pair = PropValuePair.GenereteWhereElements("KeyName", typeof(string), "Danske Bank"); crit.Add(pair); var taskQryBankStatment = m_api.Query <BankStatementClient>(crit); taskQryBankStatment.Wait(); var col = taskQryBankStatment.Result; if (col.Count() == 1) { ExportFromDate = col[0].LastTransaction; var DaysSlip = col[0].DaysSlip; ExportFromDate = ExportFromDate.AddDays(-DaysSlip); } //ExportFromDate = DateTime.Now.AddDays(-70); //<-------------------Fjernes using (StringWriter sr = new StringWriter()) { var qry = from w in m_dbData3060.tblbankkontos where w.bankkontoid == m_bankkontoid && (w.skjul == null || w.skjul == false) && w.dato >= ExportFromDate orderby w.dato select w; int antal = qry.Count(); string ln = @"pid;dato;tekst;beløb;saldo"; sr.WriteLine(ln); foreach (var b in qry) { ln = ""; ln += @"""" + b.pid.ToString() + @"""" + ";"; ln += (b.dato == null) ? ";" : @"""" + ((DateTime)b.dato).ToString("dd.MM.yyyy") + @"""" + ";"; ln += (b.tekst == null) ? ";" : @"""" + b.tekst.Replace(";", " ") + @"""" + ";"; ln += (b.belob == null) ? ";" : @"""" + ((decimal)(b.belob)).ToString("0.00") + @"""" + ";"; ln += (b.saldo == null) ? ";" : @"""" + ((decimal)(b.saldo)).ToString("0.00") + @""""; sr.WriteLine(ln); } //byte[] attachment = Encoding.Default.GetBytes(sr.ToString()); byte[] attachment = Encoding.GetEncoding(1251).GetBytes(sr.ToString()); VouchersClient vc = new VouchersClient() { Text = "DanskeErhverv", Content = "Bankkontoudtog", Fileextension = FileextensionsTypes.CSV, VoucherAttachment = attachment, }; var taskInsertVouchers = m_api.Insert(vc); taskInsertVouchers.Wait(); var err = taskInsertVouchers.Result; } }
private void SetMetaInfo(VouchersClient vc) { this.voucherClient = vc; if (vc != null) { metaInfoCtrl.SetlValues(vc._Text, vc.Created.ToString("g"), vc._Fileextension.ToString(), vc._UserName, vc.Content, vc.PostingInstruction, vc.Approver1, vc.Approver2); metaInfoCtrl.Visibility = Visibility.Visible; } }
void RemoveRow(VouchersClient selectedItem) { var rows = dgVoucherApproveGrid.GetSelectedRowHandles(); if (rows != null && rows.Length > 0) { dgVoucherApproveGrid.tableView.DeleteRow(rows[0]); } }
private async Task CreateZip(IEnumerable <GLTransClient> glTransLst, Stream outputStream) { var voucherExpLst = new HashSet <int>(); var docApi = new Uniconta.API.GeneralLedger.DocumentAPI(api); using (ZipOutputStream zipOutputStream = new ZipOutputStream(outputStream)) { // Highest compression rating zipOutputStream.SetLevel(9); zipOutputStream.UseZip64 = UseZip64.Dynamic; foreach (var glTrans in glTransLst) { if (!voucherExpLst.Contains(glTrans._DocumentRef)) { voucherExpLst.Add(glTrans._DocumentRef); var voucher = new VouchersClient() { RowId = glTrans._DocumentRef }; if (await UtilDisplay.GetData(voucher, api) == ErrorCodes.Succes) { if (!voucher._Envelope) { ExportFile(voucher, zipOutputStream); } else { var content = voucher.GetEnvelopeContent(); if (content != null) { foreach (var vou in content) { if (!voucherExpLst.Contains(vou.RowId)) { voucherExpLst.Add(vou.RowId); voucher = new VouchersClient() { RowId = vou.RowId }; if (await UtilDisplay.GetData(voucher, api) == ErrorCodes.Succes) { if (!voucher._Envelope) { ExportFile(voucher, zipOutputStream); } } } } } } } } } zipOutputStream.Finish(); } }
public void export() { DateTime ExportFromDate = DateTime.Now.AddDays(-3); var api = UCInitializer.GetBaseAPI; var crit = new List <PropValuePair>(); var pair = PropValuePair.GenereteWhereElements("KeyName", typeof(string), "Danske Bank"); crit.Add(pair); var taskQryBankStatment = api.Query <BankStatementClient>(null, crit); taskQryBankStatment.Wait(); var col = taskQryBankStatment.Result; if (col.Count() == 1) { ExportFromDate = col[0].LastTransaction; var DaysSlip = col[0].DaysSlip; ExportFromDate.AddDays(-DaysSlip); } using (StringWriter sr = new StringWriter()) { var qry = from w in Program.dbDataTransSumma.tblbankkontos where w.bankkontoid == m_bankkontoid && (w.skjul == null || w.skjul == false) && w.dato >= ExportFromDate orderby w.dato select w; int antal = qry.Count(); string ln = @"pid;dato;tekst;beløb;saldo"; sr.WriteLine(ln); foreach (var b in qry) { ln = ""; ln += b.pid.ToString() + ";"; ln += (b.dato == null) ? ";" : ((DateTime)b.dato).ToString("dd.MM.yyyy") + ";"; ln += (b.tekst == null) ? ";" : b.tekst + ";"; ln += (b.belob == null) ? ";" : ((decimal)(b.belob)).ToString("0.00") + @";"; ln += (b.saldo == null) ? ";" : ((decimal)(b.saldo)).ToString("0.00"); sr.WriteLine(ln); } byte[] attachment = Encoding.Default.GetBytes(sr.ToString()); VouchersClient vc = new VouchersClient() { Text = string.Format("Danske Bank Kontoudtog {0}", DateTime.Now), Content = "Bankkontoudtog", DocumentDate = DateTime.Now, Fileextension = FileextensionsTypes.CSV, VoucherAttachment = attachment, }; var taskInsertVouchers = api.Insert(vc); taskInsertVouchers.Wait(); var err = taskInsertVouchers.Result; } }
async void View(VouchersClient selectedItem) { if (selectedItem._Data == null) { busyIndicator.IsBusy = true; await UtilDisplay.GetData(selectedItem, api); } ViewVoucher(TabControls.VouchersPage3, dgAttachedVoucherGrid.syncEntity); busyIndicator.IsBusy = false; }
private void FillVoucherInfo(VouchersClient vc) { vc.Content = Convert.ToString(cmbContentTypes.SelectedItemValue); vc._Amount = NumberConvert.ToDouble(txtAmount.Text); vc._Qty = NumberConvert.ToDouble(txtQty.Text); if (!string.IsNullOrWhiteSpace(txtInvoice.Text)) { vc._Invoice = txtInvoice.Text; } vc._DocumentDate = txtDocumentDate.DateTime; vc.Currency = Convert.ToString(cmbCurrency.SelectedItem); vc.CreditorAccount = leAccount.Text; vc.PayDate = txtPaymentDate.DateTime; vc.CostAccount = leCostAccount.Text; vc.PayAccount = lePayAccount.Text; vc.Vat = leVat.Text; vc.VatOperation = leVatOpenration.Text; vc.TransType = leTransType.Text; vc._Approved = (bool)chkApproved.IsChecked; vc._Approver1 = leApprover1.Text; vc._Approver2 = leApprover2.Text; vc.PaymentId = txtPaymentId.Text; vc.Project = leProject.Text; vc.PrCategory = leProjectcat.Text; vc._PostingInstruction = txedPostingInstruction.Text; vc.PaymentMethod = Convert.ToString(cmbPaymentMethod.SelectedItemValue); #if !SILVERLIGHT vc.ViewInFolder = Convert.ToString(cmbViewInFolder.SelectedItem); vc._PurchaseNumber = GetPurchaseNumber(); #endif if (lbldim1.Visibility == Visibility.Visible) { vc.Dimension1 = cmbDim1.Text; } if (lbldim2.Visibility == Visibility.Visible) { vc.Dimension2 = cmbDim2.Text; } if (lbldim3.Visibility == Visibility.Visible) { vc.Dimension3 = cmbDim3.Text; } if (lbldim4.Visibility == Visibility.Visible) { vc.Dimension4 = cmbDim4.Text; } if (lbldim5.Visibility == Visibility.Visible) { vc.Dimension5 = cmbDim5.Text; } }
async void UpdateInBox(VouchersClient selectedItem) { var rec = new DocumentNoRef(); rec.SetMaster(selectedItem); busyIndicator.IsBusy = true; var result = await api.Insert(rec); busyIndicator.IsBusy = false; UtilDisplay.ShowErrorCode(result); }
void ExportFile(VouchersClient voucher, ZipOutputStream zipOutputStream) { byte[] attachment = voucher.Buffer; voucher._Data = null; voucher._LoadedData = null; if (attachment == null) { if (voucher._Url != null) { try { if (voucher.IsWebUrl) { #if !SILVERLIGHT attachment = new WebClient().DownloadData(voucher._Url); var ext = System.IO.Path.GetExtension(voucher._Url); if (ext != null) { voucher._Fileextension = DocumentConvert.GetDocumentType(DocumentConvert.GetExtension(ext)); } #endif } else { #if SILVERLIGHT attachment = UtilFunctions.LoadFile(voucher._Url); #else attachment = UtilFunctions.LoadFile(voucher._Url).GetAwaiter().GetResult(); #endif } if (attachment == null) { return; } } catch { return; } } else { return; } } // Write the data to the ZIP file var sb = StringBuilderReuse.Create(voucher._Text).Replace('/', '-').Replace('\\', '-'); sb.Append('_').Append(voucher.RowId).Append('.').Append(Enum.GetName(typeof(FileextensionsTypes), IdObject.get((byte)voucher._Fileextension))); var name = sb.ToStringAndRelease(); zipOutputStream.PutNextEntry(new ZipEntry(name)); zipOutputStream.Write(attachment, 0, attachment.Length); WriteLogLine(string.Format(Uniconta.ClientTools.Localization.lookup("ExportingFile"), name)); }
async public Task <int> InsertVouchersClients(recKladder rec) { string mask_bilag = m_BilagPath + @"\Bilag {0}.pdf"; var api = UCInitializer.GetBaseAPI; string hash = null; byte[] attachment = null; DateTime file_date = DateTime.Now; try { string file_bilag = string.Format(mask_bilag, rec.Bilag); var fileinfo = new FileInfo(file_bilag); int file_bilag_length = (int)fileinfo.Length; file_date = fileinfo.CreationTime; attachment = new byte[file_bilag_length]; FileStream ts = new FileStream(file_bilag, FileMode.Open, FileAccess.Read, FileShare.None); ts.Read(attachment, 0, file_bilag_length); ts.Close(); using (SHA1CryptoServiceProvider sha1 = new SHA1CryptoServiceProvider()) { hash = Convert.ToBase64String(sha1.ComputeHash(attachment)); } var crit = new List <PropValuePair>(); var pair = PropValuePair.GenereteWhereElements("PostingInstruction", typeof(String), hash); crit.Add(pair); var collection = await api.Query <VouchersClient>(null, crit); if (collection.Count() > 0) { return(collection[0].PrimaryKeyId); } } catch { return(0); } VouchersClient vc = new VouchersClient() { Text = string.Format("Bilag {0}", rec.Bilag), DocumentDate = file_date, Fileextension = FileextensionsTypes.PDF, VoucherAttachment = attachment, PostingInstruction = hash }; var err = await api.Insert(vc); return(vc.PrimaryKeyId); }
private void frmRibbon_OnItemClicked(string ActionType) { switch (ActionType) { case "SaveAndOrderLines": saveFormAndOpenControl(TabControls.DebtorOrderLines); break; case "RefVoucher": var _refferedVouchers = new List <int>(); if (editrow._DocumentRef != 0) { _refferedVouchers.Add(editrow._DocumentRef); } AddDockItem(TabControls.AttachVoucherGridPage, new object[] { _refferedVouchers }, true); break; case "ViewVoucher": busyIndicator.IsBusy = true; ViewVoucher(TabControls.VouchersPage3, editrow); busyIndicator.IsBusy = false; break; case "ImportVoucher": var voucher = new VouchersClient(); voucher._Content = ContentTypes.Invoice; Utility.ImportVoucher(editrow, api, voucher); break; case "RemoveVoucher": RemoveVoucher(editrow); break; case "Save": if (!Utility.IsExecuteWithBlockedAccount(editrow.Debtor)) { return; } frmRibbon_BaseActions(ActionType); break; default: frmRibbon_BaseActions(ActionType); break; } }
void UpdateVoucher(VouchersClient attachedVoucher, CreditorOrderClient editrow) { if (attachedVoucher == null) { return; } var buf = attachedVoucher._Data; attachedVoucher._Data = null; var org = StreamingManager.Clone(attachedVoucher); attachedVoucher._Content = ContentTypes.PurchaseInvoice; attachedVoucher._PurchaseNumber = editrow._OrderNumber; attachedVoucher._CreditorAccount = editrow._InvoiceAccount ?? editrow._DCAccount; api.UpdateNoResponse(org, attachedVoucher); attachedVoucher._Data = buf; }
private void AddVoucher(GLTransClient selectedItem, string actionType) { CWAddVouchers addVouchersDialog = null; #if !SILVERLIGHT if (actionType == "DragDrop") { var dragDropWindow = new UnicontaDragDropWindow(false); dragDropWindow.Closed += delegate { if (dragDropWindow.DialogResult == true) { var vouchersClient = new VouchersClient(); var fileInfo = dragDropWindow.FileInfoList?.SingleOrDefault(); if (fileInfo != null) { vouchersClient._Data = fileInfo.FileBytes; vouchersClient._Text = fileInfo.FileName; vouchersClient._Fileextension = DocumentConvert.GetDocumentType(fileInfo.FileExtension); } addVouchersDialog = new CWAddVouchers(api, vouchersClient, true); } }; dragDropWindow.Show(); } else #endif addVouchersDialog = new CWAddVouchers(api, false, null); if (addVouchersDialog == null) { return; } addVouchersDialog.Closed += delegate { if (addVouchersDialog.DialogResult == true) { if (addVouchersDialog.VoucherRowIds.Length > 0 && addVouchersDialog.vouchersClient != null) { SaveAttachment(selectedItem, addVouchersDialog.vouchersClient); } } }; addVouchersDialog.Show(); }
async void ApproveDoc(VouchersClient selectedItem) { if (dgVoucherApproveGrid.HasUnsavedData) { await dgVoucherApproveGrid.SaveData(); } var result = await docApi.DocumentSetApprove(selectedItem, null, employee); if (result == ErrorCodes.Succes) { RemoveRow(selectedItem); } else { UtilDisplay.ShowErrorCode(result); } }
void ApproveComment(VouchersClient selectedItem, string ActionType) { if (dgVoucherApproveGrid.HasUnsavedData) { dgVoucherApproveGrid.SaveData(); } CWCommentsDialogBox commentsDialog = new CWCommentsDialogBox(Uniconta.ClientTools.Localization.lookup("Note"), false, DateTime.MinValue); #if !SILVERLIGHT commentsDialog.DialogTableId = 2000000068; #endif commentsDialog.Closing += async delegate { if (commentsDialog.DialogResult == true) { ErrorCodes result; if (ActionType == "ApproveWithComments") { result = await docApi.DocumentSetApprove(selectedItem, commentsDialog.Comments, employee); } else if (ActionType == "Reject") { result = await docApi.DocumentSetReject(selectedItem, commentsDialog.Comments, employee); } else if (ActionType == "Await") { result = await docApi.DocumentSetWait(selectedItem, commentsDialog.Comments, employee); } else { result = ErrorCodes.NoSucces; } if (result == ErrorCodes.Succes) { RemoveRow(selectedItem); } else { UtilDisplay.ShowErrorCode(result); } } }; commentsDialog.Show(); }
private void saveImage_Click(object sender, RoutedEventArgs e) { if (voucherClient == null) { return; } busyIndicator.IsBusy = true; if (voucherClient._Envelope) { VouchersClient vClient = envelopes[selectedIndex]; UtilDisplay.SaveData(vClient.Buffer, vClient._Fileextension); } else { UtilDisplay.SaveData(voucherClient.Buffer, voucherClient._Fileextension); } busyIndicator.IsBusy = false; }
public CwSendEmailToApprover(VouchersClient document) { this.DataContext = this; InitializeComponent(); this.Title = Uniconta.ClientTools.Localization.lookup("ResendToApprover"); approverDic = new Dictionary <string, string>(); if (document._Approver1 != null) { approverDic.Add(document._Approver1, string.Format("{0} ({1})", document._Approver1, document.Approver1Name)); } if (document._Approver2 != null && document.Approver2 != document.Approver1) { approverDic.Add(document._Approver2, string.Format("{0} ({1})", document._Approver2, document.Approver2Name)); } cmbEmployee.ItemsSource = approverDic; cmbEmployee.SelectedIndex = 0; this.Loaded += CwSendEmailToApprover_Loaded; }
private void InitPage(string _envelopeAction) { MainControl = dgVoucherFolderGrid; envelopeAction = _envelopeAction; action = _envelopeAction; ribbonControl = localMenu; dgVouchersGrid.api = dgVoucherFolderGrid.api = api; dgVoucherFolderGrid.Readonly = false; localMenu.OnItemClicked += LocalMenu_OnItemClicked; if (LoadedRow == null) { voucherClient = new VouchersClient(); } else { voucherClient = LoadedRow as VouchersClient; } SetRibbon(envelopeAction); }
private void InitMaster(UnicontaBaseEntity corasauMaster, bool setFocus) { if (corasauMaster == null) { return; } int RowId = VoucherCache.GetDocumentRowId(corasauMaster); if (RowId == 0) { NoVoucherLoadMessage(); return; } if (this.voucherClient != null && this.voucherClient.RowId == RowId) { return; // we have found the same as shown. Lets not redraw it. } voucherClient = VoucherCache.GetGlobalVoucherCache(corasauMaster.CompanyId, RowId); _LoadInitMaster(corasauMaster, voucherClient, RowId, setFocus); }
async void MoveToVoucherAtIndex(int index, bool setFocus = false) { if (index < 0 || envelopes == null || index > envelopes.Length - 1) { return; } btnPrev.IsEnabled = btnNext.IsEnabled = true; if (selectedIndex == 0) { btnPrev.IsEnabled = false; } if (selectedIndex == envelopes.Length - 1) { btnNext.IsEnabled = false; } this.documentViewer.Children.Clear(); currentBlk.Text = NumberConvert.ToString(index + 1); try { VouchersClient vClient = envelopes[selectedIndex]; if (vClient._Data != null) { VoucherCache.SetGlobalVoucherCache(vClient); } else { await UtilDisplay.GetData(vClient, api); } this.documentViewer.Children.Add(UtilDisplay.LoadControl(vClient, false, setFocus)); } catch (Exception ex) { brdMetaInfo.Visibility = System.Windows.Visibility.Visible; this.documentViewer.Children.Add((UtilDisplay.LoadDefaultControl(string.Format("{0}. \n{1} : {2}", Uniconta.ClientTools.Localization.lookup("InvalidDocSave"), Uniconta.ClientTools.Localization.lookup("ViewerFailed"), ex.Message)))); } SetMetaInfo(voucherClient); }
private void btnAttach_Click(object sender, RoutedEventArgs e) { CWAttachVouchers attachVouchersDialog = new CWAttachVouchers(api); attachVouchersDialog.Closing += async delegate { if (attachVouchersDialog.DialogResult == true) { if (attachVouchersDialog.Voucher != null) { voucherClient = attachVouchersDialog.Voucher; if (voucherClient._Data == null) { await UtilDisplay.GetData(voucherClient, api); } this.txtAttachedFile.Text = voucherClient.Text; this.txtAttachedFile.TextWrapping = TextWrapping.Wrap; } } }; attachVouchersDialog.Show(); }