private void initalData() { Memange_service myservice = new Memange_service(); InKu_service inservice = new InKu_service(); Outku_service outservice = new Outku_service(); IList <Remain> remainlist = myservice.getAllRemainInfos(); IList <InKu> inkulist = inservice.getAllInkus(); IList <Outku> outkulist = outservice.getAllOutkus(); this.dataGridView1.Rows.Clear(); this.inku_datagridview.Rows.Clear(); this.dataGridView2.Rows.Clear(); for (int i = 0; i < remainlist.Count; i++) { Remain remain = remainlist[i]; String[] row = { remain.Cangkuname, remain.Productname, remain.Remainnum.ToString() }; this.dataGridView1.Rows.Add(row); } for (int j = 0; j < inkulist.Count; j++) { InKu inku = inkulist[j]; String[] row1 = { inku.In_id, inku.Pro_id, inku.In_time, inku.Cangku_id, inku.In_num.ToString() }; this.inku_datagridview.Rows.Add(row1); } for (int k = 0; k < outkulist.Count; k++) { Outku outku = outkulist[k]; String[] row2 = { outku.Out_id, outku.Pro_id, outku.Out_time, outku.Cangku_id, outku.Out_num.ToString() }; this.dataGridView2.Rows.Add(row2); } }
//显示所有 private void button5_Click(object sender, EventArgs e) { InKu_service in_ser = new InKu_service(); IList <InKu> list = in_ser.getAllInkus(); this.inku_datagridview.Rows.Clear(); int count = list.Count; for (int i = 0; i < count; i++) { InKu inku = list[i]; String[] row = { inku.In_id, inku.Pro_id, inku.In_time, inku.Cangku_id, inku.In_num.ToString() }; this.inku_datagridview.Rows.Add(row); } }