/// <summary> /// A collection of the tokens and the replaceable content for email templates. /// </summary> /// <param name="context">An instance of the Hotcakes Request context.</param> /// <returns>List of HtmlTemplateTag</returns> public List <HtmlTemplateTag> GetReplaceableTags(HccRequestContext context) { var result = new List <HtmlTemplateTag>(); var culture = context.MainContentCulture; result.Add(new HtmlTemplateTag("[[LineItem.AdjustedPrice]]", AdjustedPricePerItem.ToString("c"))); result.Add(new HtmlTemplateTag("[[LineItem.BasePrice]]", BasePricePerItem.ToString("c"))); result.Add(new HtmlTemplateTag("[[LineItem.LineTotalBeforeVAT]]", (LineTotal - TaxPortion).ToString("c"))); result.Add(new HtmlTemplateTag("[[LineItem.Discounts]]", DiscountDetailsAsHtml())); result.Add(new HtmlTemplateTag("[[LineItem.LineTotal]]", LineTotal.ToString("c"))); result.Add(new HtmlTemplateTag("[[LineItem.ProductId]]", ProductId)); result.Add(new HtmlTemplateTag("[[LineItem.VariantId]]", VariantId)); result.Add(new HtmlTemplateTag("[[LineItem.ProductName]]", ProductName)); result.Add(new HtmlTemplateTag("[[LineItem.ProductSku]]", ProductSku)); result.Add(new HtmlTemplateTag("[[LineItem.Sku]]", "Obsolete. Please use [[LineItem.ProductSku]] instead.", true)); result.Add(new HtmlTemplateTag("[[LineItem.ProductDescription]]", ProductShortDescription)); result.Add(new HtmlTemplateTag("[[LineItem.Quantity]]", Quantity.ToString("#"))); result.Add(new HtmlTemplateTag("[[LineItem.QuantityShipped]]", QuantityShipped.ToString("#"))); result.Add(new HtmlTemplateTag("[[LineItem.QuantityReturned]]", QuantityReturned.ToString("#"))); result.Add(new HtmlTemplateTag("[[LineItem.ShippingStatus]]", LocalizationUtils.GetOrderShippingStatus(ShippingStatus, culture))); result.Add(new HtmlTemplateTag("[[LineItem.TaxRate]]", decimal.Parse(TaxRate.ToString("p3").Replace("%", "")).ToString("G29") + " %")); result.Add(new HtmlTemplateTag("[[LineItem.ShippingPortion]]", ShippingPortion.ToString("c"))); result.Add(new HtmlTemplateTag("[[LineItem.TaxPortion]]", TaxPortion.ToString("c"))); result.Add(new HtmlTemplateTag("[[LineItem.ExtraShipCharge]]", ExtraShipCharge.ToString("c"))); result.Add(new HtmlTemplateTag("[[LineItem.ShipFromAddress]]", ShipFromAddress.ToHtmlString())); result.Add(new HtmlTemplateTag("[[LineItem.ShipSeparately]]", ShipSeparately ? "Yes" : "No")); return(result); }
/// <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 override void OnPreRender(EventArgs e) { base.OnPreRender(e); if (CurrentOrder != null) { litPaymentStatus.Text = LocalizationUtils.GetOrderPaymentStatus(CurrentOrder.PaymentStatus); litShippingStatus.Text = LocalizationUtils.GetOrderShippingStatus(CurrentOrder.ShippingStatus); if (lstStatus.Items.FindByValue(CurrentOrder.StatusCode) != null) { lstStatus.ClearSelection(); lstStatus.Items.FindByValue(CurrentOrder.StatusCode).Selected = true; } } }
protected string RenderStatusHtml(IDataItemContainer cont) { var o = cont.DataItem as OrderSnapshot; var sb = new StringBuilder(); var url = ResolveUrl("~/DesktopModules/Hotcakes/Core/Admin/Orders/ViewOrder.aspx?id=" + o.bvin); var payText = LocalizationUtils.GetOrderPaymentStatus(o.PaymentStatus, HccRequestContext.Current.MainContentCulture); var payImage = ""; var payLink = ResolveUrl("~/DesktopModules/Hotcakes/Core/Admin/Orders/OrderPayments.aspx?id=" + o.bvin); switch (o.PaymentStatus) { case OrderPaymentStatus.Overpaid: payImage = ResolveImgUrl("Lights/PaymentError.gif"); break; case OrderPaymentStatus.PartiallyPaid: payImage = ResolveImgUrl("Lights/PaymentAuthorized.gif"); break; case OrderPaymentStatus.Paid: payImage = ResolveImgUrl("Lights/PaymentComplete.gif"); break; case OrderPaymentStatus.Unknown: payImage = ResolveImgUrl("Lights/PaymentNone.gif"); break; case OrderPaymentStatus.Unpaid: payImage = ResolveImgUrl("Lights/PaymentNone.gif"); break; } sb.Append("<a href=\"" + payLink + "\" title=\"" + payText + "\"><img src=\"" + payImage + "\" alt=\"" + payText + "\" /></a>"); var shipText = LocalizationUtils.GetOrderShippingStatus(o.ShippingStatus, HccRequestContext.Current.MainContentCulture); var shipImage = ""; var shipLink = ResolveUrl("~/DesktopModules/Hotcakes/Core/Admin/Orders/ShipOrder.aspx?id=" + o.bvin); switch (o.ShippingStatus) { case OrderShippingStatus.FullyShipped: shipImage = ResolveImgUrl("Lights/ShippingShipped.gif"); break; case OrderShippingStatus.NonShipping: shipImage = ResolveImgUrl("Lights/ShippingNone.gif"); break; case OrderShippingStatus.PartiallyShipped: shipImage = ResolveImgUrl("Lights/ShippingPartially.gif"); break; case OrderShippingStatus.Unknown: shipImage = ResolveImgUrl("Lights/ShippingNone.gif"); break; case OrderShippingStatus.Unshipped: shipImage = ResolveImgUrl("Lights/ShippingNone.gif"); break; } sb.Append("<a href=\"" + shipLink + "\" title=\"" + shipText + "\"><img src=\"" + shipImage + "\" alt=\"" + shipText + "\" /></a>"); var statusText = LocalizationUtils.GetOrderStatus(o.StatusName, HccRequestContext.Current.MainContentCulture); var statImage = ""; switch (o.StatusCode) { case OrderStatusCode.Completed: statImage = ResolveImgUrl("lights/OrderComplete.gif"); break; case OrderStatusCode.Received: statImage = ResolveImgUrl("lights/OrderInProcess.gif"); break; case OrderStatusCode.OnHold: statImage = ResolveImgUrl("lights/OrderOnHold.gif"); break; case OrderStatusCode.ReadyForPayment: statImage = ResolveImgUrl("lights/OrderInProcess.gif"); break; case OrderStatusCode.ReadyForShipping: statImage = ResolveImgUrl("lights/OrderInProcess.gif"); break; default: statImage = ResolveImgUrl("lights/OrderInProcess.gif"); break; } sb.Append("<a href=\"" + url + "\"><img src=\"" + statImage + "\" alt=\"" + statusText + "\" style='margin-right:4px' /></a>"); sb.Append("<div><a href=\"" + url + "\">" + statusText + "</a></div>"); return(sb.ToString()); }
protected void gvItems_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { var lineItem = e.Row.DataItem as LineItem; if (lineItem == null) { return; } var productLink = GetProductEditLink(lineItem.ProductId, lineItem.ProductSku); var lblSKU = e.Row.FindControl("lblSKU") as Label; var lblDescription = e.Row.FindControl("lblDescription") as Label; var lblShippingStatus = e.Row.FindControl("lblShippingStatus") as Label; var lblAdjustedPrice = e.Row.FindControl("lblAdjustedPrice") as Label; var txtQty = e.Row.FindControl("txtQty") as TextBox; var lblQty = e.Row.FindControl("lblQty") as Label; var lblLineTotal = e.Row.FindControl("lblLineTotal") as Label; var btnDelete = e.Row.FindControl("btnDelete") as LinkButton; var lblLineTotalWithoutDiscounts = e.Row.FindControl("lblLineTotalWithoutDiscounts") as Label; var litDiscounts = (Literal)e.Row.FindControl("litDiscounts"); var divGiftWrap = e.Row.FindControl("divGiftWrap") as HtmlGenericControl; var litGiftCardsNumbers = e.Row.FindControl("litGiftCardsNumbers") as Literal; var lnkGiftCards = e.Row.FindControl("lnkGiftCards") as HyperLink; var rvTxtQty = e.Row.FindControl("rvTxtQty") as RangeValidator; rvTxtQty.ErrorMessage = Localization.GetString("rvTxtQty.ErrorMessage"); var lnkInventory = e.Row.FindControl("btnInventory") as LinkButton; lnkInventory.Visible = false; var product = HccApp.CatalogServices.Products.Find(lineItem.ProductId); if (product != null) { if (product.InventoryMode != ProductInventoryMode.NotSet && EditMode && (CurrentOrder.StatusCode == OrderStatusCode.Cancelled || isPaymentRefunded)) { if (product.InventoryMode != ProductInventoryMode.AlwayInStock && product.InventoryMode != ProductInventoryMode.NotSet) { lnkInventory.Visible = true; } } } var hdfLineItemId = e.Row.FindControl("hdfLineItemId") as HiddenField; hdfLineItemId.Value = lineItem.Id.ToString(); lblSKU.Text = string.IsNullOrEmpty(productLink) ? lineItem.ProductSku : productLink; lblDescription.Text = lineItem.ProductName; lblDescription.Text += "<br />" + lineItem.ProductShortDescription; lblShippingStatus.Text = LocalizationUtils.GetOrderShippingStatus(lineItem.ShippingStatus); lblAdjustedPrice.Text = lineItem.AdjustedPricePerItem.ToString("C"); txtQty.Text = lineItem.Quantity.ToString(); txtQty.Visible = EditMode; lblQty.Text = lineItem.Quantity.ToString(); lblQty.Visible = !EditMode; lblLineTotal.Text = lineItem.LineTotal.ToString("C"); if (lineItem.HasAnyDiscounts) { lblLineTotalWithoutDiscounts.Visible = true; lblLineTotalWithoutDiscounts.Text = lineItem.LineTotalWithoutDiscounts.ToString("c"); litDiscounts.Text = "<div class=\"discounts\">" + lineItem.DiscountDetailsAsHtml() + "</div>"; } if (!EditMode && !string.IsNullOrEmpty(lineItem.CustomPropGiftCardNumber)) { divGiftWrap.Visible = true; litGiftCardsNumbers.Text = "Gift Card Number(s): <br/>" + lineItem.CustomPropGiftCardNumber + "<br/>"; lnkGiftCards.Text = Localization.GetString("GiftCardDetails"); lnkGiftCards.NavigateUrl = "/DesktopModules/Hotcakes/Core/Admin/catalog/GiftCards.aspx?lineitem=" + lineItem.Id; } btnDelete.CommandArgument = lineItem.Id.ToString(); btnDelete.Text = Localization.GetString("Delete"); btnDelete.OnClientClick = WebUtils.JsConfirmMessage(Localization.GetJsEncodedString("ConfirmDelete")); } }