protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!Page.IsPostBack) { if (string.IsNullOrEmpty(OrderId)) { // Show Error ucMessageBox.ShowWarning(Localization.GetString("OrderNotFound")); } LoadOrder(); if (!InventoryControl.CheckCurrentOrderhasInventoryProduct()) { btnDelete.OnClientClick += string.Format(CONFIRMFORMAT, Localization.GetString("ConfirmDeleteOrder")); } if (CurrentOrder.PaymentStatus != OrderPaymentStatus.Paid && CurrentOrder.PaymentStatus != OrderPaymentStatus.PartiallyPaid || CurrentOrder.PaymentStatus == OrderPaymentStatus.Overpaid) { btnDelete.OnClientClick += string.Format(CONFIRMFORMAT, Localization.GetString("ConfirmDeleteOrder")); } } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!Page.IsPostBack) { if (string.IsNullOrEmpty(OrderId)) { // Show Error ucMessageBox.ShowWarning("Unable to locate that order."); } LoadOrder(); if (!InventoryControl.CheckCurrentOrderhasInventoryProduct()) { btnDelete.OnClientClick += "return hcConfirm(event, 'Delete this order forever?');"; } if (CurrentOrder.PaymentStatus != OrderPaymentStatus.Paid && CurrentOrder.PaymentStatus != OrderPaymentStatus.PartiallyPaid || CurrentOrder.PaymentStatus == OrderPaymentStatus.Overpaid) { btnDelete.OnClientClick += "return hcConfirm(event, 'Delete this order forever?');"; } } }
protected void btnDelete_Click(object sender, EventArgs e) { if (InventoryControl.CheckOrderHasRefunded()) { if (InventoryControl.CheckCurrentOrderhasInventoryProduct()) { LoadInventory(); } else { var success = false; switch (CurrentOrder.ShippingStatus) { case OrderShippingStatus.FullyShipped: success = HccApp.OrderServices.OrdersDelete(CurrentOrder.bvin, HccApp); break; case OrderShippingStatus.NonShipping: success = HccApp.OrderServices.OrdersDelete(CurrentOrder.bvin, HccApp); break; case OrderShippingStatus.PartiallyShipped: ucMessageBox.ShowWarning( "Partially shipped orders can't be deleted. Either unship or ship all items before deleting."); break; case OrderShippingStatus.Unknown: success = HccApp.OrderServices.OrdersDelete(CurrentOrder.bvin, HccApp); break; case OrderShippingStatus.Unshipped: success = HccApp.OrderServices.OrdersDelete(CurrentOrder.bvin, HccApp); break; } if (success) { Response.Redirect("~/DesktopModules/Hotcakes/Core/Admin/Orders/Default.aspx"); } } } else { if (CurrentOrder.PaymentStatus == OrderPaymentStatus.Paid || CurrentOrder.PaymentStatus == OrderPaymentStatus.PartiallyPaid || CurrentOrder.PaymentStatus == OrderPaymentStatus.Overpaid) { RegisterOpenRefundDialogScript(); } else { var success = false; switch (CurrentOrder.ShippingStatus) { case OrderShippingStatus.FullyShipped: success = HccApp.OrderServices.OrdersDelete(CurrentOrder.bvin, HccApp); break; case OrderShippingStatus.NonShipping: success = HccApp.OrderServices.OrdersDelete(CurrentOrder.bvin, HccApp); break; case OrderShippingStatus.PartiallyShipped: ucMessageBox.ShowWarning( "Partially shipped orders can't be deleted. Either unship or ship all items before deleting."); break; case OrderShippingStatus.Unknown: success = HccApp.OrderServices.OrdersDelete(CurrentOrder.bvin, HccApp); break; case OrderShippingStatus.Unshipped: success = HccApp.OrderServices.OrdersDelete(CurrentOrder.bvin, HccApp); break; } if (success) { Response.Redirect("~/DesktopModules/Hotcakes/Core/Admin/Orders/Default.aspx"); } } } }
private void LoadOrder() { // Header OrderNumberField.Text = CurrentOrder.OrderNumber; TimeOfOrderField.Text = TimeZoneInfo.ConvertTimeFromUtc(CurrentOrder.TimeOfOrderUtc, HccApp.CurrentStore.Settings.TimeZone) .ToString(); // Fraud Score Display if (CurrentOrder.FraudScore < 0) { lblFraudScore.Text = "No Fraud Score Data"; } if (CurrentOrder.FraudScore >= 0 && CurrentOrder.FraudScore < 3) { lblFraudScore.Text = CurrentOrder.FraudScore + "<span class=\"fraud-low\"><strong>low risk</strong></span>"; } if (CurrentOrder.FraudScore >= 3 && CurrentOrder.FraudScore <= 5) { lblFraudScore.Text = "<span class=\"fraud-medium\"><strong>medium risk</strong></span>"; } if (CurrentOrder.FraudScore > 5) { lblFraudScore.Text = "<span class=\"fraud-high\"><strong>high risk</strong></span>"; } // Billing lblBillingAddress.Text = CurrentOrder.BillingAddress.ToHtmlString(); //Email ltEmailAddress.Text = MailServices.MailToLink(CurrentOrder.UserEmail, "Order " + CurrentOrder.OrderNumber, CurrentOrder.BillingAddress.FirstName + ","); // Shipping if (CurrentOrder.HasShippingItems) { lblShippingAddress.Text = CurrentOrder.ShippingAddress.ToHtmlString(); } else { lblShippingAddress.Text = "Non-shipping order"; } //Items ucOrderItems.Rebind(); // Instructions if (!string.IsNullOrWhiteSpace(CurrentOrder.Instructions)) { pnlInstructions.Visible = true; lblInstructions.Text = CurrentOrder.Instructions.Replace("\r\n", "<br />").Replace("\r", "<br />").Replace("\n", "<br />"); } // Totals litTotals.Text = CurrentOrder.TotalsAsTable(HccApp.CurrentRequestContext.MainContentCulture); // Coupons CouponField.Text = string.Empty; for (var i = 0; i <= CurrentOrder.Coupons.Count - 1; i++) { CouponField.Text += CurrentOrder.Coupons[i].CouponCode.Trim().ToUpper() + "<br />"; } // Notes var publicNotes = new Collection <OrderNote>(); var privateNotes = new Collection <OrderNote>(); foreach (var note in CurrentOrder.Notes) { if (note.IsPublic) { publicNotes.Add(note); } else { privateNotes.Add(note); } } PublicNotesField.DataSource = publicNotes; PublicNotesField.DataBind(); PrivateNotesField.DataSource = privateNotes; PrivateNotesField.DataBind(); if (!InventoryControl.CheckCurrentOrderhasInventoryProduct()) { btnDelete.OnClientClick += "return hcConfirm(event, 'Delete this order forever?');"; } if (CurrentOrder.PaymentStatus != OrderPaymentStatus.Paid && CurrentOrder.PaymentStatus != OrderPaymentStatus.PartiallyPaid || CurrentOrder.PaymentStatus == OrderPaymentStatus.Overpaid) { btnDelete.OnClientClick += "return hcConfirm(event, 'Delete this order forever?');"; } }