示例#1
0
        /// <summary>
        /// Search for the customer and add to the retailtransaction
        /// </summary>
        /// <param name="retailTransaction">The retail tranaction</param>
        public void Search(DE.IPosTransaction posTransaction)
        {
            // Show the search dialog
            DE.ICustomer customer = this.Search();

            AddCustomerToTransaction(customer, posTransaction);
        }
示例#2
0
        private static bool CheckCustomer(DE.IPosTransaction posTransaction)
        {
            RetailTransaction retailTransaction = (RetailTransaction)posTransaction;

            if (retailTransaction.Customer.Blocked == DE.BlockedEnum.All)
            {
                //Display a message
                using (LSRetailPosis.POSProcesses.frmMessage dialog = new LSRetailPosis.POSProcesses.frmMessage(51002)) //This customer has been blocked. No sales or transactions are allowed.
                {
                    Customer.InternalApplication.ApplicationFramework.POSShowForm(dialog);
                }

                //Cancel the customer account
                retailTransaction.Customer = GetBlankCustomer();

                return(false);
            }

            if (retailTransaction.Customer.Blocked == DE.BlockedEnum.Invoice)
            {
                //Display message
                using (LSRetailPosis.POSProcesses.frmMessage dialog = new LSRetailPosis.POSProcesses.frmMessage(51003)) //This customer has been blocked. This account can not be charged to.
                {
                    Customer.InternalApplication.ApplicationFramework.POSShowForm(dialog);
                }
            }

            return(true);
        }
示例#3
0
        public void AddShippingAddress(DE.IPosTransaction posTransaction)
        {
            RetailTransaction retailTransaction = (RetailTransaction)posTransaction;

            DE.IAddress address = AddNewShippingAddress(retailTransaction.Customer);
            if (address != null)
            {
                Customer.InternalApplication.BusinessLogic.CustomerSystem.SetShippingAddress(retailTransaction, address);
            }
        }
示例#4
0
        private static bool CheckInvoicedCustomer(DE.IPosTransaction posTransaction)
        {
            RetailTransaction retailTransaction = (RetailTransaction)posTransaction;

            //If the Invoiced customer has All as blocked then the selected customer can not be added to the transaction
            if (retailTransaction.InvoicedCustomer.Blocked == DE.BlockedEnum.All)
            {
                //If Invoiced Customer is blocked then the original customer should be blocked too.
                retailTransaction.Customer.Blocked = DE.BlockedEnum.All;

                //Display the message
                using (LSRetailPosis.POSProcesses.frmMessage dialog = new LSRetailPosis.POSProcesses.frmMessage(51004)) //The invoiced customer has been blocked. Charging to this account will not be allowed.
                {
                    Customer.InternalApplication.ApplicationFramework.POSShowForm(dialog);
                }

                //Cancel all customer accounts
                retailTransaction.Customer         = GetBlankCustomer();
                retailTransaction.InvoicedCustomer = GetBlankCustomer();

                return(false);
            }

            if (retailTransaction.InvoicedCustomer.Blocked == DE.BlockedEnum.Invoice)
            {
                //If a similar message has already been displayed for the original customer then don't display it again.
                if (retailTransaction.Customer.Blocked != DE.BlockedEnum.Invoice)
                {
                    using (LSRetailPosis.POSProcesses.frmMessage dialog = new LSRetailPosis.POSProcesses.frmMessage(51005)) //This customer has been blocked. This account can not be charged to.
                    {
                        Customer.InternalApplication.ApplicationFramework.POSShowForm(dialog);
                    }
                }

                //If Invoiced Customer is blocked then the original customer should be blocked too.
                retailTransaction.Customer.Blocked = DE.BlockedEnum.Invoice;
            }

            return(true);
        }
示例#5
0
        public void SearchShippingAddress(DE.IPosTransaction posTransaction)
        {
            RetailTransaction retailTransaction = (RetailTransaction)posTransaction;

            string shippingname    = string.Empty;
            string shippingaddress = string.Empty;

            DM.CustomerDataManager customerDataManager = new DM.CustomerDataManager(Application.Settings.Database.Connection, Application.Settings.Database.DataAreaID);
            DE.IAddress            address             = null;
            if (customerDataManager.HasAddress(retailTransaction.Customer.PartyId))
            {
                address = SearchShippingAddress(retailTransaction.Customer);
            }
            else
            {
                // Create and add customer in AX
                address = AddNewShippingAddress(retailTransaction.Customer);
            }

            if (address != null)
            {
                Customer.InternalApplication.BusinessLogic.CustomerSystem.SetShippingAddress(retailTransaction, address);
            }
        }
示例#6
0
        /// <summary>
        /// Add customer to transaction
        /// </summary>
        /// <param name="customer">Customer to add</param>
        /// <param name="posTransaction">Transaction</param>
        public void AddCustomerToTransaction(DE.ICustomer customer, DE.IPosTransaction posTransaction)
        {
            // !! Note - this code should follow the same steps to set the customer as PosProcesses\Customer.cs :: Execute()
            //Get information about the selected customer and add it to the transaction
            if (customer != null)
            {
                SalesOrderTransaction soTransaction = posTransaction as SalesOrderTransaction;
                if (soTransaction != null)
                {
                    // Must check for ISalesOrderTransaction before IRetailTransaction because it derives from IRetailTransaction
                    soTransaction.Customer = customer as LSRetailPosis.Transaction.Customer;
                }
                else
                {
                    RetailTransaction asRetailTransaction = posTransaction as RetailTransaction;
                    if (asRetailTransaction != null)
                    {
                        if (!asRetailTransaction.IsCustomerAllowed())
                        {
                            LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSMessageDialog(4544);
                            return;
                        }

                        DE.ICustomer invoicedCustomer = customer;
                        string       invoiceAccount   = customer.InvoiceAccount;

                        //If the customer has another account as invoice account
                        if (!string.IsNullOrWhiteSpace(invoiceAccount))
                        {
                            invoicedCustomer = this.CustomerSystem.GetCustomerInfo(invoiceAccount);
                        }

                        // Trigger: PreCustomerSet trigger for the operation
                        var preTriggerResult = new PreTriggerResult();

                        PosApplication.Instance.Triggers.Invoke <ICustomerTrigger>(t => t.PreCustomerSet(preTriggerResult, posTransaction, customer.CustomerId));

                        if (!TriggerHelpers.ProcessPreTriggerResults(preTriggerResult))
                        {
                            return;
                        }

                        this.CustomerSystem.SetCustomer(asRetailTransaction, customer, invoicedCustomer);

                        //If CheckCustomer returns false then the customer isn't allowed to be added to the transaction. Msg has already been displayed
                        if (!CheckCustomer(posTransaction))
                        {
                            return;
                        }

                        //If CheckInvoicedCustomer removed the customer then it isn't allowed to be added to the transaction. Msg has already been displayed
                        if (!CheckInvoicedCustomer(posTransaction))
                        {
                            return;
                        }

                        if (asRetailTransaction.Customer.UsePurchRequest)
                        {
                            asRetailTransaction.CustomerPurchRequestId = GetPurchRequestId();
                        }
                    }
                    else if (posTransaction is CustomerPaymentTransaction)
                    {
                        // Customer is not allowed to be changed  (or cleared) once a customer account deposit has been made.
                        LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSMessageDialog(3084);
                    }
                }
            }
            else
            {
                NetTracer.Warning("Customer::AddCustomerToTransaction: customer parameter is null");
            }
        }