public void MessageCenter(System.Collections.Generic.List <NoticeRecord> records) { try { this.Clear(); if (records != null && records.Count > 0) { string Data = null; foreach (NoticeRecord record in records) { if (record != null) { if (Data == null || !Data.Equals(record.createTime.Substring(0, 10))) { OANoticeRecordDateRow datarow = new OANoticeRecordDateRow(record.createTime.Substring(0, 10)); this.trgMessageTable.Rows.Add(datarow); OANoticeRecordItem row = new OANoticeRecordItem(record.createTime, record.message, record.title, record.url); this.trgMessageTable.Rows.Add(row); Data = record.createTime.Substring(0, 10); } else { OANoticeRecordItem row = new OANoticeRecordItem(record.createTime, record.message, record.title, record.url); this.trgMessageTable.Rows.Add(row); } } } this.DateSelect.Text = Data; } } catch (System.Exception e) { System.Console.WriteLine(e.ToString()); } }
public void MessageCenter(System.Collections.Generic.List<NoticeRecord> records) { try { this.Clear(); if (records != null && records.Count > 0) { string Data = null; foreach (NoticeRecord record in records) { if (record != null) { if (Data == null || !Data.Equals(record.createTime.Substring(0, 10))) { OANoticeRecordDateRow datarow = new OANoticeRecordDateRow(record.createTime.Substring(0, 10)); this.trgMessageTable.Rows.Add(datarow); OANoticeRecordItem row = new OANoticeRecordItem(record.createTime, record.message, record.title, record.url); this.trgMessageTable.Rows.Add(row); Data = record.createTime.Substring(0, 10); } else { OANoticeRecordItem row = new OANoticeRecordItem(record.createTime, record.message, record.title, record.url); this.trgMessageTable.Rows.Add(row); } } } this.DateSelect.Text = Data; } } catch (System.Exception e) { System.Console.WriteLine(e.ToString()); } }