Exemple #1
0
 /// <summary>
 /// 获取HOST下设备
 /// </summary>
 /// <param name="hostid"></param>
 /// <returns></returns>
 public IList <SC_NODE> getnodelist(int hostid)
 {
     try
     {
         DSCfunction dsc = new DSCfunction();
         return(dsc.SELECT_HOST_ID_NODELIST(hostid));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemple #2
0
 /// <summary>
 /// 根据ID取得主机信息
 /// </summary>
 /// <param name="hostid">主机ID</param>
 /// <returns></returns>
 public SC_HOST gethost(int hostid)
 {
     try
     {
         DSCfunction dsc = new DSCfunction();
         return(dsc.SELECT_HOST_ID(hostid));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemple #3
0
 /// <summary>
 /// 获取当前主机非状态值主机个数
 /// </summary>
 /// <param name="state"></param>
 /// <returns></returns>
 public int host_state_num_o(char state)
 {
     try
     {
         DSCfunction     dsc = new DSCfunction();
         IList <SC_HOST> lsc = dsc.SELECT_HOST_STATE_O(state);
         return(lsc.Count);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemple #4
0
 /// <summary>
 /// 更新主机信息
 /// </summary>
 /// <param name="sch"></param>
 /// <returns></returns>
 public int exchost(SC_HOST sch)
 {
     try
     {
         DSCfunction dsc = new DSCfunction();
         sch.STATE_DATE = DateTime.Now;
         return(dsc.UPDATE_HOST(sch));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemple #5
0
// ---------------------------建筑楼层及设备---------------------------
        /// <summary>
        /// 添加建筑数据
        /// </summary>
        /// <param name="info">建筑数据</param>
        /// <param name="userid">操作ID</param>
        /// <returns></returns>
        public int AddLandata(LanData info, int userid)
        {
            try
            {
                DLanData dld = new DLanData();
                info.PASSWD = md5.Md5Encode(info.PASSWD);
                info.Isused = true;
                int result = dld.INSERT(info);

                if (result != 0)
                {
                    SC_HOST sch = new SC_HOST();
                    sch.HOST_ID    = result;
                    sch.HOST_CODE  = info.HOST_CODE;
                    sch.PASSWD     = info.PASSWD;
                    sch.ACTIVE     = info.ACTIVE;
                    sch.COMM_DATE  = DateTime.Now;
                    sch.COMM_VARS  = "0";
                    sch.STATE      = '1';
                    sch.STATE_DATE = DateTime.Now;
                    DSCfunction dsc = new DSCfunction();
                    dsc.INSERT_HOST(sch);

                    NodeData nd = new NodeData();
                    nd.Lid            = result;
                    nd.Sort           = 0;
                    nd.Mainmap        = true;
                    nd.Isused         = true;
                    nd.PicName        = "预案图";
                    nd.Description    = "";
                    nd.PicDescription = "";
                    nd.PicPath        = "";
                    DNodeData dnd = new DNodeData();
                    dnd.INSERT(nd);

                    Log log = new Log();
                    log.Tablename   = "LanData";
                    log.Tableid     = result;
                    log.Mid         = userid;
                    log.Datetime    = DateTime.Now;
                    log.Discription = "Insert";
                    DLog dl = new DLog();
                    dl.INSERT(log);
                }
                return(result);
            }
            catch
            {
                return(0);
            }
        }
Exemple #6
0
 /// <summary>
 /// 获取非状态当前主机列表
 /// </summary>
 /// <param name="state">0=离线,1=在线</param>
 /// <returns></returns>
 public IList <SC_HOST> host_state_control_o(char state)
 {
     try
     {
         DSCfunction     dsc = new DSCfunction();
         IList <SC_HOST> lsc = dsc.SELECT_HOST_STATE_O(state);
         DLanData        dld = new DLanData();
         for (int i = 0; i < lsc.Count; i++)
         {
             lsc[i].HostName = dld.SELECT_BY_ID(lsc[i].HOST_ID).Building;
         }
         return(lsc);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemple #7
0
        /// <summary>
        /// 更新建筑数据
        /// </summary>
        /// <param name="info">建筑数据</param>
        /// <param name="userid">操作ID</param>
        /// <returns></returns>
        public int EditLandata(LanData info, int userid)
        {
            try
            {
                DLanData dld = new DLanData();
                if (info.PASSWD != "")
                {
                    info.PASSWD = md5.Md5Encode(info.PASSWD);
                }
                else
                {
                    info.PASSWD = dld.SELECT_BY_ID(info.ID).PASSWD;
                }
                info.Isused = true;
                int result = dld.UPDATE(info);


                DSCfunction dsc = new DSCfunction();
                SC_HOST     sch = dsc.SELECT_HOST_ID(info.ID);
                sch.HOST_CODE = info.HOST_CODE;
                sch.PASSWD    = info.PASSWD;
                sch.ACTIVE    = info.ACTIVE;
                dsc.UPDATE_HOST(sch);

                Log log = new Log();
                log.Tablename   = "LanData";
                log.Tableid     = result;
                log.Mid         = userid;
                log.Datetime    = DateTime.Now;
                log.Discription = "Update";
                DLog dl = new DLog();
                dl.INSERT(log);

                return(result);
            }
            catch
            {
                return(0);
            }
        }
Exemple #8
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);
        }