public HttpResponseMessage GetPiont(string model, string userid, string cityID, string year, string where, string screenflied, string DName)
        {
            string returntxt = "";

            try
            {
                string getjson = rule.GetJson(strLocalpath);
                JArray jsonObj = JArray.Parse(getjson);
                userid = userid == "" ? "" : userid;
                string citysql = "";
                JArray js      = new JArray();
                js.Add("[{stcode:0, label: '全部',children:[]}]");
                DataTable dt1      = rule.getdt("select fldAutoID,fldObject,fldName,fldUserID,fldPointContent from tblEQI_Point_Group where fldObject='" + model + "' and fldUserID=" + userid);
                string    resposne = JsonHelper.SerializeObject(dt1);
                string    json     = "[{stcode:0, label: '全部',children:[";
                for (int i = 0; i < jsonObj.Count; i++)
                {
                    string typemodel = jsonObj[i]["type"].ToString();
                    if (typemodel == model)
                    {
                        if (cityID == "2")
                        {
                            citysql = "select distinct fldSTCode,fldSTName from " + jsonObj[i]["table"] + " where fldYear=" + year;
                        }
                        else
                        {
                            RuletblFW_RegCity city     = new RuletblFW_RegCity();
                            string            citycode = city.ByPK(int.Parse(cityID)).fldSTCode.ToString().Substring(0, 4);
                            citysql = "select distinct fldSTCode,fldSTName from " + jsonObj[i]["table"] + " where fldYear=" + year + " and fldSTCode like '%" + citycode + "%'";
                        }
                        DataTable dt = rule.getdt(citysql);
                        for (int j = 0; j < dt.Rows.Count; j++)
                        {
                            if (j == dt.Rows.Count - 1)
                            {
                                json += "{stcode:'" + dt.Rows[j]["fldSTCode"].ToString() + "'" + ",label:'" + dt.Rows[j]["fldSTName"].ToString() +
                                        "',children:" + GetTwoLevel(dt.Rows[j]["fldSTCode"].ToString(), jsonObj[i]["table"].ToString(),
                                                                    jsonObj[i]["twofield"].ToString(), jsonObj[i]["level"].ToString(),
                                                                    year, jsonObj[i]["threefield"].ToString(), jsonObj[i]["istranslate"].ToString(),
                                                                    jsonObj[i]["rerurnpiont"].ToString(), where, screenflied, DName, jsonObj[i]["pionttype"].ToString()) + "}]}]";
                            }
                            else
                            {
                                json += "{stcode:'" + dt.Rows[j]["fldSTCode"].ToString() + "'" + ",label:'" + dt.Rows[j]["fldSTName"].ToString() +
                                        "',children:" + GetTwoLevel(dt.Rows[j]["fldSTCode"].ToString(), jsonObj[i]["table"].ToString(),
                                                                    jsonObj[i]["twofield"].ToString(), jsonObj[i]["level"].ToString(),
                                                                    year, jsonObj[i]["threefield"].ToString(), jsonObj[i]["istranslate"].ToString(),
                                                                    jsonObj[i]["rerurnpiont"].ToString(), where, screenflied, DName, jsonObj[i]["pionttype"].ToString()) + "},";
                            }
                        }
                    }
                }
                returntxt = rule.JsonStr("ok", "", json + "|" + resposne);
            }
            catch (Exception e)
            {
                returntxt = rule.JsonStr("ok", e.Message, "");
            }
            return(new HttpResponseMessage {
                Content = new StringContent(returntxt, System.Text.Encoding.UTF8, "application/json")
            });
        }
        public HttpResponseMessage GetPiont_V2(Info info)
        {
            string returntxt = "";

            try
            {
                string getjson = rule.GetJson(GetPointMetaDataPath);

                List <JsonEntity> jsonObj = JsonConvert.DeserializeObject <List <JsonEntity> >(getjson);

                var query = (from x in jsonObj
                             where x.type == info.type
                             select x).FirstOrDefault();

                if (info.Levels != null)
                {
                    foreach (var item in info.Levels)
                    {
                        var query2 = (from x in query.Levels
                                      where x.ID == item.ID
                                      select x).FirstOrDefault();
                        if (query2 != null)
                        {
                            if (item.where.Contains("-1"))
                            {
                                var query4 = (from x in query.Levels
                                              where x.ID == item.ID
                                              select x).FirstOrDefault();

                                Level temp = new Level();
                                temp = query4;

                                query.Levels.Remove(query4);

                                temp.Source      = item.Source;
                                temp.value       = item.value;
                                temp.pointformat = item.pointformat;


                                query.Levels.Add(temp);
                            }
                            else
                            {
                                query.Levels.Remove(query2);


                                query.Levels.Add(item);
                            }



                            int id     = int.Parse(item.ID) + 1;
                            var query3 = (from x in query.Levels
                                          where x.ID == id.ToString()
                                          select x).FirstOrDefault();
                            if (query3 != null)
                            {
                                query3.where = item.Source.Split(',')[0];
                                Level temp = new Level();
                                temp = query3;

                                query.Levels.Remove(query3);

                                query.Levels.Add(temp);
                            }
                        }
                    }
                }



                string citysql = null;
                if (info.cityID == "2")
                {
                    if (info.type == "eqiw_sts_cq")
                    {
                        citysql = "select * from " + query.PointTableName + " where YEAR(fldDate)  in (" + info.year + ") order by fldTaskName";
                    }
                    else
                    {
                        citysql = "select * from " + query.PointTableName + " where fldYear in (" + info.year + ") order by fldSTCode";
                    }
                }
                else
                {
                    if (info.type == "eqiw_sts_cq")
                    {
                        RuletblFW_RegCity city      = new RuletblFW_RegCity();
                        string            fldSTName = city.ByPK(int.Parse(info.cityID)).fldSTName;
                        citysql = "select * from " + query.PointTableName + " where YEAR(fldDate)  in (" + info.year + ") and fldSTName like '%" + fldSTName + "%'" + " order by fldTaskName";
                    }
                    else
                    {
                        RuletblFW_RegCity city     = new RuletblFW_RegCity();
                        string            citycode = city.ByPK(int.Parse(info.cityID)).fldSTCode.ToString().Substring(0, 4);
                        citysql = "select * from " + query.PointTableName + " where fldYear in (" + info.year + ") and fldSTCode like '%" + citycode + "%'" + " order by fldSTCode";
                    }
                }


                DataTable dtSource = rule.SqlQueryForDataTatable("EntityContext", citysql);


                List <Return> result = new List <Return>();


                Return result1 = new Return();
                result1.stcode = "-1";
                result1.label  = "全部";
                result1.point  = "-1";

                List <Return> result2 = new List <Return>();
                DataTable     dt1     = null;
                // 查询一级条件
                var Level1 = (from x in query.Levels
                              where x.ID == "1"
                              select x).FirstOrDefault();
                // 获取一级数据,并赋值
                List <Return> tempList = GetList(dtSource, Level1, null, out dt1);
                result1.children = tempList;


                if (result1.children != null)
                {
                    foreach (var item1 in result1.children)
                    {
                        DataTable dt2    = null;
                        Level     Level2 = null;
                        // 查询二级条件
                        Level2 = (from x in query.Levels
                                  where x.ID == "2"
                                  select x).FirstOrDefault();


                        if (Level2 != null)
                        {
                            tempList       = GetList(dt1, Level2, item1, out dt2);
                            item1.children = tempList;


                            if (item1.children != null)
                            {
                                foreach (var item2 in item1.children)
                                {
                                    DataTable dt3    = null;
                                    Level     Level3 = null;
                                    // 查询三级条件
                                    Level3 = (from x in query.Levels
                                              where x.ID == "3"
                                              select x).FirstOrDefault();

                                    if (Level3 != null)
                                    {
                                        tempList       = GetList(dt2, Level3, item2, out dt3);
                                        item2.children = tempList;

                                        if (item2.children != null)
                                        {
                                            foreach (var item3 in item2.children)
                                            {
                                                DataTable dt4    = null;
                                                Level     Level4 = null;
                                                // 查询四级条件
                                                Level4 = (from x in query.Levels
                                                          where x.ID == "4"
                                                          select x).FirstOrDefault();

                                                if (Level4 != null)
                                                {
                                                    tempList       = GetList(dt3, Level4, item3, out dt4);
                                                    item3.children = tempList;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }


                DataTable dt = rule.getdt("select fldAutoID,fldObject,fldName,fldUserID,fldPointContent from tblEQI_Point_Group where fldObject='" + info.type + "' and fldUserID=" + info.userID);

                result.Add(result1);



                List <object> output = new List <object>();
                output.Add(result);
                output.Add(dt);

                returntxt = rule.JsonStr("ok", "", output);
            }
            catch (Exception e)
            {
                returntxt = rule.JsonStr("no", e.Message, "");
            }
            return(new HttpResponseMessage {
                Content = new StringContent(returntxt, System.Text.Encoding.UTF8, "application/json")
            });
        }