Exemple #1
0
        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);
        }
Exemple #2
0
        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();
        }