private DataReader GetJsonReaderByDataTable(SPChannelWrapper channelWrapper) { JsonReader reader = new JsonReader(); reader.ReaderID = "RecordID"; reader.Fields.Add("RecordID", RecordFieldType.Int); reader.Fields[reader.Fields.Count - 1].Mapping = "RecordID"; reader.Fields.Add("CreateDate", RecordFieldType.Date); reader.Fields[reader.Fields.Count - 1].Mapping = "CreateDate"; this.GridPanel1.ColumnModel.Columns.Add(NewColumn("colCreateDate", "CreateDate", false, "CreateDate", "Ext.util.Format.dateRenderer('n/d/Y H:i:s A')", RendererFormat.None)); List <SPChannelParamsWrapper> channelParams = channelWrapper.GetAllShowParams(); foreach (SPChannelParamsWrapper channelParam in channelParams) { string pName = channelParam.Name.ToString(); reader.Fields.Add(channelParam.ParamsMappingName, RecordFieldType.String); reader.Fields[reader.Fields.Count - 1].Mapping = channelParam.ParamsMappingName.ToString(); this.GridPanel1.ColumnModel.Columns.Add(NewColumn("col" + pName, pName, false, channelParam.ParamsMappingName.ToString(), "", RendererFormat.None)); } return(reader); }
private DataReader GetJsonReaderByDataTable(SPChannelWrapper channelWrapper, bool isSycnData) { JsonReader reader = new JsonReader(); reader.ReaderID = "RecordID"; reader.Fields.Add("RecordID", RecordFieldType.Int); reader.Fields[reader.Fields.Count - 1].Mapping = "RecordID"; reader.Fields.Add("CreateDate", RecordFieldType.Date); reader.Fields[reader.Fields.Count - 1].Mapping = "CreateDate"; this.GridPanel1.ColumnModel.Columns.Add(NewColumn("colCreateDate", "日期", false, "CreateDate", "Ext.util.Format.dateRenderer('n/d/Y H:i:s A')", RendererFormat.None)); this.GridPanel1.ColumnModel.Columns[this.GridPanel1.ColumnModel.Columns.Count - 1].Width = 150; reader.Fields.Add("Province", RecordFieldType.String); reader.Fields[reader.Fields.Count - 1].Mapping = "Province"; this.GridPanel1.ColumnModel.Columns.Add(NewColumn("colProvince", "省份", false, "Province", "", RendererFormat.None)); reader.Fields.Add("City", RecordFieldType.String); reader.Fields[reader.Fields.Count - 1].Mapping = "City"; this.GridPanel1.ColumnModel.Columns.Add(NewColumn("colCity", "城市", false, "City", "", RendererFormat.None)); if (isSycnData) { reader.Fields.Add("IsSycnData", RecordFieldType.String); reader.Fields[reader.Fields.Count - 1].Mapping = "IsSycnData"; this.GridPanel1.ColumnModel.Columns.Add(NewColumn("colIsSycnData", "同步", false, "IsSycnData", "", RendererFormat.None)); reader.Fields.Add("SucesssToSend", RecordFieldType.String); reader.Fields[reader.Fields.Count - 1].Mapping = "SucesssToSend"; this.GridPanel1.ColumnModel.Columns.Add(NewColumn("colSucesssToSend", "成功", false, "SucesssToSend", "", RendererFormat.None)); reader.Fields.Add("SycnRetryTimes", RecordFieldType.String); reader.Fields[reader.Fields.Count - 1].Mapping = "SycnRetryTimes"; this.GridPanel1.ColumnModel.Columns.Add(NewColumn("colSycnRetryTimes", "重试", false, "SycnRetryTimes", "", RendererFormat.None)); } List <SPChannelParamsWrapper> channelParams = channelWrapper.GetAllShowParams(); foreach (SPChannelParamsWrapper channelParam in channelParams) { string pName = channelParam.Name.ToString(); reader.Fields.Add(channelParam.ParamsMappingName, RecordFieldType.String); reader.Fields[reader.Fields.Count - 1].Mapping = channelParam.ParamsMappingName.ToString(); this.GridPanel1.ColumnModel.Columns.Add(NewColumn("col" + pName, pName, false, channelParam.ParamsMappingName.ToString(), "", RendererFormat.None)); } reader.Fields.Add("SendUrl", RecordFieldType.String); reader.Fields[reader.Fields.Count - 1].Mapping = "SendUrl"; return(reader); }