Esempio n. 1
0
        /// <summary>
        /// 获取HOST下所有设备列表
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public IList <SC_NODE> SELECT_HOST_ID_NODELIST(int id)
        {
            try
            {
                string          str    = "SELECT HOST_ID, ADDR_ID, STATE, STATE_DATE from NODE where HOST_ID=" + id + " ORDER BY STATE";;
                DataTable       dt     = SqlHelper.ExecuteReader(str).Tables[0];
                IList <SC_NODE> result = new List <SC_NODE>();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    SC_NODE info = new SC_NODE();

                    info.HOST_ID    = int.Parse(dt.Rows[i][0].ToString());
                    info.ADDR_ID    = dt.Rows[i][1].ToString();
                    info.STATE      = dt.Rows[i][2].ToString()[0];
                    info.STATE_DATE = DateTime.Parse(dt.Rows[i][3].ToString());

                    result.Add(info);
                }
                return(result);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 更新设备状态信息
 /// </summary>
 /// <param name="scn"></param>
 /// <returns></returns>
 public int UPDATE_NODE(SC_NODE scn)
 {
     try
     {
         string str = "update NODE set STATE='" +
                      scn.STATE + "" +
                      scn.STATE + "', STATE_DATE='" +
                      scn.STATE_DATE + "' where HOST_ID=" +
                      scn.HOST_ID + "and ADDR_ID='" +
                      scn.ADDR_ID + "'";
         return(SqlHelper.ExecuteNonQuery(str));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Esempio n. 3
0
 /// <summary>
 /// 根据HOST_ID及ADDR_ID获取设备状态信息
 /// </summary>
 /// <param name="hostid"></param>
 /// <param name="addrid"></param>
 /// <returns></returns>
 public SC_NODE SELECT_NODE_ID(int hostid, string addrid)
 {
     try
     {
         string    str    = "SELECT HOST_ID, ADDR_ID, STATE, STATE_DATE from NODE WHERE HOST_ID=" + hostid + "AND ADDR_ID='" + addrid + "'";;
         DataTable dt     = SqlHelper.ExecuteReader(str).Tables[0];
         SC_NODE   result = new SC_NODE();
         result.HOST_ID    = int.Parse(dt.Rows[0][0].ToString());
         result.ADDR_ID    = dt.Rows[0][1].ToString();
         result.STATE      = dt.Rows[0][2].ToString()[0];
         result.STATE_DATE = DateTime.Parse(dt.Rows[0][3].ToString());
         return(result);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Esempio n. 4
0
        /// <summary>
        /// 获取设备信息地图
        /// </summary>
        /// <param name="nd"></param>
        /// <param name="le"></param>
        /// <returns></returns>
        public static string MakeEquipMap(NodeData nd, IList <EquipData> le, int lid)
        {
            DSCfunction       dsc    = new DSCfunction();
            DEquipType        edt    = new DEquipType();
            IList <EquipType> letype = edt.SELECT_BY_ISUSED(true);
            string            points = "";
            string            pclick = "\r\n<script type=\"text/javascript\">\r\n";

            for (int i = 0; i < le.Count; i++)
            {
                string curicon = "";
                string curtype = "";
                for (int j = 0; j < letype.Count; j++)
                {
                    curtype = letype[j].Name;
                    if (le[i].Type == letype[j].Id)
                    {
                        //curicon = iconurl + letype[j].Icon;
                        SC_NODE sn = new SC_NODE();
                        try
                        {
                            sn = dsc.SELECT_NODE_ID(lid, le[i].Logicid);
                        }
                        catch
                        {
                            sn = null;
                        }

                        string[] tmp     = letype[j].Icon.Split('.');
                        string   tmpicon = "";
                        if (sn != null)
                        {
                            if (sn.STATE == '0')                  // 恢复(正常)
                            {
                                tmpicon = tmp[0] + "1." + tmp[1]; // 绿色
                            }
                            else if (sn.STATE == '1')             // 故障
                            {
                                tmpicon = tmp[0] + "4." + tmp[1]; // 黄色
                            }
                            else if (sn.STATE == '2')             // 火警
                            {
                                tmpicon = tmp[0] + "3." + tmp[1]; // 红色
                            }
                            else if (sn.STATE == '3')             // 隔离
                            {
                                tmpicon = tmp[0] + "2." + tmp[1]; // 灰色
                            }
                            else if (sn.STATE == '4')             // 启动
                            {
                                tmpicon = tmp[0] + "5." + tmp[1]; // 深蓝色
                            }
                            else if (sn.STATE == '5')             // 预警
                            {
                                tmpicon = tmp[0] + "8." + tmp[1]; // 粉色
                            }
                            else if (sn.STATE == '6')             // 回答
                            {
                                tmpicon = tmp[0] + "7." + tmp[1]; // 浅蓝色
                            }
                            //else if (sn.STATE == "10")
                            //{
                            //    tmpicon = tmp[0] + "8" + tmp[1];
                            //}
                            //else if (sn.STATE == "12")
                            //{
                            //    tmpicon = tmp[0] + "2" + tmp[1];
                            //}
                            else
                            {
                                tmpicon = letype[j].Icon;  // 白色
                            }
                        }
                        else
                        {
                            tmpicon = letype[j].Icon;
                        }
                        curicon = iconurl + tmpicon;
                        break;
                    }
                }
                points += "<div class=\"jt\" style=\"left:" + le[i].X + "px;top:" + le[i].Y + "px;\"><img id=\"imge_" + le[i].Id + "\" src=\"" + curicon + "\"/></div>\r\n    ";
                //pclick += "C$('imge_" + le[i].Id + "').onclick = function () {var info = \'设备描述:" + le[i].Description + "<br/>设备编码:" + le[i].Logicid + "<br/>设备链接:<a href=\"" + le[i].Url + "\" target=\"_eurl\">点击显示</a>\';cwxbox.box.show(info);}\r\n";
                pclick += "C$('imge_" + le[i].Id + "').onclick = function () {var info = \'设备描述:" + le[i].Description + "<br/>设备编码:" + le[i].Logicid + "<br/>设备类型:" + curtype + "\';cwxbox.box.show(info);}\r\n";
            }
            pclick += "\r\n</script>\r\n";
            string h0 = "<!DOCTYPE html>\r\n<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\r\n<title>";
            string h1 = "</title>\r\n<style>\r\n.jt{position:absolute;}\r\n*{ margin:0px; padding:0px;}\r\nbody{ font-size:12px; font:Arial, Helvetica, sans-serif; margin:25PX 0PX; background:#eee;}\r\n.botton{ color:#F00; cursor:pointer;}\r\n.mybody{width:600px; margin:0 auto; height:1500px; border:1px solid #ccc; padding:20px 25px; background:#fff}\r\n#cwxBg{ position:absolute; display:none; background:#000; width:100%; height:100%; left:0px; top:0px; z-index:1000;}\r\n#cwxWd{ position:absolute; display:none; border:10px solid #CCC; padding:10px;background:#FFF; z-index:1500;}\r\n#cwxCn{ background:#FFF; display:block;}\r\n.imgd{ width:400px; height:300px;}\r\n</style>\r\n</head>\r\n<body>\r\n<div style=\"position:relative;\">\r\n<script type = \"text/javascript\" src = \"./Scripts/DropBox.js\"></script>\r\n<img src=\"";
            string h2 = "\"/>\r\n";
            string h3 = "\r\n</div>\r\n</body>\r\n</html>";

            return(h0 + nd.PicName + h1 + mapurl + nd.PicPath + h2 + points + pclick + h3);
        }