private void BindData()
        {
            DataTable dt_rptData = new DataTable();

            // ์ฑ ํŠธ๊ทธ๋ฆด ๋ฆฌ์ŠคํŠธ๋ฅผ ๊ฐ€์ ธ์˜จ๋‹ค
            cloud.R_Adhoc("SELECT TOP 1 Data_JSON FROM tbPerfmonValues_JSON where ServerNum = " + ServerNum + " and TimeIn_UTC < '" + dtmEnd.ToString("yyyy-MM-dd HH:mm:ss") + "' order by TimeIn_UTC desc");
            //์ฑ ํŠธ๊ทธ๋ฆด ๋ฆฌ์ŠคํŠธ๊ฐ€ ์ž‡๋‹ค๋ฉด
            if (cloud.dsReturn.Tables.Count > 0 && cloud.dsReturn.Tables[0].Rows.Count > 0)
            {
                //1๋‹จ๊ณ„ ๋ฆฌํ”ผํŠธ์— ์ฑ ํŠธ๋””์ž์ธ

                dt_rptData = (DataTable)JsonConvert.DeserializeObject(((string)cloud.dsReturn.Tables[0].Rows[0]["Data_Json"]), (typeof(DataTable)));
                dt_rptData.DefaultView.Sort = "PCounterName asc";
                dt_rptData.Columns.Add("Seq");
            }
            int indx = 0;

            foreach (DataRow dr in dt_rptData.Rows)
            {
                dr["seq"] = indx;
                indx      = indx + 1;
            }
            rpt_Chart.DataSource = dt_rptData.DefaultView.ToTable();
            rpt_Chart.DataBind();

            //2๋‹จ๊ณ„ ๋””์ž์ธ๋œ์ฑ ํŠธ์˜ ํ—ค๋”๊ฐ’์„ ๋ฐ”์ธ๋”ฉํ•˜์—ฌ  ์ฑ ํŠธ๊ทธ๋ฆฌ๊ธฐ
            if (dt_rptData.Rows.Count > 0)
            {
                DataTable        dt_PerfmonValue = new DataTable();
                List <DataTable> dt_list         = new List <DataTable>();
                cloud.R_Adhoc("SELECT servernum, 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 + " order by TimeIn_UTC desc");

                //๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ” ๊ตฌ์กฐ์ƒ์„ฑ์šฉ์œผ๋กœ ์ฒซ๋ฒˆ์งธ 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);
                }

                List <Lib.chartProperty> cplst = new List <Lib.chartProperty>();
                StringBuilder            sb    = new StringBuilder();
                cplst = Lib.Flotr2.SetArrayString_Lines_Report(dt_PerfmonValue, SetChartProperty(dt_rptData));

                sb = Lib.Flotr2.SetStringValue(cplst, sb, ServerNum.ToString());
                sb.Replace("func_Line", "func_Line_Report");
                litScript.Text += Lib.Util.BoxingScript(sb.ToString());
            }
        }
Example #2
0
        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.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_CPU ๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ” ๋งŒ๋“ค๊ธฐ
                var PCIDs = new[] { "P139", "P004", "P107", "P108", "P106", "P184" };

                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where PCIDs.Contains(r.Field <string>("PCID")) ||
                           (r.Field <string>("PCID") == "P001" && r.Field <string>("InstanceName") == "_Total")

                           select r;

                dt_CPU = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_CPU.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_CPU.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                //dt_SQL = Lib.ConvertingProc.Pivot(dt_SQL, "Instancename", "TimeIn", "PValue");
                dt_CPU = Func_SetColumn(dt_CPU);
            }


            //์‹คํ–‰ ์ฟผ๋ฆฌ ๋ฐ์ดํ„ฐ ์ฝ์–ด์˜ค๊ธฐ
            cloud.R_Adhoc("select TimeIn_UTC, Data_JSON from tbSQLCurrentExecution_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_SQLQuery = tester.Clone();
                dt_SQLQuery.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_SQLQuery.Merge(dt_tmp);
                }
            }

            {
                //dt_SQLCurrentQuery ๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ” ๋งŒ๋“ค๊ธฐ
                var test = (from r in dt_SQLQuery.AsEnumerable()
                            orderby r.Field <Int64>("cpu_time") descending

                            select r).Take(20);

                dt_SQLCurrentQuery = dt_SQLQuery.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_SQLCurrentQuery.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_SQLCurrentQuery.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                gv_List_Query.DataSource = dt_SQLCurrentQuery;
                gv_List_Query.DataBind();
            }



            //์ฑ ํŠธ๋ฐ”์ธ๋“œ
            List <Lib.chartProperty> cplst = new List <Lib.chartProperty>();
            StringBuilder            sb    = new StringBuilder();

            cplst           = SetChartProperty();
            cplst           = Lib.Flotr2.SetArrayString_Line_DualYAxis(dt_CPU, cplst);
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_CPU, cplst);
            sb              = Lib.Flotr2.SetStringValue(cplst, sb, ServerNum.ToString());
            litScript.Text += Lib.Util.BoxingScript(sb.ToString());
        }
Example #3
0
        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.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_SQLDATA ๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ” ๋งŒ๋“ค๊ธฐ
                var PCIDs = new[] { "P007", "P081", "P138", "P084", "P098"
                                    , "P008", "P168", "P176", "P177", "P102"
                                    , "P178", "P179", "P103", "P104", "P105"
                                    , "P180", "P181", "P182", "P183", "P100"
                                    , "P101" };

                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where PCIDs.Contains(r.Field <string>("PCID"))

                           select r;

                dt_SQLData = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_SQLData.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_SQLData.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                dt_SQLData = Func_SetColumn(dt_SQLData);
            }

            //์ฑ ํŠธ๋ฐ”์ธ๋“œ
            List <Lib.chartProperty> cplst = new List <Lib.chartProperty>();
            StringBuilder            sb    = new StringBuilder();

            cplst           = SetChartProperty();
            cplst           = Lib.Flotr2.SetArrayString_Line_DualYAxis(dt_SQLData, cplst);
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_SQLData, cplst);
            sb              = Lib.Flotr2.SetStringValue(cplst, sb, ServerNum.ToString());
            litScript.Text += Lib.Util.BoxingScript(sb.ToString());
        }
