public void Table(string id) { uiDataGridView1.Rows.Clear(); using LendController lendMapper = new LendController(); foreach (UserLend item in lendMapper.GetLendsByUid(id)) //对借过的所有书进行遍历,这里要小心啊,一定要将所有传入参数转化成string,否则无法export的! { uiDataGridView1.Rows.Add(item.LandNo.ToString(), item.BookID, item.BookName, item.LendTime.ToString(), getExpense(item).ToString()); } }
public void TableName(string lenderId) //check the books according to the name { uiDataGridView1.Rows.Clear(); //清空旧数据 using LendController bookMapper = new LendController(); foreach (var item in bookMapper.GetLendsByUid(lenderId)) { if (item.BookName.Equals(uiTextBoxName.Text)) { uiDataGridView1.Rows.Add(item.LandNo, item.BookID, item.BookName, item.LendTime, getExpense(item)); return; } } }
public void TableID(string lenderId) //show data based on ID { uiDataGridView1.Rows.Clear(); //flush old data using LendController bookMapper = new LendController(); foreach (var item in bookMapper.GetLendsByUid(lenderId)) { if (item.BookID == uiTextboxID.Text) { uiDataGridView1.Rows.Add(item.LandNo, item.BookID, item.BookName, item.LendTime, getExpense(item)); return; } } }