/// <summary>
    /// Sets (updates or inserts) specified order.
    /// </summary>
    /// <param name="orderObj">Order to be set</param>  
    protected override void SetOrderInfoInternal(OrderInfo orderObj)
    {
        // Add or update the order
        base.SetOrderInfoInternal(orderObj);

        // Remember whether the order is paid
        bool isPaid = ((orderObj != null) && (orderObj.OrderIsPaid));
      
        if (isPaid)
        {
            // Get all attendees that are connected with the current order
            var ds = CustomEventHelper.GetAttendees(orderObj.OrderID);
            if (!DataHelper.DataSourceIsEmpty(ds))
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    // Update attendee payment status
                    var attendee = new EventAttendeeInfo(dr);
                    attendee.SetValue(CustomEventHelper.COLUMN_ATTENDEE_PAYMENTCOMPLETED, true);
                    attendee.Update();
                }
            }
        }
    }
예제 #2
0
    /// <summary>
    /// Sets (updates or inserts) specified order.
    /// </summary>
    /// <param name="orderObj">Order to be set</param>
    protected override void SetOrderInfoInternal(OrderInfo orderObj)
    {
        // Add or update the order
        base.SetOrderInfoInternal(orderObj);

        // Remember whether the order is paid
        bool isPaid = ((orderObj != null) && (orderObj.OrderIsPaid));

        if (isPaid)
        {
            // Get all attendees that are connected with the current order
            var ds = CustomEventHelper.GetAttendees(orderObj.OrderID);
            if (!DataHelper.DataSourceIsEmpty(ds))
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    // Update attendee payment status
                    var attendee = new EventAttendeeInfo(dr);
                    attendee.SetValue(CustomEventHelper.COLUMN_ATTENDEE_PAYMENTCOMPLETED, true);
                    attendee.Update();
                }
            }
        }
    }
예제 #3
0
        /// <summary>
        /// Create attendees for each product of the specified order.
        /// </summary>
        /// <param name="cart">Shopping cart object with order data.</param>
        public static void SetAttendees(ShoppingCartInfo cart)
        {
            if ((cart != null) && (cart.Customer != null))
            {                
                // Is order payment completed?
                var order = OrderInfoProvider.GetOrderInfo(cart.OrderId);
                var isPaymentCompleted = false;
                if (order != null)
                {
                    isPaymentCompleted = order.OrderIsPaid;
                }

                // Build WHERE condition to get specified tree nodes which represent specified products of the order
                var where = string.Empty;
                foreach (var item in cart.CartItems)
                {
                    where += item.SKUID + ",";                    
                }

                // Trim ending comma from WHERE condition
                if (where != "")
                {
                    where = where.Remove(where.Length - 1);
                    where = "NODESKUID IN (" + where + ")";
                }

                // Remove old attendees
                DeleteAttendees(cart.OrderId);

                // Select events (tree nodes) that represents specified products of the order
                var tree = new TreeProvider();
                DataSet ds = tree.SelectNodes(cart.SiteName, "/%", TreeProvider.ALL_CULTURES, false, "cms.bookingevent", where);

                if (!DataHelper.DataSourceIsEmpty(ds))
                {
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        // Get tree node ID of the event
                        int nodeId = ValidationHelper.GetInteger(dr["NodeID"], 0);

                        // Get product ID
                        int skuId = ValidationHelper.GetInteger(dr["SKUID"], 0);

                        // Get product units
                        int units = GetSKUShoppingCartUnits(cart, skuId);

                        // Create attendees and assign them to the specified event
                        for (int i = 1; i < units + 1; i++)
                        {                            
                            var attendee = new EventAttendeeInfo
                            {
                                AttendeeFirstName = cart.Customer.CustomerFirstName,
                                AttendeeLastName = cart.Customer.CustomerLastName + " (" + i + ")",
                                AttendeeEmail = cart.Customer.CustomerEmail,
                                AttendeeEventNodeID = nodeId
                            };
                            attendee.SetValue(COLUMN_ATTENDEE_ORDERID, cart.OrderId);
                            attendee.SetValue(COLUMN_ATTENDEE_PAYMENTCOMPLETED, isPaymentCompleted);

                            // Set attendee phone from billing address
                            var address = cart.ShoppingCartBillingAddress;
                            if (address != null)
                            {
                                attendee.AttendeePhone = address.AddressPhone;
                            }

                            EventAttendeeInfoProvider.SetEventAttendeeInfo(attendee);
                        }
                    }
                }
            }
        }
예제 #4
0
        /// <summary>
        /// Create attendees for each product of the specified order.
        /// </summary>
        /// <param name="cart">Shopping cart object with order data.</param>
        public static void SetAttendees(ShoppingCartInfo cart)
        {
            if ((cart != null) && (cart.Customer != null))
            {
                // Is order payment completed?
                var order = OrderInfoProvider.GetOrderInfo(cart.OrderId);
                var isPaymentCompleted = false;
                if (order != null)
                {
                    isPaymentCompleted = order.OrderIsPaid;
                }

                // Build WHERE condition to get specified tree nodes which represent specified products of the order
                var where = string.Empty;
                foreach (var item in cart.CartItems)
                {
                    where += item.SKUID + ",";
                }

                // Trim ending comma from WHERE condition
                if (where != "")
                {
                    where = where.Remove(where.Length - 1);
                    where = "NODESKUID IN (" + where + ")";
                }

                // Remove old attendees
                DeleteAttendees(cart.OrderId);

                // Select events (tree nodes) that represents specified products of the order
                var     tree = new TreeProvider();
                DataSet ds   = tree.SelectNodes(cart.SiteName, "/%", TreeProvider.ALL_CULTURES, false, "cms.bookingevent", where);

                if (!DataHelper.DataSourceIsEmpty(ds))
                {
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        // Get tree node ID of the event
                        int nodeId = ValidationHelper.GetInteger(dr["NodeID"], 0);

                        // Get product ID
                        int skuId = ValidationHelper.GetInteger(dr["SKUID"], 0);

                        // Get product units
                        int units = GetSKUShoppingCartUnits(cart, skuId);

                        // Create attendees and assign them to the specified event
                        for (int i = 1; i < units + 1; i++)
                        {
                            var attendee = new EventAttendeeInfo
                            {
                                AttendeeFirstName   = cart.Customer.CustomerFirstName,
                                AttendeeLastName    = cart.Customer.CustomerLastName + " (" + i + ")",
                                AttendeeEmail       = cart.Customer.CustomerEmail,
                                AttendeeEventNodeID = nodeId
                            };
                            attendee.SetValue(COLUMN_ATTENDEE_ORDERID, cart.OrderId);
                            attendee.SetValue(COLUMN_ATTENDEE_PAYMENTCOMPLETED, isPaymentCompleted);

                            // Set attendee phone from billing address
                            var address = cart.ShoppingCartBillingAddress;
                            if (address != null)
                            {
                                attendee.AttendeePhone = address.AddressPhone;
                            }

                            EventAttendeeInfoProvider.SetEventAttendeeInfo(attendee);
                        }
                    }
                }
            }
        }