Example #1
0
 public void GetJudge(string id)
 {
     BLLManRoute route = new BLLManRoute();
     count = route.RetCount(id);
     object obj = new
     {
         num = count
     };
     string result = JsonConvert.SerializeObject(obj);
     Response.Write(result);
     Response.End();
 }
Example #2
0
        /// <summary>
        /// 查询子岗信息
        /// </summary>
        /// <param name="id">父类ID</param>
        /// <param name="page">第几页数</param>
        /// <param name="rows">每页数据量</param>
        private void GetLoadRoute(string id, int page, int rows)
        {
            BLLManRoute route = new BLLManRoute();
            dt = route.GetRouteDt(id, (page - 1) * rows + 1, page * rows);
            count = route.GetRountCount(id);
            IList<Hashtable> list = new List<Hashtable>();
            foreach (DataRow row in dt.Rows)
            {
                Hashtable ht = new Hashtable();
                ht.Add("ID", row["ID"].ToString());
                ht.Add("RouteID", row["RouteID"].ToString());
                ht.Add("RouteName", row["RouteName"].ToString());
                ht.Add("Rtype", row["Rtype"].ToString());
                list.Add(ht);
            }
            object obj = new
            {
                total = count,
                rows = list
            };

            string result = JsonConvert.SerializeObject(obj);
            Response.Write(result);
            Response.End();
        }
Example #3
0
        //private void ShowRouteTree()
        //{
        //    BLLManRoute route = new BLLManRoute();
        //    StringBuilder st = new StringBuilder();
        //    DataTable dt = route.GetRouteTree();
        //    st.Append("[");
        //    for (int i = 0; i < dt.Rows.Count; i++)
        //    {
        //        if (dt.Rows[i]["PARMENTID"].ToString() == "0")
        //        {
        //            st.Append("{id:'" + dt.Rows[i]["ID"] + "',ide:'" + dt.Rows[i]["IDE"] + "', pId:'" + dt.Rows[i]["PARMENTID"] + "',name:'" + dt.Rows[i]["NAME"] + "',t:'" + dt.Rows[i]["NAME"] + "', open:true},");
        //            id = dt.Rows[i]["ID"].ToString();
        //            name = dt.Rows[i]["NAME"].ToString();
        //        }
        //        else
        //            st.Append("{id:'" + dt.Rows[i]["ID"] + "',ide:'" + dt.Rows[i]["IDE"] + "',pId:'" + dt.Rows[i]["PARMENTID"] + "',name:'" + dt.Rows[i]["NAME"] + "',t:'" + dt.Rows[i]["NAME"] + "',doCheck:false},");
        //    }
        //    string resultMenu = st.ToString().Substring(0, st.ToString().Length - 1) + "]";
        //    object obj = new
        //    {
        //        count = 1,
        //        id = id,
        //        name = name,
        //        menu = resultMenu
        //    };
        //    string result = JsonConvert.SerializeObject(obj);
        //    Response.Write(result);
        //    Response.End();
        //}
        /// <summary>
        /// 初始化Tree结构
        /// </summary>
        private void GetListTree()
        {
            BLLManRoute bmr = new BLLManRoute();
            StringBuilder sb = new StringBuilder();
            DataTable dt = new DataTable();
            string errMsg = "";

            string[] res = bmr.GetTotalLineNameAndID().Split(',');

            if (res != null)
            {
                string zxlParentID = res[0];
                string zxlNodeID = res[1];
                string zxlName = res[2];

                sb.Append("[");
                sb.Append("{id:'0',pId:'" + zxlParentID + "',nodeID:'" + zxlNodeID + "',name:'" + zxlName + "',t:'" + zxlName + "', open:true},");

                dt = bmr.GetTableRoute(out errMsg);

                //线路和关系表拼接
                if (dt != null && dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        sb.Append("{id:'" + dt.Rows[i]["T_NODEKEY"] + "',pId:'" + dt.Rows[i]["T_PARAENTID"] + "',nodeID:'" + dt.Rows[i]["T_NODEID"] + "',name:'" + dt.Rows[i]["T_ROUTENAME"] + "',t:'" + dt.Rows[i]["T_ROUTENAME"] + "'},");
                    }

                    DataTable dtArea = bmr.GetTableArea(out errMsg);

                    //区域和关系表拼接
                    if (dtArea != null && dtArea.Rows.Count > 0)
                    {
                        for (int j = 0; j < dtArea.Rows.Count; j++)
                        {
                            sb.Append("{id:'" + dtArea.Rows[j]["T_NODEKEY"] + "',pId:'" + dtArea.Rows[j]["T_PARAENTID"] + "',nodeID:'" + dtArea.Rows[j]["T_NODEID"] + "',name:'" + dtArea.Rows[j]["T_AREANAME"] + "',t:'" + dtArea.Rows[j]["T_AREANAME"] + "'},");
                        }
                    }

                    //设备和区域关系拼接
                    DataTable dtDevice = bmr.GetTableAreaAndDevInfo(out errMsg);

                    if (dtDevice != null && dtDevice.Rows.Count > 0)
                    {
                        for (int j = 0; j < dtDevice.Rows.Count; j++)
                        {
                            sb.Append("{id:'" + dtDevice.Rows[j]["T_NODEKEY"] + "',pId:'" + dtDevice.Rows[j]["T_PARAENTID"] + "',nodeID:'" + dtDevice.Rows[j]["T_NODEID"] + "',name:'" + dtDevice.Rows[j]["T_DEVICEDESC"] + "',t:'" + dtDevice.Rows[j]["T_DEVICEDESC"] + "'},");
                        }
                    }

                    //点检项和设备关系拼接
                    DataTable dtItem = bmr.GetTableDevAndItemInfo(out errMsg);

                    if (dtItem != null && dtItem.Rows.Count > 0)
                    {
                        for (int j = 0; j < dtItem.Rows.Count; j++)
                        {
                            sb.Append("{id:'" + dtItem.Rows[j]["T_NODEKEY"] + "',pId:'" + dtItem.Rows[j]["T_PARAENTID"] + "',nodeID:'" + dtItem.Rows[j]["T_NODEID"] + "',name:'" + dtItem.Rows[j]["T_ITEMDESC"] + "',t:'" + dtItem.Rows[j]["T_ITEMDESC"] + "'},");
                        }
                    }

                    resultMenu = sb.ToString().TrimEnd(',') + "]";
                }
                else
                { resultMenu = sb.ToString().TrimEnd(',') + "]"; }

                obj = new
                {
                    count = 1,
                    id = "0",
                    name = zxlName,
                    menu = resultMenu
                };
                string result = JsonConvert.SerializeObject(obj);
                Response.Write(result);
                Response.End();
            }
        }
Example #4
0
        public void JudgeRouteOrArea(string id)
        {
            BLLManRoute route = new BLLManRoute();
            int routeCount = route.GetRountCount(id);
            BLLManArea area = new BLLManArea();
            int areaCount = area.GetAreaCount(id);
            string info = "";
            if (routeCount > 0)
            {
                info = "route";
            }
            else if (areaCount > 0)
            {
                info = "area";
            }
            else if (routeCount == 0 && areaCount == 0)
            {
                info = "route";
            }
            object obj = new
            {
                info = info
            };

            string result = JsonConvert.SerializeObject(obj);
            Response.Write(result);
            Response.End();
        }