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"); } } } }