示例#1
0
 private void dataGridViewSuppliers_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (dataGridViewSuppliers.Columns[e.ColumnIndex].Name == "Order" && e.RowIndex >= 0)
     {
         string SupplierId_Value = dataGridViewSuppliers.Rows[e.RowIndex].Cells["Id"].Value.ToString();
         var    orders           = OrderOfSupplierDataAccess.GetOrders(SupplierId_Value);
         OrdersOfSupplierForm ordersOfCustomerForm = new OrdersOfSupplierForm();
         SendOrdersInfoEvent += ordersOfCustomerForm.ShowOrders;
         SendOrdersInfoEvent.Invoke(orders);
         ordersOfCustomerForm.ShowDialog();
     }
 }
        private void ShowMyOrders()
        {
            try
            {
                _orders = OrderOfSupplierDataAccess.GetOrders(SupplierInfo.supplier.Id);
            }
            catch (Exception ex)
            {
                MessageBox.Show("错误:获取发货单数据失败\r\n" + ex.Message);
            }

            dataGridViewMyOrders.Rows.Clear();
            foreach (var order in _orders)
            {
                int             rowId = dataGridViewMyOrders.Rows.Add();
                DataGridViewRow row   = dataGridViewMyOrders.Rows[rowId];
                row.Cells["OrderId"].Value     = order.Id;
                row.Cells["Amount"].Value      = order.Amount;
                row.Cells["OrderDate"].Value   = order.Order_Date;
                row.Cells["OrderStatus"].Value = order.Status;
                row.Cells["IsNew"].Value       = order.Is_New ? "是" : "否";
            }
        }