private DataGridViewModel <Dictionary <string, object> > GetDataList(RedEnvelopeGetRecordQuery query) { DataGridViewModel <Dictionary <string, object> > dataGridViewModel = new DataGridViewModel <Dictionary <string, object> >(); if (query != null) { PageModel <WeiXinRedEnvelopeInfo> weiXinRedEnvelope = WeiXinRedEnvelopeProcessor.GetWeiXinRedEnvelope(query); dataGridViewModel.rows = new List <Dictionary <string, object> >(); dataGridViewModel.total = weiXinRedEnvelope.Total; foreach (WeiXinRedEnvelopeInfo model in weiXinRedEnvelope.Models) { model.ActualNumber = WeiXinRedEnvelopeProcessor.GetActualNumber(model.Id); Dictionary <string, object> dictionary = model.ToDictionary(); string value = ""; switch (model.State) { case 1: value = "已开启"; break; case 0: value = "已关闭"; break; case 2: value = "已过期"; break; } dictionary.Add("StatusText", value); dataGridViewModel.rows.Add(dictionary); } } return(dataGridViewModel); }