void odc_OnConsignSh(object sender, EventArgs e) { OrderDetailsControl odc = sender as OrderDetailsControl; string orderDetailsHtml = GetOrderDetailsHtml(odc.Order.OrderId); if (orderDetailsHtml.ToLower().Contains("退款信息")) { MessageBox.Show(this, "此订单已申请退款. 终止发货!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (!orderDetailsHtml.Contains("买家已付款,等待卖家发货")) { DialogResult dr = MessageBox.Show(this, "此订单不是<买家已付款, 等待卖家发货>状态, 是否继续发货操作?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); if (DialogResult.No == dr) { return; } } string warning; List <Order> buyerOrders; if (IsMultipleOrders(odc.Order.BuyerAccount, _orders, out buyerOrders, out warning)) { OrdersForm of = new OrdersForm(buyerOrders); of.Prompt = string.Format("注意! 此账号有多个订单. {0}. 是否继续发货", warning); DialogResult dr = of.ShowDialog(this); if (DialogResult.Cancel == dr) { return; } } // Have not get full edited address yet if (!string.IsNullOrEmpty(odc.Order.EditedRecipientAddress.Trim())) { MessageBox.Show( this.FindForm(), "收货地址发生修改.\n导出数据无法获得完整修改后的地址, 需要访问订单详情页面获得完整地址.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); odc.RefreshFullEditedAddress(); } ConsignShForm csf = new ConsignShForm(odc.Order); csf.ShowDialog(this); }
private void RefreshOrderLists() { pnlOrders.Controls.Clear(); GC.Collect(); if (null == _filteredOrders || _filteredOrders.Count <= 0) { return; } try { Application.DoEvents(); pnlOrders.SuspendLayout(); for (int i = _currentPage * NUMBER_PER_PAGE; i < ((_currentPage + 1) * NUMBER_PER_PAGE); i++) { if (i < 0 || i >= _filteredOrders.Count) { break; } Order o = _filteredOrders[i]; OrderDetailsControl odc = new OrderDetailsControl(o, Order.GetOrdersByBuyerAccount(o.BuyerAccount, _filteredOrders).Count); odc.OnBuyerClick += new EventHandler(odc_OnBuyerClick); odc.OnAddPacket += new OrderDetailsControl.PacketEventHandler(odc_OnAddPacket); odc.OnConsignSh += new EventHandler(odc_OnConsignSh); pnlOrders.Controls.Add(odc); odc.Width = pnlOrders.Width - 26; } pnlOrders.ResumeLayout(); lblPrevPage.Enabled = (_currentPage >= 1); lblNextPage.Enabled = ((_currentPage + 1) * NUMBER_PER_PAGE) < _filteredOrders.Count; tsslblOrders.Text = string.Format("{0} orders filtered.", _filteredOrders.Count); } catch (Exception ex) { Trace.WriteLine(ex.ToString()); } }
public OrdersForm(List <Order> orders, Order defaultOrder) { InitializeComponent(); if (null == orders) { return; } foreach (Order o in orders) { OrderDetailsControl odc = new OrderDetailsControl(o, orders.Count); odc.Selectable = true; odc.Selected = (o.OrderId.Equals(defaultOrder.OrderId)); pnlOrders.Controls.Add(odc); odc.Width = pnlOrders.Width - 26; if (!string.IsNullOrEmpty(o.EditedRecipientAddress)) { odc.RefreshFullEditedAddress(); } } }