Пример #1
0
        public string FindHightlightColorForOrder(OrderSnapshot o)
        {
            string result = "";

            if (o == null)
            {
                return(result);
            }
            if (o.ShippingMethodId.Trim().Length < 1)
            {
                return(result);
            }
            var m = ShippingMethods.Find(o.ShippingMethodId.Trim());

            if (m == null)
            {
                return(result);
            }
            string highlight = m.Settings.GetSettingOrEmpty("highlight");

            if (highlight.Trim().Length > 0)
            {
                return(highlight);
            }
            return(result);
        }
Пример #2
0
        protected virtual List <OrderSnapshot> ListPocoSnapshot(IQueryable <Data.EF.bvc_Order> items)
        {
            List <OrderSnapshot> result = new List <OrderSnapshot>();

            if (items != null)
            {
                foreach (Data.EF.bvc_Order item in items)
                {
                    OrderSnapshot temp = new OrderSnapshot();
                    temp.AffiliateID = item.AffiliateId;
                    temp.BillingAddress.FromXmlString(item.BillingAddress);
                    temp.bvin             = 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.TotalTax          = item.TaxTotal;
                    temp.TotalTax2         = item.TaxTotal2;
                    temp.ThirdPartyOrderId = item.ThirdPartyOrderId;
                    temp.TimeOfOrderUtc    = item.TimeOfOrder;
                    temp.UserEmail         = item.UserEmail;
                    temp.UserID            = item.UserId;
                    result.Add(temp);
                }
            }

            return(result);
        }
Пример #3
0
        void FillList()
        {

            try
            {

                TotalSub = 0;
                TotalShip = 0;
                TotalHandling = 0;
                TotalTax = 0;
                TotalGrand = 0;
                TotalCount = 0;
                TotalDiscounts = 0;
                TotalShipDiscounts = 0;

                OrderSearchCriteria c = new OrderSearchCriteria();

                // Get Local Times
                TimeZoneInfo timezone = MTApp.CurrentStore.Settings.TimeZone;
                DateTime zonedStart = this.DateRangeField.StartDateForZone(timezone);
                DateTime zonedEnd = this.DateRangeField.EndDateForZone(timezone);

                // Convert to UTC
                DateTime utcStart = TimeZoneInfo.ConvertTimeToUtc(zonedStart, timezone);
                DateTime utcEnd = TimeZoneInfo.ConvertTimeToUtc(zonedEnd, timezone);
                
                c.StartDateUtc = utcStart;
                c.EndDateUtc = utcEnd;

                List<OrderSnapshot> found = new List<OrderSnapshot>();
                found = MTApp.OrderServices.Orders.FindByCriteria(c);

                TotalCount = found.Count;

                foreach (OrderSnapshot o in found)
                {
                    TotalSub += o.TotalOrderBeforeDiscounts;
                    TotalDiscounts += o.TotalOrderDiscounts;
                    TotalShip += o.TotalShippingBeforeDiscounts;
                    TotalShipDiscounts += o.TotalShippingDiscounts;
                    TotalHandling += o.TotalHandling;
                    TotalTax += o.TotalTax + o.TotalTax2;
                    TotalGrand += o.TotalGrand;
                }

                int i = 0;
                string month = string.Empty;
                decimal monthTotal = 0m;
                decimal dayTotal = 0m;
                string day = string.Empty;
                if (found.Count > 0)
                {
                    DateTime zonedTimeOfOrder = TimeZoneInfo.ConvertTimeFromUtc(found[0].TimeOfOrderUtc, timezone);
                    month = zonedTimeOfOrder.Month.ToString() + ":" + zonedTimeOfOrder.Year.ToString();
                    day = zonedTimeOfOrder.DayOfYear.ToString() + ":" + zonedTimeOfOrder.Year.ToString();
                    while (i <= found.Count - 1)
                    {
                        DateTime zonedTime = TimeZoneInfo.ConvertTimeFromUtc(found[i].TimeOfOrderUtc, timezone);
                        monthTotal = monthTotal + found[i].TotalGrand;
                        dayTotal = dayTotal + found[i].TotalGrand;
                        if (zonedTime.DayOfYear.ToString() + ":" + zonedTime.Year.ToString() != day)
                        {
                            day = zonedTime.DayOfYear.ToString() + ":" + zonedTime.Year.ToString();
                            // we need to insert a day total
                            OrderSnapshot order = new OrderSnapshot();
                            order.OrderNumber = "DayTotal";
                            order.TotalGrand = (dayTotal - found[i].TotalGrand);
                            dayTotal = found[i].TotalGrand;
                            found.Insert(i, order);
                            i += 1;
                        }

                        if (zonedTime.Month.ToString() + ":" + zonedTime.Year.ToString() != month)
                        {
                            month = zonedTime.Month.ToString() + ":" + zonedTime.Year.ToString();
                            // we need to insert a month total
                            OrderSnapshot order = new OrderSnapshot();
                            order.OrderNumber = "MonthTotal";
                            order.TotalGrand = (monthTotal - found[i].TotalGrand);
                            monthTotal = found[i].TotalGrand;
                            found.Insert(i, order);
                            i += 1;
                        }
                        i += 1;
                    }
                    if (dayTotal > 0)
                    {
                        // we need to insert a day total
                        OrderSnapshot order = new OrderSnapshot();
                        order.OrderNumber = "DayTotal";
                        order.TotalGrand = dayTotal;
                        found.Add(order);
                    }
                    if (monthTotal > 0)
                    {
                        OrderSnapshot order = new OrderSnapshot();
                        order.OrderNumber = "MonthTotal";
                        order.TotalGrand = monthTotal;
                        found.Add(order);
                    }
                }
                lblResponse.Text = "<b>" + TotalCount + "</b>";
                lblResponse.Text += " Orders Totaling <b>";
                lblResponse.Text += string.Format("{0:c}", TotalGrand);
                lblResponse.Text += "</b>";

                dgList.DataSource = found;
                dgList.DataBind();
            }

            catch (Exception Ex)
            {
                msg.ShowException(Ex);
                EventLog.LogEvent(Ex);
            }

        }
