Beispiel #1
0
            /// <summary>
            ///     Writes a row in the spreadsheet for each order found in the search
            /// </summary>
            /// <param name="o">OrderSnapshop - a truncated version of the order record used to write the row.</param>
            /// <param name="rowIndex">The position of the row in the spreadsheet</param>
            /// <returns>An integer value indicating the next row index</returns>
            protected override int WriteOrderRow(OrderSnapshot o, int rowIndex)
            {
                var order = _hccApp.OrderServices.Orders.FindForCurrentStore(o.bvin);

                _writer.WriteRow("A", rowIndex, new List <string>
                {
                    o.bvin,
                    o.OrderNumber,
                    o.AffiliateID.ToString(),

                    // billing contact & address
                    o.BillingAddress.FirstName,
                    o.BillingAddress.LastName,
                    o.BillingAddress.Phone,
                    o.BillingAddress.Line1,
                    o.BillingAddress.Line2,
                    o.BillingAddress.City,
                    o.BillingAddress.RegionDisplayName,
                    o.BillingAddress.PostalCode,
                    o.BillingAddress.CountryDisplayName,

                    // shipping contact & address
                    o.ShippingAddress.FirstName,
                    o.ShippingAddress.LastName,
                    o.ShippingAddress.Phone,
                    o.ShippingAddress.Line1,
                    o.ShippingAddress.Line2,
                    o.ShippingAddress.City,
                    o.ShippingAddress.RegionDisplayName,
                    o.ShippingAddress.PostalCode,
                    o.ShippingAddress.CountryDisplayName,

                    // shipping columns
                    o.ShippingMethodDisplayName,
                    o.ShippingProviderServiceCode,
                    LocalizationUtils.GetOrderShippingStatus(o.ShippingStatus),
                    GetCurrency(o.TotalShippingDiscounts),
                    DiscountDetail.ListToXml(order.ShippingDiscountDetails),
                    GetCurrency(o.TotalShippingBeforeDiscounts),
                    GetCurrency(order.TotalShippingAfterDiscounts),
                    //end shipping columns

                    o.Instructions,
                    GetCurrency(o.TotalOrderDiscounts),
                    DiscountDetail.ListToXml(order.OrderDiscountDetails),
                    GetCurrency(o.TotalHandling),
                    GetCurrency(o.TotalOrderBeforeDiscounts),
                    GetCurrency(o.ItemsTax),
                    GetCurrency(o.ShippingTax),
                    GetCurrency(o.TotalTax),
                    GetCurrency(o.TotalGrand),
                    o.TimeOfOrderUtc.ToString(),
                    o.UserEmail,
                    o.UserID,
                    o.StatusName
                }, _rowStyle);

                return(base.WriteOrderRow(o, rowIndex));
            }
        protected virtual List <OrderSnapshot> ListPocoSnapshot(IQueryable <hcc_Order> items)
        {
            var result = new List <OrderSnapshot>();

            var extendedItems = items.Select(i => new { item = i, isRecurring = i.hcc_LineItem.Any(l => l.IsRecurring) });

            foreach (var extendedItem in extendedItems)
            {
                var item = extendedItem.item;
                var temp = new OrderSnapshot();

                temp.AffiliateID = item.AffiliateId;
                temp.BillingAddress.FromXmlString(item.BillingAddress);
                temp.bvin             = DataTypeHelper.GuidToBvin(item.bvin);
                temp.CustomProperties = CustomPropertyCollection.FromXml(item.CustomProperties);
                temp.FraudScore       = item.FraudScore;
                temp.TotalGrand       = item.GrandTotal;
                temp.TotalHandling    = item.HandlingTotal;
                temp.Id                     = item.Id;
                temp.Instructions           = item.Instructions;
                temp.IsPlaced               = item.IsPlaced == 1;
                temp.LastUpdatedUtc         = item.LastUpdated;
                temp.TotalOrderDiscounts    = item.OrderDiscounts;
                temp.OrderNumber            = item.OrderNumber;
                temp.PaymentStatus          = (OrderPaymentStatus)item.PaymentStatus;
                temp.TotalShippingDiscounts = item.ShippingDiscounts;
                temp.ShippingAddress.FromXmlString(item.ShippingAddress);
                temp.ShippingMethodDisplayName   = item.ShippingMethodDisplayName;
                temp.ShippingMethodId            = item.ShippingMethodId;
                temp.ShippingProviderId          = item.ShippingProviderId;
                temp.ShippingProviderServiceCode = item.ShippingProviderServiceCode;
                temp.ShippingStatus = (OrderShippingStatus)item.ShippingStatus;
                temp.TotalShippingBeforeDiscounts = item.ShippingTotal;
                temp.StatusCode = item.StatusCode;
                temp.StatusName = item.StatusName;
                temp.StoreId    = item.StoreId;
                temp.TotalOrderBeforeDiscounts = item.SubTotal;
                temp.TotalOrderAfterDiscounts  = item.GrandTotal - item.ShippingTotal - item.TaxTotal;
                temp.TotalTax          = item.TaxTotal;
                temp.ItemsTax          = item.ItemsTax;
                temp.ShippingTax       = item.ShippingTax;
                temp.ThirdPartyOrderId = item.ThirdPartyOrderId;
                temp.TimeOfOrderUtc    = item.TimeOfOrder;
                temp.UserEmail         = item.UserEmail;
                temp.UserID            = item.UserId;
                temp.UsedCulture       = item.UsedCulture;
                temp.IsRecurring       = extendedItem.isRecurring;

                result.Add(temp);
            }

            return(result);
        }
