private void prepareGrid(String condition, String type,String agentNo) { this.Cursor = Cursors.WaitCursor; AgentComplianSuggestionDao agentComplianSuggestionDao = new ChinaUnion_DataAccess.AgentComplianSuggestionDao(); IList<AgentComplianSuggestion> agentComplianSuggestionList = null; agentComplianSuggestionList = agentComplianSuggestionDao.GetListByKeyword(condition, type, agentNo, ""); this.initControl(); this.Cursor = Cursors.Default; }
private void prepareGrid(String condition, String type,String agentNo) { this.Cursor = Cursors.WaitCursor; AgentComplianSuggestionDao agentComplianSuggestionDao = new ChinaUnion_DataAccess.AgentComplianSuggestionDao(); IList<AgentComplianSuggestion> agentComplianSuggestionList = null; agentComplianSuggestionList = agentComplianSuggestionDao.GetListByKeyword(condition, type, agentNo, ""); this.dgSuggestion.Rows.Clear(); dgSuggestion.Columns.Clear(); dgSuggestion.Columns.Add("序列号", "序列号"); dgSuggestion.Columns.Add("类型", "类型"); dgSuggestion.Columns.Add("标题", "标题"); dgSuggestion.Columns.Add("内容", "内容"); dgSuggestion.Columns.Add("代理商/门店", "代理商/门店"); dgSuggestion.Columns.Add("吐槽建议用户", "吐槽建议用户"); dgSuggestion.Columns.Add("创建时间", "创建时间"); dgSuggestion.Columns.Add("阅读时间", "阅读时间"); if (agentComplianSuggestionList != null && agentComplianSuggestionList.Count > 0) { for (int i = 0; i < agentComplianSuggestionList.Count; i++) { dgSuggestion.Rows.Add(); DataGridViewRow row = dgSuggestion.Rows[dgSuggestion.RowCount - 1]; row.Cells[0].Value = agentComplianSuggestionList[i].sequence; row.Cells[1].Value = agentComplianSuggestionList[i].type; row.Cells[2].Value = agentComplianSuggestionList[i].subject; row.Cells[3].Value = agentComplianSuggestionList[i].content; row.Cells[4].Value = agentComplianSuggestionList[i].agentNo; row.Cells[5].Value = agentComplianSuggestionList[i].userId; row.Cells[6].Value = agentComplianSuggestionList[i].createTime; row.Cells[7].Value = agentComplianSuggestionList[i].agentReadtime; } } dgSuggestion.ColumnHeadersDefaultCellStyle.WrapMode = DataGridViewTriState.False; this.dgSuggestion.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.ColumnHeader; this.dgSuggestion.AutoResizeColumns(); this.initControl(); this.Cursor = Cursors.Default; }
void bindDataToGrid(String subject, String type, String agentNo,String userId) { logger.Info("bindDataToGrid="); logger.Info("subject=" + subject); logger.Info("type=" + type); logger.Info("agentNo=" + agentNo); AgentComplianSuggestionDao agentComplianSuggestionDao = new ChinaUnion_DataAccess.AgentComplianSuggestionDao(); IList<AgentComplianSuggestion> agentComplianSuggestionList = null; agentComplianSuggestionList = agentComplianSuggestionDao.GetListByKeyword("", type, agentNo,userId); this.lblType.Text = type; this.lblAgentNo.Text = agentNo; this.lblUserId.Text = userId; // int index = 1; DataTable dt = new DataTable(); dt.Columns.Add("seq"); dt.Columns.Add("createTime"); dt.Columns.Add("subject"); // dt.Columns.Add("content"); dt.Columns.Add("isReply"); DataRow row = null; if (agentComplianSuggestionList != null && agentComplianSuggestionList.Count>0) { foreach (AgentComplianSuggestion agentComplianSuggestion in agentComplianSuggestionList) { row = dt.NewRow(); row["seq"] = agentComplianSuggestion.sequence; row["createTime"] = agentComplianSuggestion.createTime; row["subject"] = agentComplianSuggestion.subject; if (String.IsNullOrEmpty(agentComplianSuggestion.replyContent)) { row["isReply"] = "尚未回复"; } else { row["isReply"] = "已回复"; } dt.Rows.Add(row); } } else { this.lblMessag.Text = "未找到" + type+"记录!"; } GridView1.DataSource = dt.DefaultView; GridView1.DataBind(); }