// 将商品加入到订单 private void AddOrder(string goodsCode) { if (goodsInfo == null) return; TempOrderInfo tempInfo = GetTempOrderItem(goodsInfo.ID); bool isAdd = true; if (tempInfo != null) { GetTempOrderItem(goodsInfo.ID).Number = int.Parse(this.textBox_Number.Text); tempInfo = GetTempOrderItem(goodsInfo.ID); isAdd = false; } else { if (listOrder == null) listOrder = new List<TempOrderInfo>(); tempInfo = new TempOrderInfo(int.Parse(this.textBox_Number.Text), goodsInfo); this.listOrder.Add(tempInfo); } BindOrderList(goodsCode); }
/// <summary> /// 将列表中的重复项,并高亮显示 /// </summary> /// <param name="order"></param> private void SelectOrderItem(TempOrderInfo order) { foreach (DataGridViewRow row in this.dataGridView_List.Rows) { if (row.Cells[0].Value.ToString() == order.Guid) { row.Selected = true; int selectRows = this.dataGridView_List.SelectedRows[0].Cells[0].RowIndex; dataGridView_List.CurrentCell = dataGridView_List[2, selectRows]; dataGridView_List.BeginEdit(true); } } }