Beispiel #3
0
        private void ProcessSingleOrder(OrderSnapshot orderSnapshot)
        {
            var order        = _hccApp.OrderServices.Orders.FindForCurrentStore(orderSnapshot.bvin);
            var transactions = _hccApp.OrderServices.Transactions.FindAllTransactionsForOrder(orderSnapshot.bvin);

            foreach (var transaction in transactions)
            {
                var action = transaction.Action;
                if (ActionTypeUtils.BalanceChangingActions.Contains(action) &&
                    !ActionTypeUtils.IsGiftCardTransaction(action) &&
                    !ActionTypeUtils.IsRewardPointTransaction(action))
                {
                    ProcessSingleTransaction(order, transaction);
                }
            }
        }
Beispiel #4
0
        public string FindHighlightForOrder(OrderSnapshot order)
        {
            if (order == null || string.IsNullOrWhiteSpace(order.ShippingMethodId))
            {
                return(null);
            }
            var method = ShippingMethods.Find(order.ShippingMethodId.Trim());

            if (method == null)
            {
                return(null);
            }

            var highlight = method.Settings.GetSettingOrEmpty("highlight");

            return(highlight);
        }
Beispiel #5
0
            protected override int WriteOrderRow(OrderSnapshot o, int rowIndex)
            {
                var items = _hccApp.OrderServices.Orders.FindLineItemsForOrders(new List <OrderSnapshot> {
                    o
                });

                foreach (var item in items)
                {
                    _writer.WriteRow("A", rowIndex, new List <string>
                    {
                        o.bvin,
                        o.OrderNumber,
                        item.ProductId,
                        item.ProductName,
                        item.ProductSku,
                        item.ProductShortDescription,
                        GetYesNo(item.IsNonShipping),
                        GetTaxScheduleName(item.TaxSchedule),
                        GettAddress(item.ShipFromAddress),
                        item.ShipFromMode.ToString(),
                        GetYesNo(item.ShipSeparately),
                        GetCurrency(item.ExtraShipCharge),
                        GetYesNo(item.IsUserSuppliedPrice),
                        GetDiscountDetails(item.DiscountDetails),
                        GetCurrency(item.BasePricePerItem),
                        GetCurrency(item.AdjustedPricePerItem),
                        GetCurrency(item.ShippingPortion),
                        GetCurrency(item.TaxPortion),
                        item.Quantity.ToString(),
                        GetCurrency(item.LineTotal),
                        GetYesNo(item.IsGiftCard),
                        GetYesNo(item.IsRecurring),
                        GetRecurringInterval(item),
                        GetRecurringIntervalType(item)
                    });

                    AddLineOptions(rowIndex, item);
                    rowIndex++;
                    _lastRowIndex = rowIndex;
                }

                return(rowIndex);
            }
Beispiel #6
0
 protected virtual int WriteOrderRow(OrderSnapshot p, int rowIndex)
 {
     return(++rowIndex);
 }
Beispiel #7
0
 public string FindHightlightColorForOrder(OrderSnapshot o)
 {
     return(FindHighlightForOrder(o));
 }