Пример #4
0
 public string FindHightlightColorForOrder(OrderSnapshot o)
 {
     string result = "";
     if (o == null) return result;
     if (o.ShippingMethodId.Trim().Length < 1) return result;
     var m = ShippingMethods.Find(o.ShippingMethodId.Trim());
     if (m == null) return result;
     string highlight = m.Settings.GetSettingOrEmpty("highlight");
     if (highlight.Trim().Length > 0) return highlight;
     return result;
 }
Пример #5
0
        public void RenderSingleOrder(OrderSnapshot o, StringBuilder sb, bool altRow, TimeZoneInfo timezone)
        {
            string url = ResolveUrl("~/bvadmin/orders/ViewOrder.aspx?id=" + o.bvin);
                        
            if (altRow)
            {
                sb.Append("<tr class=\"alternaterow\" ");
            }
            else
            {
                sb.Append("<tr class=\"row\" ");
            }
            string highlight = this.MTApp.OrderServices.FindHightlightColorForOrder(o);
            if (highlight.Length > 0)
            {
                sb.Append(" style=\"background:url('../images/highlights/" + highlight + ".png')\"");
            }
            sb.Append(">");

            sb.Append("<td><input class=\"pickercheck\" type=\"checkbox\" id=\"check" + o.bvin + "\" /></td>");

            sb.Append("<td><a href=\"" + url + "\">" + o.OrderNumber + "</a></td>");

            DateTime timeOfOrder = TimeZoneInfo.ConvertTimeFromUtc(o.TimeOfOrderUtc, timezone);
            DateTime currentTime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, timezone);
            sb.Append("<td><a href=\"" + url + "\">" + MerchantTribe.Web.Dates.FriendlyShortDate(timeOfOrder, currentTime.Year) + "</a></td>");
            sb.Append("<td><a href=\"" + url + "\">" + string.Format("{0:c}", o.TotalGrand) + "</a></td>");

            sb.Append("<td>");
            sb.Append(MerchantTribe.Commerce.Utilities.MailServices.MailToLink(o.UserEmail, "Order "
                                                                  + o.OrderNumber,
                                                                  o.BillingAddress.FirstName + ",",
                                                                  o.BillingAddress.FirstName + " " + o.BillingAddress.LastName));
            sb.Append("</td>");



            string payText = MerchantTribe.Commerce.Utilities.EnumToString.OrderPaymentStatus(o.PaymentStatus);
            string payImage = "";
            string payLink = ResolveUrl("~/bvadmin/orders/ReceivePayments.aspx?id=" + o.bvin);
            switch (o.PaymentStatus)
            {
                case OrderPaymentStatus.Overpaid:
                    payImage = ResolveUrl("~/BVAdmin/Images/Lights/PaymentError.gif");
                    break;
                case OrderPaymentStatus.PartiallyPaid:
                    payImage = ResolveUrl("~/BVAdmin/Images/Lights/PaymentAuthorized.gif");
                    break;
                case OrderPaymentStatus.Paid:
                    payImage = ResolveUrl("~/BVAdmin/Images/Lights/PaymentComplete.gif");
                    break;
                case OrderPaymentStatus.Unknown:
                    payImage = ResolveUrl("~/BVAdmin/Images/Lights/PaymentNone.gif");
                    break;
                case OrderPaymentStatus.Unpaid:
                    payImage = ResolveUrl("~/BVAdmin/Images/Lights/PaymentNone.gif");
                    break;
            }
            sb.Append("<td><a href=\"" + payLink + "\" title=\"" + payText + "\"><img src=\"" + payImage + "\" alt=\"" + payText + "\" /></a></td>");


            string shipText = MerchantTribe.Commerce.Utilities.EnumToString.OrderShippingStatus(o.ShippingStatus);
            string shipImage = "";
            string shipLink = ResolveUrl("~/bvadmin/orders/ShipOrder.aspx?id=" + o.bvin);
            switch (o.ShippingStatus)
            {
                case OrderShippingStatus.FullyShipped:
                    shipImage = ResolveUrl("~/BVAdmin/Images/Lights/ShippingShipped.gif");
                    break;
                case OrderShippingStatus.NonShipping:
                    shipImage = ResolveUrl("~/BVAdmin/Images/Lights/ShippingNone.gif");
                    break;
                case OrderShippingStatus.PartiallyShipped:
                    shipImage = ResolveUrl("~/BVAdmin/Images/Lights/ShippingPartially.gif");
                    break;
                case OrderShippingStatus.Unknown:
                    shipImage = ResolveUrl("~/BVAdmin/Images/Lights/ShippingNone.gif");
                    break;
                case OrderShippingStatus.Unshipped:
                    shipImage = ResolveUrl("~/BVAdmin/Images/Lights/ShippingNone.gif");
                    break;
            }
            sb.Append("<td><a href=\"" + shipLink + "\" title=\"" + shipText + "\"><img src=\"" + shipImage + "\" alt=\"" + shipText + "\" /></a></td>");

            ManagerPage pageType = ManagerPage.Any;
            string statImage = "";
            switch (o.StatusCode)
            {
                case OrderStatusCode.Completed:
                    statImage = ResolveUrl("~/bvadmin/images/lights/OrderComplete.gif");
                    break;
                case OrderStatusCode.Received:
                    statImage = ResolveUrl("~/bvadmin/images/lights/OrderInProcess.gif");
                    break;
                case OrderStatusCode.OnHold:
                    statImage = ResolveUrl("~/bvadmin/images/lights/OrderOnHold.gif");
                    break;
                case OrderStatusCode.ReadyForPayment:
                    pageType = ManagerPage.Payment;
                    statImage = ResolveUrl("~/bvadmin/images/lights/OrderInProcess.gif");
                    break;
                case OrderStatusCode.ReadyForShipping:
                    pageType = ManagerPage.Shipping;
                    statImage = ResolveUrl("~/bvadmin/images/lights/OrderInProcess.gif");
                    break;
                default:
                    statImage = ResolveUrl("~/bvadmin/images/lights/OrderInProcess.gif");
                    break;
            }
            sb.Append("<td><a href=\"" + url + "\"><img src=\"" + statImage + "\" alt=\"" + o.StatusName + "\" /> " + o.StatusName + "</a></td>");

            switch (pageType)
            {
                case ManagerPage.Payment:
                    sb.Append("<td><a href=\"" + payLink + "\"><img src=\"" + ResolveUrl("~/BVAdmin/Images/Buttons/Payment.png") + "\"/></a></td>");
                    break;
                case ManagerPage.Shipping:
                    sb.Append("<td><a href=\"" + shipLink + "\"><img src=\"" + ResolveUrl("~/BVAdmin/Images/Buttons/Shipping.png") + "\"/></a></td>");
                    break;
                default:
                    sb.Append("<td><a href=\"" + url + "\"><img src=\"" + ResolveUrl("~/BVAdmin/Images/Buttons/Details.png") + "\"/></a></td>");
                    break;
            }

            sb.Append("</tr>");
        }