Beispiel #1
0
        async void SendMail(SubscriptionInvoice Invoice, DateTime selectedDate, bool SendALL = false)
        {
            var subscriptionMsg = SendALL ? Uniconta.ClientTools.Localization.lookup("SendAllInvoiceMsg") : string.Format(Uniconta.ClientTools.Localization.lookup("SendInvoiceSubscriptionMsg"), Invoice._Sid);

            if (UnicontaMessageBox.Show(subscriptionMsg, Uniconta.ClientTools.Localization.lookup("Message"), MessageBoxButton.OKCancel
#if !SILVERLIGHT
                                        , MessageBoxImage.Question
#endif
                                        ) == MessageBoxResult.OK)
            {
                Task <ErrorCodes> task;
                var subsApi = new SubscriptionAPI(api);
                if (invoicePartner != null && SendALL && api.session.User._Role >= (byte)Uniconta.Common.User.UserRoles.Reseller)
                {
                    task = subsApi.EmailSubscriptionInvoice(invoicePartner, masterSub as Subscription, selectedDate);
                }
                else
                {
                    task = subsApi.EmailSubscriptionInvoice(Invoice, SendALL && api.session.User._Role >= (byte)Uniconta.Common.User.UserRoles.Reseller);
                }

                busyIndicator.BusyContent = Uniconta.ClientTools.Localization.lookup("SendingWait");
                busyIndicator.IsBusy      = true;
                var result = await task;
                busyIndicator.IsBusy = false;
                UtilDisplay.ShowErrorCode(result);
            }
        }
Beispiel #2
0
        async private void ShowInvoice(SubscriptionInvoiceClient selectedItem)
        {
            var subsApi    = new SubscriptionAPI(api);
            var invoicePdf = await subsApi.SubscriptionInvoicePDF(selectedItem);

            if (invoicePdf != null)
            {
                var viewer = new CWDocumentViewer(invoicePdf, FileextensionsTypes.PDF);
                viewer.Show();
            }
        }
Beispiel #3
0
        async void SendMail(PartnerInvoiceClient partnerInv, bool sendAll)
        {
            var subsApi = new SubscriptionAPI(api);

            busyIndicator.BusyContent = Uniconta.ClientTools.Localization.lookup("SendingWait");
            busyIndicator.IsBusy      = true;
            ErrorCodes result = await subsApi.EmailPartnerInvoice(partnerInv, sendAll);

            busyIndicator.IsBusy = false;

            UtilDisplay.ShowErrorCode(result);
        }
Beispiel #4
0
        async void PostInvoice(PartnerInvoiceClient partnerInv, bool sendAll, string journal)
        {
            var subAPi = new SubscriptionAPI(api);

            busyIndicator.BusyContent = Uniconta.ClientTools.Localization.lookup("BusyMessage");
            busyIndicator.IsBusy      = true;
            ErrorCodes result = await subAPi.PostPartnerInvoice(partnerInv, sendAll, journal);

            busyIndicator.IsBusy = false;

            UtilDisplay.ShowErrorCode(result);
        }
Beispiel #5
0
        private void localMenu_OnItemClicked(string ActionType)
        {
            var selectedItem = dgSubInvoicesGrid.SelectedItem as SubscriptionInvoiceClient;

            switch (ActionType)
            {
            case "InvoiceLine":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.SubscriptionInvoiceLinePage, dgSubInvoicesGrid.syncEntity, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("InvoiceNumber"), selectedItem._Invoice));
                }
                break;

#if !SILVERLIGHT
            case "ShowInvoice":
                if (selectedItem != null)
                {
                    ShowInvoice(selectedItem);
                }
                break;
#endif
            case "SendAsEmail":
                if (selectedItem == null)
                {
                    UnicontaMessageBox.Show(Uniconta.ClientTools.Localization.lookup("zeroRecords"), Uniconta.ClientTools.Localization.lookup("Warning"), MessageBoxButton.OK);
                    return;
                }
                if (invoicePartner != null)
                {
                    CWDateSelector dateSelector = new CWDateSelector(true);
#if !SILVERLIGHT
                    dateSelector.DialogTableId = 2000000021;
#endif
                    dateSelector.Closing += delegate
                    {
                        if (dateSelector.DialogResult == true)
                        {
                            SendMail(selectedItem, dateSelector.SelectedDate, dateSelector.SendAll);
                        }
                    };
                    dateSelector.Show();
                }
                else
                {
                    SendMail(selectedItem, selectedItem._Date);
                }
                break;

            case "SendAsEmailOnDate":
                if (selectedItem == null)
                {
                    UnicontaMessageBox.Show(Uniconta.ClientTools.Localization.lookup("zeroRecords"), Uniconta.ClientTools.Localization.lookup("Warning"), MessageBoxButton.OK);
                    return;
                }
                CWDateSelector objdateSelector = new CWDateSelector(true);
#if !SILVERLIGHT
                objdateSelector.DialogTableId = 2000000022;
#endif
                objdateSelector.Closing += delegate
                {
                    if (objdateSelector.DialogResult == true)
                    {
                        SendMail(selectedItem, objdateSelector.SelectedDate, objdateSelector.SendAll);
                    }
                };
                objdateSelector.Show();
                break;

            case "PostInvoice":
                if (selectedItem == null)
                {
                    return;
                }
                CWPostInvoice CWPostInvoiceDailogue = new CWPostInvoice(api);
                CWPostInvoiceDailogue.dpDate.Visibility  = Visibility.Collapsed;
                CWPostInvoiceDailogue.txtDate.Visibility = Visibility.Collapsed;
                CWPostInvoiceDailogue.Closed            += async delegate
                {
                    if (CWPostInvoiceDailogue.DialogResult == true)
                    {
                        var sbsApi = new SubscriptionAPI(api);
                        var result = await sbsApi.PostInternalInvoice(invoicePartner, selectedItem, selectedItem._Date, CWPostInvoiceDailogue.Journal);

                        if (result != ErrorCodes.Succes)
                        {
                            UtilDisplay.ShowErrorCode(result);
                        }
                    }
                };
                CWPostInvoiceDailogue.Show();
                break;

            case "PostInvoiceOnDate":
                if (selectedItem == null)
                {
                    return;
                }
                var objCWPostInvoiceDailogue = new CWPostInvoice(api);
                objCWPostInvoiceDailogue.Closed += async delegate
                {
                    if (objCWPostInvoiceDailogue.DialogResult == true)
                    {
                        var sbsApi = new SubscriptionAPI(api);
                        var result = await sbsApi.PostInternalInvoice(invoicePartner, null, objCWPostInvoiceDailogue.InvoiceDate, objCWPostInvoiceDailogue.Journal);

                        UtilDisplay.ShowErrorCode(result);
                    }
                };
                objCWPostInvoiceDailogue.Show();
                break;

            case "DeleteRow":
            {
                CWConfirmationBox dialog = new CWConfirmationBox(Uniconta.ClientTools.Localization.lookup("AreYouSureToContinue"), Uniconta.ClientTools.Localization.lookup("Confirmation"), false, Uniconta.ClientTools.Localization.lookup("DeleteRow"));
                dialog.Closing += async delegate
                {
                    if (dialog.ConfirmationResult == CWConfirmationBox.ConfirmationResultEnum.Yes)
                    {
                        var res = await api.Delete(selectedItem);

                        if (res != ErrorCodes.Succes)
                        {
                            UtilDisplay.ShowErrorCode(res);
                        }

                        else
                        {
                            await InitQuery();
                        }
                    }
                };
                dialog.Show();
            }
            break;


            default:
                gridRibbon_BaseActions(ActionType);
                break;
            }
        }