protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrEmpty(Request["ordernumber"])) { Response.Redirect("default.aspx"); } try { int orderId = OrderService.GetOrderIdByNumber(Request["ordernumber"]); lblOrderID.Text = Resource.Admin_ViewOrder_ItemNum + orderId; //Added by Evgeni lOrder0.Text = orderId.ToString(); if (!IsPostBack) { Order ord = OrderService.GetOrder(orderId); if (ord != null) { ordCurrency = ord.OrderCurrency; lOrderDate.Text = AdvantShop.Localization.Culture.ConvertDate(ord.OrderDate); lNumber.Text = ord.Number; lblOrderStatus.Text = @"(" + ord.OrderStatus.StatusName + @")"; lblShipping.Text = @"<b>" + Resource.Admin_ViewOrder_Name + @"</b> " + ord.ShippingContact.Name; lblShipping.Text += @"<br />"; lblShipping.Text += @" <b>" + Resource.Admin_ViewOrder_Country + @"</b> " + ord.ShippingContact.Country + @"<br />"; lblShipping.Text += @" <b>" + Resource.Admin_ViewOrder_City + @"</b> " + ord.ShippingContact.City + @"<br />"; if (ord.ShippingContact.Zone != null) { lblShipping.Text += @" <b>" + Resource.Admin_ViewOrder_Zone + @"</b> " + ord.ShippingContact.Zone.Trim() + @"<br />"; } if (ord.ShippingContact.Zip != null) { lblShipping.Text += @" <b>" + Resource.Admin_ViewOrder_Zip + @"</b> " + ord.ShippingContact.Zip.Trim() + @"<br />"; } lblShipping.Text += @" <b>" + Resource.Admin_ViewOrder_Address + @"</b> " + ord.ShippingContact.Address + @"<br />"; lblBilling.Text = @"<b>" + Resource.Admin_ViewOrder_Name + @"</b> " + ord.BillingContact.Name; lblBilling.Text += @"<br />"; lblBilling.Text += @" <b>" + Resource.Admin_ViewOrder_Country + @"</b> " + ord.BillingContact.Country + @"<br />"; lblBilling.Text += @" <b>" + Resource.Admin_ViewOrder_City + @"</b> " + ord.BillingContact.City + @"<br />"; if (ord.BillingContact.Zone != null) { lblBilling.Text += @" <b>" + Resource.Admin_ViewOrder_Zone + @"</b> " + ord.BillingContact.Zone.Trim() + @"<br />"; } if (ord.BillingContact.Zip != null) { lblBilling.Text += @" <b>" + Resource.Admin_ViewOrder_Zip + @"</b> " + ord.BillingContact.Zip.Trim() + @"<br />"; } lblBilling.Text += @" <b>" + Resource.Admin_ViewOrder_Address + @"</b> " + ord.BillingContact.Address + @"<br />"; lblShippingMethod.Text = @"<b>" + ord.ArchivedShippingName + @"</b>"; if (ord.OrderPickPoint != null) { lblShippingMethod.Text += @"</br><b>" + ord.OrderPickPoint.PickPointAddress + @"</b>"; } lblPaymentType.Text = @"<b>" + ord.PaymentMethodName + @"</b>"; // ------------------------------------------------------------------------------------ decimal productPrice = ord.OrderItems.Sum(item => item.Amount * item.Price); decimal totalDiscount = ord.OrderDiscount; lblProductPrice.Text = CatalogService.GetStringPrice(productPrice, ordCurrency.CurrencyValue, ordCurrency.CurrencyCode); trDiscount.Visible = ord.OrderDiscount != 0; lblOrderDiscount.Text = string.Format("-{0}", CatalogService.GetStringDiscountPercent(productPrice, totalDiscount, ordCurrency.CurrencyValue, ord.OrderCurrency.CurrencySymbol, ord.OrderCurrency.IsCodeBefore, CurrencyService.CurrentCurrency.PriceFormat, false)); if (ord.Certificate != null) { trCertificate.Visible = true; lblCertificate.Text = string.Format("-{0}", CatalogService.GetStringPrice(ord.Certificate.Price, ordCurrency.CurrencyValue, ordCurrency.CurrencyCode)); } else { trCertificate.Visible = false; } if (ord.Coupon != null) { trCoupon.Visible = true; switch (ord.Coupon.Type) { case CouponType.Fixed: lblCoupon.Text = String.Format("-{0} ({1})", CatalogService.GetStringPrice(ord.Coupon.Value, ordCurrency.CurrencyValue, ordCurrency.CurrencyCode), ord.Coupon.Code); break; case CouponType.Percent: lblCoupon.Text = String.Format("-{0} ({1}%) ({2})", CatalogService.GetStringPrice(ord.Coupon.Value, ordCurrency.CurrencyValue, ordCurrency.CurrencyCode), CatalogService.FormatPriceInvariant(ord.Coupon.Value), ord.Coupon.Code); break; } } else { trCoupon.Visible = false; } lblShippingPrice.Text = string.Format("+{0}", CatalogService.GetStringPrice(ord.ShippingCost, ord.OrderCurrency.CurrencyValue, ord.OrderCurrency.CurrencyCode)); List <TaxValue> taxedItems = TaxServices.GetOrderTaxes(ord.OrderID); literalTaxCost.Text = TaxServices.BuildTaxTable(taxedItems, ord.OrderCurrency.CurrencyValue, ord.OrderCurrency.CurrencyCode, Resource.Admin_ViewOrder_Taxes); //Added By Evgeni lblTotalPrice.Text = lblTotalPrice0.Text = CatalogService.GetStringPrice(ord.Sum, ord.OrderCurrency.CurrencyValue, ord.OrderCurrency.CurrencyCode); // ------------------------------------------------------------------------------------ if (string.IsNullOrEmpty(ord.CustomerComment)) { lblUserComments.Visible = false; } else { lblUserComments.Text = Resource.Client_PrintOrder_YourComment + @" <br /> " + ord.CustomerComment; lblUserComments.Visible = true; } lStatusComment.Text = ord.StatusComment; DataListOrderItems.DataSource = ord.OrderItems; DataListOrderItems.DataBind(); } } } catch (Exception ex) { Debug.LogError(ex); } }
private void LoadProducts() { DataListOrderItems.DataSource = OrderItems; DataListOrderItems.DataBind(); }