private void BindData() { DataTable dt = new DataTable(); if (!string.IsNullOrEmpty(ddl_Server.SelectedValue)) { cloud.R_HostInfo(Lib.Util.TConverter <int>(ddl_Server.SelectedValue)); dt = cloud.dsReturn.Tables[0]; gv_Info.DataSource = dt; gv_Info.DataBind(); cloud.w_SQLDatabasesDetail(Lib.Util.TConverter <int>(ddl_Server.SelectedValue)); gv_List.DataSource = cloud.dsReturn.Tables[0]; gv_List.DataBind(); } int numDuration = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["ChartDataDuration"]); //각 차트에서 참조해서 사용할 공통 데이터 테이블 생성 cloud.R_Adhoc("select TimeIn_UTC, Data_JSON from tbPerfmonValues_JSON where Timein_UTC >= '" + dtmStart.ToString("yyyy-MM-dd HH:mm:ss") + "' and Timein_UTC < '" + dtmEnd.ToString("yyyy-MM-dd HH:mm:ss") + "' and ServerNum = " + ServerNum); //신규추가 2017-09-23 if (cloud.dsReturn.Tables[0].Rows.Count > 0) { //데이터 테이블 구조생성용으로 첫번째 json데이터를 불러와서 컬럼명을 자동셋팅하도록 DataTable tester = (DataTable)JsonConvert.DeserializeObject(((string)cloud.dsReturn.Tables[0].Rows[0]["Data_Json"]), (typeof(DataTable))); //tester 에는 실제로 데이터가 들어가잇고 clone 을 이용해 dt_Struct 에 데이터테이블 구조만 복사 //DataTable dt_struct = new DataTable(); dt_PerfmonValue = tester.Clone(); dt_PerfmonValue.AcceptChanges(); // 이후 dt_struct 에 계속 merge (union) 하여 하나로 합체 테스트로 돌려보니 rowcount 8만 정도 나왓네요 foreach (DataRow dr in cloud.dsReturn.Tables[0].Rows) { DataTable dt_tmp = (DataTable)JsonConvert.DeserializeObject(((string)dr["Data_Json"]), (typeof(DataTable))); //신규추가 2017-09-23 데이터 머지 = mssql union //신규추가 2017-09-23 참조 https://msdn.microsoft.com/ko-kr/library/fk68ew7b(v=vs.110).aspx dt_PerfmonValue.Merge(dt_tmp); } } { //dt_ACTIVETRANSACTIONS 데이터 테이블 만들기 var test = from r in dt_PerfmonValue.AsEnumerable() where r.Field <string>("PCID") == "P114" select r; dt_ACTIVETRANSACTIONS = dt_PerfmonValue.Clone(); foreach (DataRow r in test) { var newRow = dt_ACTIVETRANSACTIONS.NewRow(); newRow.ItemArray = r.ItemArray; dt_ACTIVETRANSACTIONS.Rows.Add(newRow);//I'm doubtful if you need to call this or not } dt_ACTIVETRANSACTIONS = Lib.ConvertingProc.Pivot(dt_ACTIVETRANSACTIONS, "Instancename", "TimeIn", "Pvalue"); strColumn_ACTIVETRANSACTIONS = Lib.ConvertingProc.GetColumname(dt_ACTIVETRANSACTIONS.Columns); } { //dt_LOGCACHEHITRATIO 데이터 테이블 만들기 var test = from r in dt_PerfmonValue.AsEnumerable() where r.Field <string>("PCID") == "P169" select r; dt_LOGCACHEHITRATIO = dt_PerfmonValue.Clone(); foreach (DataRow r in test) { var newRow = dt_LOGCACHEHITRATIO.NewRow(); newRow.ItemArray = r.ItemArray; dt_LOGCACHEHITRATIO.Rows.Add(newRow);//I'm doubtful if you need to call this or not } dt_LOGCACHEHITRATIO = Lib.ConvertingProc.Pivot(dt_LOGCACHEHITRATIO, "Instancename", "TimeIn", "Pvalue"); strColumn_LOGCACHEHITRATIO = Lib.ConvertingProc.GetColumname(dt_LOGCACHEHITRATIO.Columns); } { //dt_LOGCACHEHITRATIO 데이터 테이블 만들기 var test = from r in dt_PerfmonValue.AsEnumerable() where r.Field <string>("PCID") == "P120" select r; dt_LOGBYTESFLUSHEDSEC = dt_PerfmonValue.Clone(); foreach (DataRow r in test) { var newRow = dt_LOGBYTESFLUSHEDSEC.NewRow(); newRow.ItemArray = r.ItemArray; dt_LOGBYTESFLUSHEDSEC.Rows.Add(newRow);//I'm doubtful if you need to call this or not } dt_LOGBYTESFLUSHEDSEC = Lib.ConvertingProc.Pivot(dt_LOGBYTESFLUSHEDSEC, "Instancename", "TimeIn", "Pvalue"); strColumn_LOGBYTESFLUSHEDSEC = Lib.ConvertingProc.GetColumname(dt_LOGBYTESFLUSHEDSEC.Columns); } { //dt_LOGFLUSHWAITTIME 데이터 테이블 만들기 var test = from r in dt_PerfmonValue.AsEnumerable() where r.Field <string>("PCID") == "P121" select r; dt_LOGFLUSHWAITTIME = dt_PerfmonValue.Clone(); foreach (DataRow r in test) { var newRow = dt_LOGFLUSHWAITTIME.NewRow(); newRow.ItemArray = r.ItemArray; dt_LOGFLUSHWAITTIME.Rows.Add(newRow);//I'm doubtful if you need to call this or not } dt_LOGFLUSHWAITTIME = Lib.ConvertingProc.Pivot(dt_LOGFLUSHWAITTIME, "Instancename", "TimeIn", "Pvalue"); strColumn_LOGFLUSHWAITTIME = Lib.ConvertingProc.GetColumname(dt_LOGFLUSHWAITTIME.Columns); } { //dt_LOGFLUSHWAITTIME 데이터 테이블 만들기 var test = from r in dt_PerfmonValue.AsEnumerable() where r.Field <string>("PCID") == "P118" select r; dt_LOGFLUSHWAITSSEC = dt_PerfmonValue.Clone(); foreach (DataRow r in test) { var newRow = dt_LOGFLUSHWAITSSEC.NewRow(); newRow.ItemArray = r.ItemArray; dt_LOGFLUSHWAITSSEC.Rows.Add(newRow);//I'm doubtful if you need to call this or not } dt_LOGFLUSHWAITSSEC = Lib.ConvertingProc.Pivot(dt_LOGFLUSHWAITSSEC, "Instancename", "TimeIn", "Pvalue"); strColumn_LOGFLUSHWAITSSEC = Lib.ConvertingProc.GetColumname(dt_LOGFLUSHWAITSSEC.Columns); } { //dt_LOGFLUSHESSEC 데이터 테이블 만들기 var test = from r in dt_PerfmonValue.AsEnumerable() where r.Field <string>("PCID") == "P119" select r; dt_LOGFLUSHESSEC = dt_PerfmonValue.Clone(); foreach (DataRow r in test) { var newRow = dt_LOGFLUSHESSEC.NewRow(); newRow.ItemArray = r.ItemArray; dt_LOGFLUSHESSEC.Rows.Add(newRow);//I'm doubtful if you need to call this or not } dt_LOGFLUSHESSEC = Lib.ConvertingProc.Pivot(dt_LOGFLUSHESSEC, "Instancename", "TimeIn", "Pvalue"); strColumn_LOGFLUSHESSEC = Lib.ConvertingProc.GetColumname(dt_LOGFLUSHESSEC.Columns); } { //dt_LOGGROWTHS 데이터 테이블 만들기 var test = from r in dt_PerfmonValue.AsEnumerable() where r.Field <string>("PCID") == "P122" select r; dt_LOGGROWTHS = dt_PerfmonValue.Clone(); foreach (DataRow r in test) { var newRow = dt_LOGGROWTHS.NewRow(); newRow.ItemArray = r.ItemArray; dt_LOGGROWTHS.Rows.Add(newRow);//I'm doubtful if you need to call this or not } dt_LOGGROWTHS = Lib.ConvertingProc.Pivot(dt_LOGGROWTHS, "Instancename", "TimeIn", "Pvalue"); strColumn_LOGGROWTHS = Lib.ConvertingProc.GetColumname(dt_LOGGROWTHS.Columns); } { //dt_LOGSHRINKS 데이터 테이블 만들기 var test = from r in dt_PerfmonValue.AsEnumerable() where r.Field <string>("PCID") == "P123" select r; dt_LOGSHRINKS = dt_PerfmonValue.Clone(); foreach (DataRow r in test) { var newRow = dt_LOGSHRINKS.NewRow(); newRow.ItemArray = r.ItemArray; dt_LOGSHRINKS.Rows.Add(newRow);//I'm doubtful if you need to call this or not } dt_LOGSHRINKS = Lib.ConvertingProc.Pivot(dt_LOGSHRINKS, "Instancename", "TimeIn", "Pvalue"); strColumn_LOGSHRINKS = Lib.ConvertingProc.GetColumname(dt_LOGSHRINKS.Columns); } { //dt_LOGSHRINKS 데이터 테이블 만들기 var test = from r in dt_PerfmonValue.AsEnumerable() where r.Field <string>("PCID") == "P124" select r; dt_LOGTRUNCATIONS = dt_PerfmonValue.Clone(); foreach (DataRow r in test) { var newRow = dt_LOGTRUNCATIONS.NewRow(); newRow.ItemArray = r.ItemArray; dt_LOGTRUNCATIONS.Rows.Add(newRow);//I'm doubtful if you need to call this or not } dt_LOGTRUNCATIONS = Lib.ConvertingProc.Pivot(dt_LOGTRUNCATIONS, "Instancename", "TimeIn", "Pvalue"); strColumn_LOGTRUNCATIONS = Lib.ConvertingProc.GetColumname(dt_LOGTRUNCATIONS.Columns); } //챠트바인드 List <Lib.chartProperty> cplst = new List <Lib.chartProperty>(); StringBuilder sb = new StringBuilder(); cplst = SetChartProperty(); cplst = Lib.Flotr2.SetArrayString_Lines(dt_ACTIVETRANSACTIONS, cplst, "ACTIVETRANSACTIONS_LINE_CHART"); cplst = Lib.Flotr2.SetArrayString_Lines(dt_LOGCACHEHITRATIO, cplst, "LOGCACHEHITRATIO_LINE_CHART"); cplst = Lib.Flotr2.SetArrayString_Lines(dt_LOGBYTESFLUSHEDSEC, cplst, "LOGBYTESFLUSHEDSEC_LINE_CHART"); cplst = Lib.Flotr2.SetArrayString_Lines(dt_LOGFLUSHWAITTIME, cplst, "LOGFLUSHWAITTIME_LINE_CHART"); cplst = Lib.Flotr2.SetArrayString_Lines(dt_LOGFLUSHWAITSSEC, cplst, "LOGFLUSHWAITSSEC_LINE_CHART"); cplst = Lib.Flotr2.SetArrayString_Lines(dt_LOGFLUSHESSEC, cplst, "LOGFLUSHESSEC_LINE_CHART"); cplst = Lib.Flotr2.SetArrayString_Lines(dt_LOGGROWTHS, cplst, "LOGGROWTHS_LINE_CHART"); cplst = Lib.Flotr2.SetArrayString_Lines(dt_LOGSHRINKS, cplst, "LOGSHRINKS_LINE_CHART"); cplst = Lib.Flotr2.SetArrayString_Lines(dt_LOGTRUNCATIONS, cplst, "LOGTRUNCATIONS_LINE_CHART"); sb = Lib.Flotr2.SetStringValue(cplst, sb, ServerNum.ToString()); litScript.Text += Lib.Util.BoxingScript(sb.ToString()); }