/// <summary>
        /// Creates a new order
        /// </summary>
        public void CheckoutOrder()
        {
            if (this.State == null)
            {
                throw new ApplicationException(ResourceManager.GetString("RES_ExceptionStateRequired"));
            }

            try
            {
                CartTaskBusinessObject cartBO = new CartTaskBusinessObject();
                int customerId = cartBO.GetCustomerFromTask(State.TaskId);

                OrderBusinessObject orderBO = new OrderBusinessObject();
                orderBO.CreateOrderFromCart(customerId, Cart.CartItems);

                State.NavigateValue = "checkout";
            }
            catch (Exception e)
            {
                State[STATE_EXCEPTION] = e;
                State.NavigateValue    = "error";
            }

            Navigate();
        }
Exemple #2
0
        /// <summary>
        /// Creates a new order
        /// </summary>
        public void CheckoutOrder()
        {
            if (this.State == null)
            {
                throw new ApplicationException(ResourceManager.GetString("RES_ExceptionStateRequired"));
            }

            try
            {
                CartTaskBusinessObject cartBO = new CartTaskBusinessObject();
                // retrieve the customerID for the customer that is performing the current task
                int customerId = cartBO.GetCustomerFromTask(State.TaskId);

                // create a new order object and fill it with orderdetail items
                OrderBusinessObject orderBO = new OrderBusinessObject();
                orderBO.CreateOrderFromCart(customerId, Cart.CartItems);

                State.NavigateValue = "checkout";
            }
            catch (Exception e)
            {
                State[STATE_EXCEPTION] = e;
                State.NavigateValue    = "fail";
            }

            Navigate();
        }
Exemple #3
0
        /// <summary>
        /// Gets the task related to the specified user
        /// </summary>
        /// <param name="userName"></param>
        /// <returns></returns>
        public static Guid GetUserTaskId(string userName)
        {
            //  Look up TaskID in APPLICATION DATABASE;
            //  Remember, correlating logon or other information with UIP's TaskID is
            //  the responsibility of the consuming application
            Guid taskId = Guid.Empty;

            //Gets user task
            CartTaskBusinessObject cartBO = new CartTaskBusinessObject();

            taskId = cartBO.GetTask(userName);

            return(taskId);
        }
Exemple #4
0
        /// <summary>
        /// Creates a new task for the specific logon
        /// </summary>
        /// <param name="taskId"></param>
        public void Create(Guid taskId)
        {
            //  this is app-specific.
            //  in the case of this shopping cart application, we want to
            //  correlate logons with tasks.  We use a lookup table to do so.
            //  so here, we are given a TaskId...and we must correlate it with our Logon

            //  create the business object to be used
            CartTaskBusinessObject bo = new CartTaskBusinessObject();

            //  cache task id given to us by UIPManager (or whatever entity)
            _taskId = taskId;

            //  tell business object to create CartTask entry
            bo.CreateTask(_taskId, _userLogon);
        }