Example #4
0
        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();
            }
            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_Avgwaintime ๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ” ๋งŒ๋“ค๊ธฐ
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P129"
                           select r;

                dt_Avgwaintime = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_Avgwaintime.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_Avgwaintime.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                dt_Avgwaintime        = Lib.ConvertingProc.Pivot(dt_Avgwaintime, "Instancename", "TimeIn", "Pvalue");
                strColumn_AVGWAITTIME = Lib.ConvertingProc.GetColumname(dt_Avgwaintime.Columns);
            }


            {
                //dt_LockRequest ๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ” ๋งŒ๋“ค๊ธฐ
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P130"
                           select r;

                dt_LockRequest = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_LockRequest.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_LockRequest.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                dt_LockRequest        = Lib.ConvertingProc.Pivot(dt_LockRequest, "Instancename", "TimeIn", "Pvalue");
                strColumn_LockRequest = Lib.ConvertingProc.GetColumname(dt_LockRequest.Columns);
            }


            {
                //dt_LockTimeoutTimeout ๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ” ๋งŒ๋“ค๊ธฐ
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P199"
                           select r;

                dt_LockTimeoutTimeout = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_LockTimeoutTimeout.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_LockTimeoutTimeout.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                dt_LockTimeoutTimeout        = Lib.ConvertingProc.Pivot(dt_LockTimeoutTimeout, "Instancename", "TimeIn", "Pvalue");
                strColumn_LockTimeOutTimeOut = Lib.ConvertingProc.GetColumname(dt_LockTimeoutTimeout.Columns);
            }

            {
                //dt_LockTimeout ๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ” ๋งŒ๋“ค๊ธฐ
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P131"
                           select r;

                dt_LockTimeout = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_LockTimeout.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_LockTimeout.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                dt_LockTimeout        = Lib.ConvertingProc.Pivot(dt_LockTimeout, "Instancename", "TimeIn", "Pvalue");
                strColumn_LockTimeOut = Lib.ConvertingProc.GetColumname(dt_LockTimeout.Columns);
            }

            {
                //dt_LockWaitTimeMs ๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ” ๋งŒ๋“ค๊ธฐ
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P132"
                           select r;

                dt_LockWaitTimeMs = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_LockWaitTimeMs.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_LockWaitTimeMs.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                dt_LockWaitTimeMs        = Lib.ConvertingProc.Pivot(dt_LockWaitTimeMs, "Instancename", "TimeIn", "Pvalue");
                strColumn_LockWaitTimeMs = Lib.ConvertingProc.GetColumname(dt_LockWaitTimeMs.Columns);
            }

            {
                //dt_LockWaitTimeSec ๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ” ๋งŒ๋“ค๊ธฐ
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P133"
                           select r;

                dt_LockWaitTimeSec = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_LockWaitTimeSec.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_LockWaitTimeSec.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                dt_LockWaitTimeSec    = Lib.ConvertingProc.Pivot(dt_LockWaitTimeSec, "Instancename", "TimeIn", "Pvalue");
                strColumn_LockWaitSec = Lib.ConvertingProc.GetColumname(dt_LockWaitTimeSec.Columns);
            }


            {
                //dt_NumberofDeadlock ๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ” ๋งŒ๋“ค๊ธฐ
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P134"
                           select r;

                dt_NumberofDeadlock = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_NumberofDeadlock.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_NumberofDeadlock.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                dt_NumberofDeadlock        = Lib.ConvertingProc.Pivot(dt_NumberofDeadlock, "Instancename", "TimeIn", "Pvalue");
                strColumn_NumberofDeadlock = Lib.ConvertingProc.GetColumname(dt_NumberofDeadlock.Columns);
            }


            //์ฑ ํŠธ๋ฐ”์ธ๋“œ
            List <Lib.chartProperty> cplst = new List <Lib.chartProperty>();
            StringBuilder            sb    = new StringBuilder();

            cplst           = SetChartProperty();
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_Avgwaintime, cplst, "AVGWAITTIME_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_LockRequest, cplst, "LOCKREQUESTS_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_LockTimeoutTimeout, cplst, "LOCKTIMEOUTSTIMEOUT_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_LockTimeout, cplst, "LOCKTIMEOUTS_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_LockWaitTimeMs, cplst, "LOCKWAITTIMEMS_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_LockWaitTimeSec, cplst, "LOCKWAITSEC_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_NumberofDeadlock, cplst, "NUMBEROFDEADLOCKS_LINE_CHART");
            sb              = Lib.Flotr2.SetStringValue(cplst, sb, ServerNum.ToString());
            litScript.Text += Lib.Util.BoxingScript(sb.ToString());
        }
        private void BindData()
        {
            //ํ˜ธ์ŠคํŠธ ์ •๋ณด ๊ฐ€์ ธ์˜ค๊ธฐ
            cloud.R_Adhoc("select ServerNum,HostName,DisplayName,DisplayGroup,RAMSIZE,IPAddress,ServerType,WinVer,Processors,CurrentStatus, TimeIn_UTC from tbHostStatus where ServerNum = " + ServerNum);
            dt_Server = cloud.dsReturn.Tables[0];
            dt_Server = Lib.ConvertingProc.SetDashboardDtServer(dt_Server);

            //๊ฐ ์ฐจํŠธ์—์„œ ์ฐธ์กฐํ•ด์„œ ์‚ฌ์šฉํ•  ๊ณตํ†ต ๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ” ์ƒ์„ฑ
            cloud.R_Adhoc("select a.TimeIn_UTC, Data_JSON from tbPerfmonValues_JSON as a with(nolock) inner join tbHostStatus as b on a.TimeIn_UTC = b.TimeIn_UTC and a.ServerNum = b.ServerNum where b.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);
                }
            }

            //tbDashboard ๊ณตํ†ต ๋ฐ์ดํ„ฐ ์ƒ์„ฑ
            cloud.R_Adhoc("select TimeIn_UTC, Data_JSON from tbDashboard_JSON with(nolock) where ServerNum = " + ServerNum + " and TimeIn_UTC >= dateadd(minute, -15, GETUTCDATE())");

            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_Dashboard = tester.Clone();
                dt_Dashboard.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_Dashboard.Merge(dt_tmp);
                }
            }

            //DB ์ •๋ณด ๊ฐ€์ ธ์˜ค๊ธฐ
            //int nReturn = cloud.w_Dashboard_SQL_Server(MemberNum, CompanyNum, ServerNum);
            cloud.R_Adhoc("select InstanceName,IsClustered,ComputerNamePhysicalNetBIOS,Edition,ProductLevel,ProductVersion,ProcessID,Collation,IsFullTextInstalled,IsIntegratedSecurityOnly,IsHadrEnabled,HadrManagerStatus,IsXTPSupported from tbSQLServerInfo where ServerNum = " + ServerNum);
            dt_DBInfo = cloud.dsReturn.Tables[0];



            //dt_FreeDisk ๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ” ๋งŒ๋“ค๊ธฐ
            var test = from r in dt_PerfmonValue.AsEnumerable()
                       where (r.Field <string>("PCID") == "P018" || r.Field <string>("PCID") == "P164" || r.Field <string>("PCID") == "P015" || r.Field <string>("PCID") == "P190" || r.Field <string>("PCID") == "P194") && !r.Field <string>("InstanceName").Contains("_Total") && !r.Field <string>("InstanceName").Contains("HarddiskVolume")
                       select r;

            dt_FreeDisk = dt_PerfmonValue.Clone();

            foreach (DataRow r in test)
            {
                var newRow = dt_FreeDisk.NewRow();
                newRow.ItemArray = r.ItemArray;
                dt_FreeDisk.Rows.Add(newRow);//I'm doubtful if you need to call this or not
            }

            //MaxDIsk ์ •๋ณด ๊ฐ€์ ธ์˜ค๊ธฐ
            dt_MaxDisk = Lib.ConvertingProc.SetDiskMaxProc(dt_FreeDisk);
            dt_MaxDisk = Lib.ConvertingProc.SetDashboardDtServer(dt_MaxDisk);

            //dt_FreeDisk = Lib.ConvertingProc.Pivot(dt_FreeDisk, "InstanceName", "TimeIn", "PValue");
            dt_FreeDisk = Lib.ConvertingProc.SetDiskProc(dt_FreeDisk);


            //dt_Processor ๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ” ๋งŒ๋“ค๊ธฐ
            var Processor = from r in dt_Dashboard.AsEnumerable()
                            where (r.Field <string>("PNum") == "P0")
                            select r;

            dt_Processor = dt_Dashboard.Clone();

            foreach (DataRow r in Processor)
            {
                var newRow = dt_Processor.NewRow();
                newRow.ItemArray = r.ItemArray;
                dt_Processor.Rows.Add(newRow);//I'm doubtful if you need to call this or not
            }



            //SQL Dashboard ์„ฑ๋Šฅ ์ •๋ณด ๊ฐ€์ ธ์˜ค๊ธฐ
            int nReturn = cloud.get_Dashboard_Chart(ServerNum.ToString());

            dt_Data = Lib.ConvertingProc.ChangeDashboardColumnName(cloud.dsReturn.Tables[0]);
            dt_Data = Lib.ConvertingProc.SetDashboardDtServer(dt_Data);



            //์„ฑ๋Šฅ ์ •๋ณด์—์„œ ์ตœ๊ทผ๊ฐ’์„ ๋ผ๋ฒจ์— ๋ฟŒ๋ ค์ฃผ๊ธฐ ์œ„ํ•ด MaxData ์ƒ์„ฑํ•ด์„œ ๋งˆ์ง€๋ง‰ ๊ฐ’ ์ฝ๊ธฐ
            dt_MaxData = new DataTable();
            dt_MaxData = dt_Data.Clone();
            dt_MaxData.ImportRow(dt_Data.Rows[dt_Data.Rows.Count - 1]);
            //dt_MaxData = Lib.ConvertingProc.SetDashboardDtServer(dt_MaxData);



            //SQL Agent Fail
            //nReturn = cloud.get_SQLAgentFail(ServerNum);
            //numSQLAgent = cloud.dsReturn.Tables[0].Rows.Count;

            //SQL Lnked
            //nReturn = cloud.get_SQLLinked(ServerNum);
            //numSQLLinked = cloud.dsReturn.Tables[0].Rows.Count;

            //SQL Service
            //nReturn = cloud.get_SQLServiceStatus(ServerNum);
            //numSQLService = cloud.dsReturn.Tables[0].Rows.Count;

            //SQL Error
            //nReturn = cloud.get_SQLErrorlog(ServerNum);
            //numSQLLinked = cloud.dsReturn.Tables[0].Rows.Count;

            //SQL Session
            //nReturn = cloud.get_SQLSession(ServerNum);
            //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_SQLSession = tester.Clone();
            //    dt_SQLSession.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_SQLSession.Merge(dt_tmp);
            //    }
            //}

            //foreach (DataRow dr in dt_SQLSession.Rows)
            //{
            //    numSessionCNT += Convert.ToInt32(dr["TotalSession"].ToString());
            //    numActiveSession += Convert.ToInt32(dr["ActiveSession"].ToString());
            //}

            //SQL Database File Size
            //nReturn = cloud.get_SQLDatabaseFileSize(ServerNum);
            //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_DatabaseFileSize = tester.Clone();
            //    dt_DatabaseFileSize.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_DatabaseFileSize.Merge(dt_tmp);
            //    }
            //}

            //numDatabaseCNT = dt_DatabaseFileSize.Rows.Count;

            //numDataFileSize_Total = 0;
            //numDataFileSize_Use = 0;
            //numLogFileSize_Total = 0;
            //numLogFileSize_Use = 0;

            //if (dt_DatabaseFileSize.Rows.Count > 0)
            //{
            //    foreach (DataRow dr in dt_DatabaseFileSize.Rows)
            //    {
            //        numDataFileSize_Total = numDataFileSize_Total + Convert.ToDouble(dr["Datafile_Size_MB"].ToString());
            //        numDataFileSize_Use = numDataFileSize_Use + Convert.ToDouble(dr["Data_MB"].ToString()) + Convert.ToDouble(dr["Index_MB"].ToString());
            //        numLogFileSize_Total = numLogFileSize_Total + Convert.ToDouble(dr["Transaction_Log_Size"].ToString());
            //        numLogFileSize_Use = numLogFileSize_Use + Convert.ToDouble(dr["Log_Used_Size_MB"].ToString());

            //        numVLFCNT = 0;
            //        stVLF_DB = "";


            //        if (Convert.ToInt32(dr["Total_vlf_cnt"].ToString()) > numVLFCNT)
            //        {
            //            numVLFCNT = Convert.ToInt32(dr["Total_vlf_cnt"].ToString());
            //            stVLF_DB = dr["DatabaseName"].ToString();
            //        }

            //    }
            //}


            //SQL Index Flag
            numIndexFlag       = 0;
            numIndexFlagObject = "";

            //nReturn = cloud.get_SQLIndexflag(ServerNum);
            //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 ์— ๋ฐ์ดํ„ฐํ…Œ์ด๋ธ” ๊ตฌ์กฐ๋งŒ ๋ณต์‚ฌ
            //    dt_SQLIndexFlag = tester.Clone();
            //    dt_SQLIndexFlag.AcceptChanges();

            //    foreach (DataRow dr in cloud.dsReturn.Tables[0].Rows)
            //    {
            //        DataTable dt_tmp = (DataTable)JsonConvert.DeserializeObject(((string)dr["Data_Json"]), (typeof(DataTable)));

            //        dt_SQLIndexFlag.Merge(dt_tmp);
            //    }

            //    foreach (DataRow dr in dt_SQLIndexFlag.Rows)
            //    {
            //        if (Convert.ToInt32(dr["avg_frag_percent"].ToString()) > numIndexFlag)
            //        {
            //            numIndexFlag = Convert.ToInt32(dr["avg_frag_percent"].ToString());
            //            numIndexFlagObject = dr["db_name"].ToString() + ":" + dr["object_name"].ToString();
            //        }
            //    }
            //}


            //์ฐจํŠธ ๋ฐ์ดํ„ฐ ๋˜์ง€๊ธฐ
            List <Lib.chartProperty> cplst = new List <Lib.chartProperty>();
            StringBuilder            sb    = new StringBuilder();

            cplst              = Lib.Flotr2.SetArrayString_Lines(dt_Data, SetChartProperty());
            cplst              = Lib.Flotr2.SetArrayString_Cols(dt_Data, cplst);
            cplst              = Lib.Flotr2.SetArrayString_Bar(dt_FreeDisk, cplst);
            sb                 = Lib.Flotr2.SetStringValue(cplst, sb, ServerNum.ToString());
            litScript_UC.Text += Lib.Util.BoxingScript(sb.ToString());
        }
        private void BindData()
        {
            DataTable dt = new DataTable();

            if (!string.IsNullOrEmpty(ddl_Server.SelectedValue))
            {
                pnl_chart.Visible = true;
                cloud.get_ServerStatus(ServerNum.ToString());
                dt = cloud.dsReturn.Tables[0];
                gv_Info.DataSource = dt;
                gv_Info.DataBind();

                string strPCID         = System.Text.RegularExpressions.Regex.Split(strParameter, "#c#")[0];
                string strInstanceName = System.Text.RegularExpressions.Regex.Split(strParameter, "#c#")[1];
                //if (strInstanceName.ToLower() == "allinstance")
                //    strInstanceName = "";

                //๊ฐ ์ฐจํŠธ์—์„œ ์ฐธ์กฐํ•ด์„œ ์‚ฌ์šฉํ•  ๊ณตํ†ต ๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ” ์ƒ์„ฑ
                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);
                    }
                }

                //ํŠน์ • ์นด์šดํ„ฐ ๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ” ๋งŒ๋“ค๊ธฐ
                if (strInstanceName.ToLower() == "allinstance")
                {
                    var test = from r in dt_PerfmonValue.AsEnumerable()
                               where r.Field <string>("PCID") == strPCID.ToString()
                               select r;

                    dt_PerfmonValue_select = dt_PerfmonValue.Clone();

                    foreach (DataRow r in test)
                    {
                        var newRow = dt_PerfmonValue_select.NewRow();
                        newRow.ItemArray = r.ItemArray;
                        dt_PerfmonValue_select.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                    }
                }
                else
                {
                    var test = from r in dt_PerfmonValue.AsEnumerable()
                               where r.Field <string>("PCID") == strPCID && r.Field <string>("InstanceName") == strInstanceName
                               select r;

                    dt_PerfmonValue_select = dt_PerfmonValue.Clone();

                    foreach (DataRow r in test)
                    {
                        var newRow = dt_PerfmonValue_select.NewRow();
                        newRow.ItemArray = r.ItemArray;
                        dt_PerfmonValue_select.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                    }
                }

                ////cloud.R_Windows_Perfmon(ServerNum, dtmStart, dtmEnd, strPCID, strInstanceName);
                //if (strInstanceName.ToLower() == "allinstance")
                //    cloud.R_Adhoc("select TImeIn,InstanceName,PValue from tbPerfmonValues 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 + " and PCID = '" + strPCID + "'");
                //else
                //    cloud.R_Adhoc("select TImeIn,InstanceName,PValue from tbPerfmonValues 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 + " and PCID = '" + strPCID + "' and InstanceName = '" + strInstanceName + "'");


                dt                 = Func_SetColumn(dt_PerfmonValue_select);
                strColumnNames     = Lib.ConvertingProc.GetColumname(dt.Columns);
                gv_List.DataSource = dt;
                gv_List.DataBind();

                //์ฑ ํŠธ๋ฐ”์ธ๋“œ
                List <Lib.chartProperty> cplst = new List <Lib.chartProperty>();
                StringBuilder            sb    = new StringBuilder();
                cplst           = SetChartProperty();
                cplst           = Lib.Flotr2.SetArrayString_Lines(dt, cplst);
                sb              = Lib.Flotr2.SetStringValue(cplst, sb, ServerNum.ToString());
                litScript.Text += Lib.Util.BoxingScript(sb.ToString());
            }
        }
        private void BindData()
        {
            try
            {
                //ํ˜ธ์ŠคํŠธ ์ •๋ณด ๊ฐ€์ ธ์˜ค๊ธฐ
                cloud.R_Adhoc("select ServerNum,HostName,DisplayName,DisplayGroup,RAMSIZE,IPAddress,ServerType,WinVer,Processors,CurrentStatus, TimeIn_UTC from tbHostStatus where ServerNum = " + ServerNum);
                dt_Server = cloud.dsReturn.Tables[0];
                dt_Server = Lib.ConvertingProc.SetDashboardDtServer(dt_Server);

                //๊ฐ ์ฐจํŠธ์—์„œ ์ฐธ์กฐํ•ด์„œ ์‚ฌ์šฉํ•  ๊ณตํ†ต ๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ” ์ƒ์„ฑ
                cloud.R_Adhoc("select a.TimeIn_UTC, Data_JSON from tbPerfmonValues_JSON as a with(nolock) inner join tbHostStatus as b on a.TimeIn_UTC = b.TimeIn_UTC and a.ServerNum = b.ServerNum where b.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_FreeDisk ๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ” ๋งŒ๋“ค๊ธฐ
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where (r.Field <string>("PCID") == "P018" || r.Field <string>("PCID") == "P164" || r.Field <string>("PCID") == "P015" || r.Field <string>("PCID") == "P190" || r.Field <string>("PCID") == "P194") && !r.Field <string>("InstanceName").Contains("_Total") && !r.Field <string>("InstanceName").Contains("HarddiskVolume")
                           select r;

                dt_FreeDisk = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_FreeDisk.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_FreeDisk.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                //MaxDIsk ์ •๋ณด ๊ฐ€์ ธ์˜ค๊ธฐ
                dt_MaxDisk = Lib.ConvertingProc.SetDiskMaxProc(dt_FreeDisk);
                dt_MaxDisk = Lib.ConvertingProc.SetDashboardDtServer(dt_MaxDisk);

                //dt_FreeDisk = Lib.ConvertingProc.Pivot(dt_FreeDisk, "InstanceName", "TimeIn", "PValue");
                dt_FreeDisk = Lib.ConvertingProc.SetDiskProc(dt_FreeDisk);


                //์—ฌ๊ธฐ๊ฐ€ ์ˆ˜์ • ํ•œ๊ณณ
                //์œˆ๋„์šฐ ์„ฑ๋Šฅ ์ •๋ณด ๊ฐ€์ ธ์˜ค๊ธฐ
                int nReturn = cloud.get_Dashboard_Chart(ServerNum.ToString());
                dt_Data = Lib.ConvertingProc.ChangeDashboardColumnName(cloud.dsReturn.Tables[0]);
                dt_Data = Lib.ConvertingProc.SetDashboardDtServer(dt_Data);
                //์„ฑ๋Šฅ ์ •๋ณด์—์„œ ์ตœ๊ทผ๊ฐ’์„ ๋ผ๋ฒจ์— ๋ฟŒ๋ ค์ฃผ๊ธฐ ์œ„ํ•ด MaxData ์ƒ์„ฑํ•ด์„œ ๋งˆ์ง€๋ง‰ ๊ฐ’ ์ฝ๊ธฐ
                dt_MaxData = new DataTable();
                dt_MaxData = dt_Data.Clone();
                dt_MaxData.ImportRow(dt_Data.Rows[dt_Data.Rows.Count - 1]);
                //dt_MaxData = Lib.ConvertingProc.SetDashboardDtServer(dt_MaxData);

                //์ฐจํŠธ ๋ฐ์ดํ„ฐ ๋˜์ง€๊ธฐ
                List <Lib.chartProperty> cplst = new List <Lib.chartProperty>();
                StringBuilder            sb    = new StringBuilder();
                cplst              = Lib.Flotr2.SetArrayString_Lines(dt_Data, SetChartProperty());
                cplst              = Lib.Flotr2.SetArrayString_Cols(dt_Data, cplst);
                cplst              = Lib.Flotr2.SetArrayString_Bar(dt_FreeDisk, cplst);
                sb                 = Lib.Flotr2.SetStringValue(cplst, sb, ServerNum.ToString());
                litScript_UC.Text += Lib.Util.BoxingScript(sb.ToString());
            }
            catch
            {
            }
        }
        private void BindData()
        {
            DataTable dt = new DataTable();

            if (!string.IsNullOrEmpty(ddl_Server.SelectedValue))
            {
                cloud.get_ServerStatus(ServerNum.ToString());
                dt = cloud.dsReturn.Tables[0];
                gv_Info.DataSource = dt;
                gv_Info.DataBind();
            }

            //cloud.R_WEB_Report(Lib.Util.TConverter<int>(ddl_Server.SelectedValue), dtmStart, dtmEnd);
            //Adhoc์œผ๋กœ ๋˜์ ธ๋ด„ (tbDashboard ๋ฐ์ดํ„ฐ ๊ฐ€์ ธ์˜ค๊ธฐ)
            cloud.R_Adhoc("select TimeIn,P0,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17,P18,P19 from tbDashboard 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);
            //dt = new DataTable();
            dt_Data = Lib.ConvertingProc.ChangeDashboardColumnName(cloud.dsReturn.Tables[0]);
            dt_Data = Lib.ConvertingProc.SetDashboardDtServer(dt_Data);
            dt_Data = func_MatchColumName(dt_Data);


            //๊ฐ ์ฐจํŠธ์—์„œ ์ฐธ์กฐํ•ด์„œ ์‚ฌ์šฉํ•  ๊ณตํ†ต ๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ” ์ƒ์„ฑ
            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_FreeDisk ๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ” ๋งŒ๋“ค๊ธฐ
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P018" && !r.Field <string>("InstanceName").Contains("_Total") && !r.Field <string>("InstanceName").Contains("HarddiskVolume")
                           select r;

                dt_FreeDisk = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_FreeDisk.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_FreeDisk.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                dt_FreeDisk = Lib.ConvertingProc.SetDiskProc(dt_FreeDisk);
                //dt_FreeDisk = Lib.ConvertingProc.Pivot(dt_FreeDisk, "Instancename", "TimeIn", "PValue");
                //strFreeDiskColumName = Lib.ConvertingProc.GetColumname(dt_FreeDisk.Columns);
            }

            {
                //dt_FreeDiskPercent ๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ” ๋งŒ๋“ค๊ธฐ
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P018" && !r.Field <string>("InstanceName").Contains("_Total") && !r.Field <string>("InstanceName").Contains("HarddiskVolume")
                           select r;

                dt_FreeDiskPercent = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_FreeDiskPercent.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_FreeDiskPercent.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                dt_FreeDiskPercent = Lib.ConvertingProc.SetDiskProc(dt_FreeDiskPercent);
            }

            List <Lib.chartProperty> cplst = new List <Lib.chartProperty>();
            StringBuilder            sb    = new StringBuilder();

            cplst = SetChartProperty();
            cplst = Lib.Flotr2.SetArrayString_Line_DualYAxis(dt_Data, cplst);
            //cplst = Lib.Flotr2.SetArrayString_Pie(dt_FreeDisk_Max, cplst);
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_FreeDisk, cplst);
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_Data, cplst);
            cplst           = Lib.Flotr2.SetArrayString_Bar(dt_FreeDiskPercent, cplst);
            sb              = Lib.Flotr2.SetStringValue(cplst, sb, ServerNum.ToString());
            litScript.Text += Lib.Util.BoxingScript(sb.ToString());
        }
        private void BindData()
        {
            DataTable dt = new DataTable();

            if (!string.IsNullOrEmpty(ddl_Server.SelectedValue))
            {
                cloud.get_ServerStatus(ServerNum.ToString());
                dt = cloud.dsReturn.Tables[0];
                gv_Info.DataSource = dt;
                gv_Info.DataBind();
            }

            //cloud.R_WEB_TimeTaken(Lib.Util.TConverter<int>(ddl_Server.SelectedValue), dtmStart, dtmEnd);
            cloud.R_Adhoc("SELECT TOP(20) URI,AVG(AvgTimeTaken) AS [Average Time Taken], MAX(MaxTimeTaken) AS [Max Time Taken] FROM tbIISLog 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 + " GROUP BY URI ORDER BY [Average Time Taken] DESC");
            DataTable dt_Web_TimeTaken = cloud.dsReturn.Tables[0];

            gv_List_AvgTimeTaken.DataSource = dt_Web_TimeTaken;
            gv_List_MaxTimeTaken.DataSource = dt_Web_TimeTaken;
            gv_List_AvgTimeTaken.DataBind();
            gv_List_MaxTimeTaken.DataBind();

            //cloud.R_WEB_Byte(Lib.Util.TConverter<int>(ddl_Server.SelectedValue), dtmStart, dtmEnd);
            cloud.R_Adhoc("SELECT TOP(20) URI,SUM(CAST(SCBytes AS float)) AS [Total Bytes from Server], SUM(Hits) AS [Total Hits] FROM tbIISLog 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 + " GROUP BY URI ORDER BY [Total Bytes from Server] DESC");
            DataTable dt_Web_Byte = cloud.dsReturn.Tables[0];

            gv_List_TotalBytes.DataSource = dt_Web_Byte;
            gv_List_TotalHit.DataSource   = dt_Web_Byte;
            gv_List_TotalBytes.DataBind();
            gv_List_TotalHit.DataBind();


            //cloud.R_WEB_RequestStatus(Lib.Util.TConverter<int>(ddl_Server.SelectedValue), dtmStart, dtmEnd);
            cloud.R_Adhoc("SELECT ValueDescription,LogValue,SUM(TotalNumber) AS [Total] FROM tbIISRequestStatus 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 + " GROUP BY ValueDescription, LogValue ORDER BY ValueDescription, Total DESC");
            DataTable dt_Web_Request = cloud.dsReturn.Tables[0];

            DataTable dt_Web_Request_hit = new DataTable();
            var       query = from data in dt_Web_Request.AsEnumerable()
                              where data["ValueDescription"].ToString() == "TOP 20 Hits"
                              orderby data["Total"] descending
                              select data;

            if (query.Count() > 0)
            {
                dt_Web_Request_hit = query.CopyToDataTable <DataRow>();
                dt_Web_Request_hit.Columns["LogValue"].ColumnName = "hit";
            }
            gv_List_Hit.DataSource = dt_Web_Request_hit;
            gv_List_Hit.DataBind();

            DataTable dt_Web_Request_App_hit = new DataTable();

            query = from data in dt_Web_Request.AsEnumerable()
                    where data["ValueDescription"].ToString() == "TOP 20 Application Hits"
                    orderby data["Total"] descending
                    select data;

            if (query.Count() > 0)
            {
                dt_Web_Request_App_hit = query.CopyToDataTable <DataRow>();
                dt_Web_Request_App_hit.Columns["LogValue"].ColumnName = "App_hit";
            }
            gv_List_App_Hit.DataSource = dt_Web_Request_App_hit;
            gv_List_App_Hit.DataBind();

            DataTable dt_Web_Request_IpAddr = new DataTable();

            query = from data in dt_Web_Request.AsEnumerable()
                    where data["ValueDescription"].ToString() == "TOP 20 Clients IP"
                    orderby data["Total"] descending
                    select data;

            if (query.Count() > 0)
            {
                dt_Web_Request_IpAddr = query.CopyToDataTable <DataRow>();
                dt_Web_Request_IpAddr.Columns["LogValue"].ColumnName = "IP";
            }
            gv_List_IP.DataSource = dt_Web_Request_IpAddr;
            gv_List_IP.DataBind();

            DataTable dt_Web_Request_BytePerExtension = new DataTable();

            query = from data in dt_Web_Request.AsEnumerable()
                    where data["ValueDescription"].ToString() == "TOP 20 Bytes per Extension"
                    orderby data["Total"] descending
                    select data;

            if (query.Count() > 0)
            {
                dt_Web_Request_BytePerExtension = query.CopyToDataTable <DataRow>();
                dt_Web_Request_BytePerExtension.Columns["LogValue"].ColumnName = "BytePerExtension";
            }
            gv_List_BytePerExtenstion.DataSource = dt_Web_Request_BytePerExtension;
            gv_List_BytePerExtenstion.DataBind();

            //cloud.R_WEB_Errors(Lib.Util.TConverter<int>(ddl_Server.SelectedValue), dtmStart, dtmEnd);
            cloud.R_Adhoc("SELECT TOP(20) URI, SUM(Hits) AS [Total Hits], StatusCode as [Status Code], Win32StatusCode as [Win32 Status Code] FROM tbIISLog WHERE TimeIn >= '" + dtmStart.ToString("yyyy-MM-dd HH:mm:ss") + "' and Timein < '" + dtmEnd.ToString("yyyy-MM-dd HH:mm:ss") + " ' and ServerNum = " + ServerNum + " and StatusCode >= 400 GROUP BY URI, StatusCode, Win32StatusCode ORDER BY [Total Hits] DESC");
            DataTable dt_Error = cloud.dsReturn.Tables[0];

            gv_List_Err.DataSource = dt_Error;
            gv_List_Err.DataBind();

            //cloud.R_WEB_ServiceStatus(Lib.Util.TConverter<int>(ddl_Server.SelectedValue), dtmStart, dtmEnd);
            cloud.R_Adhoc("SELECT SUM(TotalHits) AS [Total Hits], SUM(TotalSCBytes) AS [Total Bytes from Server], SUM(TotalCSBytes) AS [Total Bytes from Clients], SUM(TotalCIP) AS [Total Client IP], SUM(TotalErrors) AS [Total Errors] FROM tbIISServiceStatus WHERE TimeIn >= '" + dtmStart.ToString("yyyy-MM-dd HH:mm:ss") + "' and Timein < '" + dtmEnd.ToString("yyyy-MM-dd HH:mm:ss") + " ' and ServerNum = " + ServerNum);
            DataTable dt_ServiceStatus = cloud.dsReturn.Tables[0];

            gv_List_ServiceStatus.DataSource = dt_ServiceStatus;
            gv_List_ServiceStatus.DataBind();

            //์ฑ ํŠธ๋ฐ”์ธ๋“œ
            List <Lib.chartProperty> cplst = new List <Lib.chartProperty>();
            StringBuilder            sb    = new StringBuilder();

            cplst = Lib.Flotr2.SetArrayString_Cols_Horizon(dt_Web_TimeTaken, SetChartProperty());
            cplst = Lib.Flotr2.SetArrayString_Cols_Horizon(dt_Web_Byte, cplst);
            cplst = Lib.Flotr2.SetArrayString_Cols_Horizon(dt_Web_Request_hit, cplst);
            cplst = Lib.Flotr2.SetArrayString_Cols_Horizon(dt_Web_Request_App_hit, cplst);
            cplst = Lib.Flotr2.SetArrayString_Cols_Horizon(dt_Web_Request_BytePerExtension, cplst);
            cplst = Lib.Flotr2.SetArrayString_Cols_Horizon(dt_Web_Request_IpAddr, cplst);
            //cplst = Lib.Flotr2.SetArrayString_Lines(dt, cplst);
            sb              = Lib.Flotr2.SetStringValue(cplst, sb, ServerNum.ToString());
            litScript.Text += Lib.Util.BoxingScript(sb.ToString());
        }
        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.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_FreeSpace_per ๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ” ๋งŒ๋“ค๊ธฐ
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P164"
                           select r;

                dt_FreeSpace_per = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_FreeSpace_per.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_FreeSpace_per.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                //dt_FreeSpace_per = Lib.ConvertingProc.SetDiskProc(dt_FreeSpace_per);
                dt_FreeSpace_per          = Lib.ConvertingProc.Pivot(dt_FreeSpace_per, "Instancename", "TimeIn", "Pvalue");
                strColumnName_FreeDiskPer = Lib.ConvertingProc.GetColumname(dt_FreeSpace_per.Columns);
            }

            {
                //dt_FreeSpace_byte ๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ” ๋งŒ๋“ค๊ธฐ
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P018"
                           select r;

                dt_FreeSpace_byte = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_FreeSpace_byte.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_FreeSpace_byte.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                //dt_FreeSpace_byte = Lib.ConvertingProc.SetDiskProc(dt_FreeSpace_byte);
                dt_FreeSpace_byte          = Lib.ConvertingProc.Pivot(dt_FreeSpace_byte, "Instancename", "TimeIn", "Pvalue");
                strColumnName_FreeDiskByte = Lib.ConvertingProc.GetColumname(dt_FreeSpace_byte.Columns);
            }

            {
                //dt_DiskTime ๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ” ๋งŒ๋“ค๊ธฐ
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P015"
                           select r;

                dt_DiskTime = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_DiskTime.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_DiskTime.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                //dt_DiskTime = Lib.ConvertingProc.SetDiskProc(dt_DiskTime);
                dt_DiskTime           = Lib.ConvertingProc.Pivot(dt_DiskTime, "Instancename", "TimeIn", "Pvalue");
                strColumName_DiskTime = Lib.ConvertingProc.GetColumname(dt_DiskTime.Columns);
            }

            {
                //dt_DiskIdleTime ๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ” ๋งŒ๋“ค๊ธฐ
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P190"
                           select r;

                dt_DiskIdleTime = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_DiskIdleTime.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_DiskIdleTime.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                //dt_DiskIdleTime = Lib.ConvertingProc.SetDiskProc(dt_DiskIdleTime);
                dt_DiskIdleTime           = Lib.ConvertingProc.Pivot(dt_DiskIdleTime, "Instancename", "TimeIn", "Pvalue");
                strColumName_DiskIdleTime = Lib.ConvertingProc.GetColumname(dt_DiskIdleTime.Columns);
            }

            {
                //dt_AvgDiskRead ๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ” ๋งŒ๋“ค๊ธฐ
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P191"
                           select r;

                dt_AvgDiskRead = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_AvgDiskRead.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_AvgDiskRead.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                //dt_AvgDiskRead = Lib.ConvertingProc.SetDiskProc(dt_AvgDiskRead);
                dt_AvgDiskRead          = Lib.ConvertingProc.Pivot(dt_AvgDiskRead, "Instancename", "TimeIn", "Pvalue");
                strColumName_AvDiskRead = Lib.ConvertingProc.GetColumname(dt_AvgDiskRead.Columns);
            }


            {
                //dt_AvgDiskWrite ๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ” ๋งŒ๋“ค๊ธฐ
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P193"
                           select r;

                dt_AvgDiskWrite = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_AvgDiskWrite.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_AvgDiskWrite.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                //dt_AvgDiskWrite = Lib.ConvertingProc.SetDiskProc(dt_AvgDiskWrite);
                dt_AvgDiskWrite           = Lib.ConvertingProc.Pivot(dt_AvgDiskWrite, "Instancename", "TimeIn", "Pvalue");
                strColumName_AvgDiskWrite = Lib.ConvertingProc.GetColumname(dt_AvgDiskWrite.Columns);
            }

            {
                //dt_AvgDiskReadQueue ๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ” ๋งŒ๋“ค๊ธฐ
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P197"
                           select r;

                dt_AvgDiskReadQueue = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_AvgDiskReadQueue.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_AvgDiskReadQueue.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                //dt_AvgDiskReadQueue = Lib.ConvertingProc.SetDiskProc(dt_AvgDiskReadQueue);
                dt_AvgDiskReadQueue = Lib.ConvertingProc.Pivot(dt_AvgDiskReadQueue, "Instancename", "TimeIn", "Pvalue");
                strColumName_AvgDiskReadQueueLength = Lib.ConvertingProc.GetColumname(dt_AvgDiskReadQueue.Columns);
            }

            {
                //dt_AvgDiskWriteQueue ๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ” ๋งŒ๋“ค๊ธฐ
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P198"
                           select r;

                dt_AvgDiskWriteQueue = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_AvgDiskWriteQueue.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_AvgDiskWriteQueue.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                //dt_AvgDiskWriteQueue = Lib.ConvertingProc.SetDiskProc(dt_AvgDiskWriteQueue);
                dt_AvgDiskWriteQueue = Lib.ConvertingProc.Pivot(dt_AvgDiskWriteQueue, "Instancename", "TimeIn", "Pvalue");
                strColumName_AvgDiskWriteQueueLength = Lib.ConvertingProc.GetColumname(dt_AvgDiskWriteQueue.Columns);
            }


            {
                //dt_AvgDiskQueue ๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ” ๋งŒ๋“ค๊ธฐ
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P017"
                           select r;

                dt_AvgDiskQueue = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_AvgDiskQueue.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_AvgDiskQueue.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                //dt_AvgDiskQueue = Lib.ConvertingProc.SetDiskProc(dt_AvgDiskQueue);
                dt_AvgDiskQueue = Lib.ConvertingProc.Pivot(dt_AvgDiskQueue, "Instancename", "TimeIn", "Pvalue");
                strColumnName_AvgDiskQueueLength = Lib.ConvertingProc.GetColumname(dt_AvgDiskQueue.Columns);
            }

            {
                //dt_CurruntQueue ๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ” ๋งŒ๋“ค๊ธฐ
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P194"
                           select r;

                dt_CurruntQueue = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_CurruntQueue.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_CurruntQueue.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                //dt_CurruntQueue = Lib.ConvertingProc.SetDiskProc(dt_CurruntQueue);
                dt_CurruntQueue = Lib.ConvertingProc.Pivot(dt_CurruntQueue, "Instancename", "TimeIn", "Pvalue");
                strColumnName_CurrentDiskQueueLength = Lib.ConvertingProc.GetColumname(dt_CurruntQueue.Columns);
            }


            //์ฑ ํŠธ๋ฐ”์ธ๋“œ
            List <Lib.chartProperty> cplst = new List <Lib.chartProperty>();
            StringBuilder            sb    = new StringBuilder();

            cplst           = SetChartProperty();
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_FreeSpace_per, cplst, "FREEDISKSPACEPER_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_FreeSpace_byte, cplst, "FREEDISKSPACEMB_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_DiskTime, cplst, "DISKTIMEMS_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_DiskIdleTime, cplst, "DISKIDLETIME_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_AvgDiskRead, cplst, "AVGDISKREAD_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_AvgDiskWrite, cplst, "AVGDISKWRITE_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_AvgDiskReadQueue, cplst, "AVGDISKREADQUEUE_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_AvgDiskWriteQueue, cplst, "AVGDISKWRITEQUEUE_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_AvgDiskQueue, cplst, "AVGDISKQUEUE_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_CurruntQueue, cplst, "CURRENTDISKQUEUE_LINE_CHART");
            sb              = Lib.Flotr2.SetStringValue(cplst, sb, ServerNum.ToString());
            litScript.Text += Lib.Util.BoxingScript(sb.ToString());
        }
        private void BindSql()
        {
            pnl_SQL.Visible = true;

            //gv2
            //์‹คํ–‰ ์ฟผ๋ฆฌ ๋ฐ์ดํ„ฐ ์ฝ์–ด์˜ค๊ธฐ
            cloud.R_Adhoc("select TimeIn_UTC, Data_JSON from tbSQLCurrentExecution_JSON where Timein_UTC = '" + dtmTimeIn_UTC.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_SQLQuery = tester.Clone();
                dt_SQLQuery.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_SQLQuery.Merge(dt_tmp);
                }
            }

            {
                //dt_SQLCurrentQuery ๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ” ๋งŒ๋“ค๊ธฐ
                var test = (from r in dt_SQLQuery.AsEnumerable()
                            orderby r.Field <Int64>("cpu_time") descending

                            select r).Take(20);

                foreach (DataRow r in test)
                {
                    var newRow = dt_SQLCurrentQuery.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_SQLCurrentQuery.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                rpt_Query.DataSource = dt_SQLCurrentQuery;
                rpt_Query.DataBind();
            }


            //label ์ด๋ฆ„
            cloud.w_ChartSubject(CompanyNum, MemberNum, strReasonCode);
            DataTable dt_ChartSubject = cloud.dsReturn.Tables[0];

            if (dt_ChartSubject != null)
            {
                if (dt_ChartSubject.Rows.Count > 0)
                {
                    lbl_Sql.Text     = dt_ChartSubject.Rows[0][0].ToString();
                    lbl_Sql_Sub.Text = dt_ChartSubject.Rows[0][0].ToString();
                }
            }
            //gv1
            cloud.w_AlertDetail_Table(CompanyNum, MemberNum, ServerNum, strInstanceName, strReasonCode);
            DataTable dt_Descript = cloud.dsReturn.Tables[0];

            gv_List_Sql.DataSource = dt_Descript;
            gv_List_Sql.DataBind();

            //chart
            cloud.w_AlertDetail_Chart(CompanyNum, MemberNum, ServerNum, strInstanceName, strReasonCode);
            DataTable dt_ChartValue = cloud.dsReturn.Tables[0];

            //์ฑ ํŠธ๋ฐ”์ธ๋“œ
            List <Lib.chartProperty> cplst = new List <Lib.chartProperty>();
            StringBuilder            sb    = new StringBuilder();

            cplst = SetChartProperty_SQL();
            cplst = Lib.Flotr2.SetArrayString_Lines(dt_ChartValue, cplst);
            sb    = Lib.Flotr2.SetStringValue(cplst, sb, ServerNum.ToString());
            litScript_Pop.Text += Lib.Util.BoxingScript(sb.ToString());
        }
        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());
        }