public void mainShow() { List <List <String> > result = s.showNoticeInfo(id); for (int i = 0; i < result.Count; i++) { SysNoticeInfo hni = new SysNoticeInfo(); ListViewItem ivi = new ListViewItem(); //定义一个数组用来放东西 String[] temp = new String[3]; hni.labelNoticeId.Content = result[i][0]; hni.labelNoticeName.Content = result[i][1]; if (result[i][2].Length > 20) { hni.labelNoticeDescription.Content = result[i][2].Substring(0, 20) + "..."; } else { hni.labelNoticeDescription.Content = result[i][2]; } temp[0] = result[i][1]; temp[1] = result[i][2]; temp[2] = result[i][0]; hni.btnReviseNotice.Tag = temp; hni.btnDeleteNotice.Tag = result[i][0]; hni.btnDeleteNotice.Click += new RoutedEventHandler(btnDeleteNotice_Click); hni.btnReviseNotice.Click += new RoutedEventHandler(btnReviseNotice_Click); ivi.Content = hni; listviewNotice.Items.Add(ivi); } }
public bool Update(SysNoticeInfo info) { if (info.NoticeId != 0) { return(_repo.Update(info).Result); } else { return(_repo.Add(info).Result); } }