コード例 #1
0
        public async void EmailInvoiceFunction(object sender, EventArgs e)
        {
            await((HomeLayout)App.Current.MainPage).SetLoading(true, "Sending email...");
            string cardType = await App.serverData.GetTransactionInformation(transaction.transactionID, "trans_cardType");

            string card4 = await App.serverData.GetTransactionInformation(transaction.transactionID, "trans_last4");

            if (transaction.transactionType == "Sale")
            {
                bool sent = await BaseFunctions.EmailSaleInvoice(transaction, cardType + " ending with " + card4);

                await((HomeLayout)App.Current.MainPage).SetLoading(false, "Sending email...");
                if (sent)
                {
                    await App.Current.MainPage.DisplayAlert("Success", "Invoice has been sent to your email", "Ok");
                }
                else
                {
                    await App.Current.MainPage.DisplayAlert("Failed", "Something went wrong please retry.", "Ok");
                }
            }
            else if (transaction.transactionType == "Donation")
            {
                bool sent = await BaseFunctions.EmailDonationInvoice(transaction, cardType + " ending with " + card4);

                await((HomeLayout)App.Current.MainPage).SetLoading(false, "Sending email...");
                if (sent)
                {
                    await App.Current.MainPage.DisplayAlert("Success", "Invoice has been sent to your email", "Ok");
                }
                else
                {
                    await App.Current.MainPage.DisplayAlert("Failed", "Something went wrong please retry.", "Ok");
                }
            }
        }