Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ordID"></param>
        /// <param name="returnToApproval">When false, the order is cancelled completely</param>
        /// <returns></returns>
        public static bool ReleaseReservation(int ordID, bool returnToApproval)
        {
            BLL.Order ord = new BLL.Order();
            ord.LoadByPrimaryKey(ordID);
            MyGeneration.dOOdads.TransactionMgr transaction = MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr();
            try
            {
                transaction.BeginTransaction();
                if (ord.RowCount > 0 && (ord.OrderStatusID == OrderStatus.Constant.PICK_LIST_GENERATED || ord.OrderStatusID == OrderStatus.Constant.PICK_LIST_CONFIRMED))
                {
                    ord.ReleaseReservation();
                    if (returnToApproval)
                    {
                        ord.ChangeStatus(OrderStatus.Constant.ORDER_FILLED, CurrentContext.UserId);
                    }
                    else
                    {
                        ord.ChangeStatus(OrderStatus.Constant.CANCELED, CurrentContext.UserId);
                    }
                    ord.Save();
                }

                transaction.CommitTransaction();
                return(true);
            }
            catch (Exception exp)
            {
                transaction.RollbackTransaction();
                throw (exp);
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="ordID"></param>
        /// <param name="returnToApproval">When false, the order is cancelled completely</param>
        /// <returns></returns>
        public static bool ReleaseReservation(int ordID, bool returnToApproval)
        {
            BLL.Order ord = new BLL.Order();
            ord.LoadByPrimaryKey(ordID);
            MyGeneration.dOOdads.TransactionMgr transaction = MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr();
            try
            {
                transaction.BeginTransaction();
                if (ord.RowCount > 0 && (ord.OrderStatusID == OrderStatus.Constant.PICK_LIST_GENERATED || ord.OrderStatusID == OrderStatus.Constant.PICK_LIST_CONFIRMED))
                {
                    ord.ReleaseReservation();
                    if (returnToApproval)
                    {
                        ord.ChangeStatus(OrderStatus.Constant.ORDER_FILLED,CurrentContext.UserId);
                    }
                    else
                    {
                        ord.ChangeStatus(OrderStatus.Constant.CANCELED,CurrentContext.UserId);
                    }
                    ord.Save();
                }

                transaction.CommitTransaction();
                return true;
            }
            catch (Exception exp)
            {
                transaction.RollbackTransaction();
                throw (exp);
            }
        }