private void gvOrders_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { var orderSnapshot = e.Row.DataItem as OrderSnapshot; // Highlights var highlight = HccApp.OrderServices.FindHighlightForOrder(orderSnapshot); if (!string.IsNullOrEmpty(highlight)) { e.Row.CssClass = "hc" + highlight; } var strongAmount = e.Row.FindControl("strongAmount") as HtmlGenericControl; var spanRecurringInfo = e.Row.FindControl("spanRecurringInfo") as HtmlGenericControl; var spanRecurringPopup = e.Row.FindControl("spanRecurringPopup") as HtmlGenericControl; var btnDetails = e.Row.FindControl("btnDetails"); var btnPayment = e.Row.FindControl("btnPayment"); var btnShipping = e.Row.FindControl("btnShipping"); strongAmount.InnerText = orderSnapshot.TotalGrand.ToString("C"); btnPayment.Visible = orderSnapshot.StatusCode == OrderStatusCode.ReadyForPayment; btnShipping.Visible = orderSnapshot.StatusCode == OrderStatusCode.ReadyForShipping; btnDetails.Visible = !btnPayment.Visible && !btnShipping.Visible; if (orderSnapshot.IsRecurring) { strongAmount.Visible = false; spanRecurringInfo.Visible = true; var order = HccApp.OrderServices.Orders.FindForCurrentStore(orderSnapshot.bvin); var sb = new StringBuilder(); order.Items.ForEach(i => { var lineInfo = Localization.GetFormattedString("Every", i.LineTotal.ToString("C"), i.RecurringBilling.Interval, LocalizationUtils.GetRecurringIntervalLower(i.RecurringBilling.IntervalType)); sb.AppendFormat("{0} <br />", lineInfo); }); spanRecurringPopup.InnerHtml = sb.ToString(); } } }
protected void gvSubscriptions_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { var lineItem = e.Row.DataItem as LineItem; if (lineItem == null) { return; } var lblSKU = e.Row.FindControl("lblSKU") as Label; var lblDescription = e.Row.FindControl("lblDescription") as Label; 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 litDiscounts = e.Row.FindControl("litDiscounts") as Literal; var txtQty = e.Row.FindControl("txtQty") as TextBox; var lblQty = e.Row.FindControl("lblQty") as Label; var lblNextPaymentDate = e.Row.FindControl("lblNextPaymentDate") as Label; var lblLineTotalWithoutDiscounts = e.Row.FindControl("lblLineTotalWithoutDiscounts") as Label; var lblLineTotal = e.Row.FindControl("lblLineTotal") as Label; var lblInterval = e.Row.FindControl("lblInterval") as Label; var lblTotalPayed = e.Row.FindControl("lblTotalPayed") as Label; var btnDelete = e.Row.FindControl("btnDelete") as LinkButton; var btnCancel = e.Row.FindControl("btnCancel") as LinkButton; lblSKU.Text = lineItem.ProductSku; lblDescription.Text = lineItem.ProductName; lblDescription.Text += "<br />" + lineItem.ProductShortDescription; txtQty.Text = lineItem.Quantity.ToString(); txtQty.Visible = EditMode; lblQty.Text = lineItem.Quantity.ToString(); lblQty.Visible = !EditMode; if (!lineItem.RecurringBilling.IsCancelled) { lblNextPaymentDate.Text = lineItem.RecurringBilling.NextPaymentDate.ToShortDateString(); } else { lblNextPaymentDate.Text = Localization.GetString("Cancelled"); } lblLineTotal.Text = lineItem.LineTotal.ToString("C"); lblInterval.Text = Localization.GetFormattedString("Every", lineItem.RecurringBilling.Interval, LocalizationUtils.GetRecurringIntervalLower(lineItem.RecurringBilling.IntervalType)); lblTotalPayed.Text = lineItem.RecurringBilling.TotalPayed.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.Visible = EditMode; btnDelete.CommandArgument = lineItem.Id.ToString(); btnDelete.OnClientClick = WebUtils.JsConfirmMessage(Localization.GetJsEncodedString("ConfirmDelete")); btnCancel.Visible = !EditMode && !lineItem.RecurringBilling.IsCancelled; btnCancel.CommandArgument = lineItem.Id.ToString(); btnCancel.OnClientClick = WebUtils.JsConfirmMessage(Localization.GetJsEncodedString("ConfirmCancel")); } }