Esempio n. 1
0
        public frmReturnTransaction(ReturnTransactionConfirmation returnTransactionConfirmation)
            : this()
        {
            if (returnTransactionConfirmation == null)
            {
                throw new ArgumentNullException("returnTransactionConfirmation");
            }

            this.posTransaction = (RetailTransaction)returnTransactionConfirmation.PosTransaction;
        }
        private void ReturnItemsFromInvoice()
        {
            bool   retValue  = false;
            string comment   = string.Empty;
            string invoiceId = SelectedInvoiceId;
            CustomerOrderTransaction invoiceTransaction;
            DialogResult             results = DialogResult.None;

            try
            {
                // Construct a transaction from the given Invoice
                SalesOrder.GetSalesInvoiceTransaction(ref retValue, ref comment, invoiceId, out invoiceTransaction);

                if (retValue)
                {
                    ReturnTransactionConfirmation returnTransactionConfirmation = new ReturnTransactionConfirmation()
                    {
                        PosTransaction = invoiceTransaction,
                    };

                    InteractionRequestedEventArgs request = new InteractionRequestedEventArgs(returnTransactionConfirmation, () =>
                    {
                        if (returnTransactionConfirmation.Confirmed)
                        {
                            // The user selected to return items...
                            // Transfer the items to the posTranscation for the return
                            // Updates customer and calculates taxes based upon items and customer
                            SalesOrderActions.InsertReturnedItemsIntoTransaction(returnTransactionConfirmation.ReturnedLineNumbers, invoiceTransaction, this.Transaction);

                            // We only support returning a single-invoice at a time, so Close the form after processing the first one.
                            results = System.Windows.Forms.DialogResult.OK;
                            this.Close();
                        }
                    }
                                                                                              );

                    SalesOrder.InternalApplication.Services.Interaction.InteractionRequest(request);
                }
                else
                {
                    //An error occurred in the operation...
                    SalesOrder.InternalApplication.Services.Dialog.ShowMessage(10002, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                ApplicationExceptionHandler.HandleException(this.ToString(), ex);
            }

            this.DialogResult = results;
        }
Esempio n. 3
0
        private void HandleReturnTransactionConfirmationInteraction(InteractionRequestedEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException("InteractionRequestedEventArgs");
            }

            ReturnTransactionConfirmation context = (ReturnTransactionConfirmation)e.Context;
            ReturnTransactionConfirmation results = InvokeInteraction <ReturnTransactionConfirmation, ReturnTransactionConfirmation>("ReturnTransactionForm", context, true);

            if (results != null)
            {
                context.Confirmed           = results.Confirmed;
                context.ReturnedLineNumbers = results.ReturnedLineNumbers;
            }
        }