public Graph GetWCData(string id)
        {
            DBCtrl dbCtrl = new DBCtrl();
            string sql = string.Format("EXEC pGetWCData '{0}'", id);
            var query = dbCtrl.getList(sql);
            dbCtrl.Close();

            return query.ToGoogleChart();
        }
        public Graph ErrRateByWeight()
        {
            DBCtrl db = new DBCtrl();

            string sql = "EXEC pErrRateByWeight null,null";
            DataTable dt = db.getList(sql);

            db.Close();

            return dt.ToGoogleChart();
        }
        public Graph ErrorByBatch(string id)
        {
            DBCtrl db = new DBCtrl();

            string sql = "EXEC pErrByBatch null,null,'" + id + "',null,null";
            DataTable dt = db.getList(sql);

            db.Close();

            return dt.ToGoogleChart();
        }
        public Graph Compare(int year, int month, int day, string line)
        {
            DateTime date = new DateTime(year, month, day);

            DBCtrl db = new DBCtrl();

            string sql = "EXEC pErrCompare '" + date.ToString("yyyy/MM/dd") + "'," + line;
            DataTable dt = db.getList(sql);

            db.Close();

            return dt.ToGoogleChart();
        }
        public Graph Daily(string id)
        {
            DBCtrl dbCtrl = new DBCtrl();
            string sql = string.Format("EXEC pGetDailyWCData '{0}'", id);
            var query = dbCtrl.getList(sql);
            dbCtrl.Close();

            var g = query.ToGoogleChart();
            g.cols[1].p = new Dictionary<string, string>();
            g.cols[1].p.Add("role", "tooltip");
            g.cols[1].p.Add("html", "true");

            return g;
        }
        public Graph ErrorByBatch(int year, int month, int day, string line, string shift)
        {
            int range = int.Parse(line);
            DateTime date = new DateTime(year, month, day);
            DateTime startDate = date.AddDays(-range);

            DBCtrl db = new DBCtrl();

            string sql = "EXEC pErrByBatch null,null,'{0}','{1}','{2}'";
            sql = string.Format(sql, shift, startDate.ToString("yyyy-MM-dd"), date.ToString("yyyy-MM-dd"));
            DataTable dt = db.getList(sql);

            db.Close();

            return dt.ToGoogleChart();
        }
        public Graph ErrorMatrix()
        {
            //var query = from mx in db.vErrorMatrix.AsEnumerable()
            //            orderby mx.Weight
            //            let result = new
            //            {
            //                Weight = mx.Weight,
            //                Line = mx.CodeWorkCenter,
            //                TotalBags = mx.QuantityBagsProduced,
            //                FontErr = mx.Error4,
            //                TotalErr = mx.ErrorTotal,
            //                FontErrRate = mx.Error4Rate,
            //                TotalErrRate = mx.ErrorTotalRate
            //            }
            //            select result;

            DBCtrl dbCtrl = new DBCtrl();

            string sql = "exec pBatchError null,3000,null,null,null";
            var dt = dbCtrl.getList(sql);

            //return query.ToList().ToGoogleChart();
            return dt.ToGoogleChart();
        }