Exemple #1
0
        /// <summary>
        /// Create pick list for the given order
        /// </summary>
        /// <param name="transaction"></param>
        internal static void TryCreatePickListForOrder(SalesStatus status, string orderId)
        {
            try
            {
                switch (status)
                {
                case SalesStatus.Created:
                case SalesStatus.Processing:
                case SalesStatus.Delivered:
                    // These statuses are allowed for Packslip creation
                    break;

                case SalesStatus.Canceled:
                case SalesStatus.Confirmed:
                case SalesStatus.Invoiced:
                case SalesStatus.Lost:
                case SalesStatus.Sent:
                case SalesStatus.Unknown:
                default:
                    // Please select an open order
                    SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56132, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                // Prevent Picking list creation if cashier doesn't have view/edit access
                if (SalesOrder.InternalApplication.Services.LogOn.VerifyOperationAccess(
                        SalesOrder.InternalApplication.Shift.StaffId,
                        PosisOperations.CustomerOrderDetails))
                {
                    bool   retValue;
                    string comment;
                    SalesOrder.CreatePickingList(orderId, out retValue, out comment);

                    if (retValue)
                    {
                        // "The pick list was created"
                        SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56233);
                    }
                    else
                    {
                        // "Pick list could not be created as this time."
                        ApplicationLog.Log(SalesOrderActions.LogSource, comment, LogTraceLevel.Error);
                        SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56230, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
            catch (Exception ex)
            {
                ApplicationExceptionHandler.HandleException(SalesOrderActions.LogSource, ex);
                throw;
            }
        }