private DataTable GetDataTable(int clientID, int channelID, string province) { DataTable dt = SPDayReportWrapper.GetTodayReportByProvince(clientID, channelID, province); DataTable table = new DataTable(); table.Columns.AddRange(new DataColumn[] { new DataColumn("CHour") { ColumnName = "CHour", DataType = typeof(string) }, new DataColumn("Count") { ColumnName = "Count", DataType = typeof(int) } }); int chour = System.DateTime.Now.Hour; for (int i = 0; i <= chour; i++) { DataRow[] drs; if (channelID != 0) { drs = dt.Select(string.Format(" ChannelID = {0} and ClientID = {1} and CHour = {2} ", channelID, clientID, i)); } else { drs = dt.Select(string.Format(" ClientID = {1} and CHour = {2} ", channelID, clientID, i)); } int count = 0; if (drs.Length > 0) { if (drs[0]["Total"] != System.DBNull.Value) { count = Convert.ToInt32(drs[0]["Total"]); } } table.Rows.Add(new object[] { i.ToString("D2") + ":00", count.ToString() }); } return(table); }