Beispiel #1
0
 /// <summary>
 /// 根据园区id获取视频配置
 /// </summary>
 /// <param name="regionId"></param>
 /// <returns></returns>
 public VideoConfigCustom GetVideoConfigByRegionId(int regionId)
 {
     try
     {
         BaseRegionExtendConfigQuery query = new BaseRegionExtendConfigQuery();
         query.region_id   = regionId;
         query.config_type = (int)RegionExtendConfigType.视频配置;
         List <BaseRegionExtendConfigModel> extList = baseRegionExtendConfigDAL.GetRegionExtendConfigByRegionIdAndConfigType(query);
         VideoConfigCustom custom = new VideoConfigCustom();
         if (extList.Count > 0)
         {
             custom.regionId = regionId;
             string      str      = extList[0].ext1;
             XmlDocument myXmlDoc = new XmlDocument();
             myXmlDoc.LoadXml(str);
             custom.videoPlatform = Convert.ToInt32(myXmlDoc.SelectSingleNode("root/videoPlatform").InnerText);
             custom.serverIP      = myXmlDoc.SelectSingleNode("root/serverIP").InnerText;
             custom.userName      = myXmlDoc.SelectSingleNode("root/userName").InnerText;
             custom.userPwd       = myXmlDoc.SelectSingleNode("root/userPwd").InnerText;
         }
         return(custom);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #2
0
 /// <summary>
 /// 根据园区ID和类型获取大屏配置
 /// </summary>
 /// <returns></returns>
 public List <EnumModel> GetGalleryConfigByRegion(int regionId)
 {
     try
     {
         List <EnumModel>            enumList  = new List <EnumModel>();
         EnumModel                   enumModel = null;
         BaseRegionExtendConfigQuery query     = new BaseRegionExtendConfigQuery();
         BaseRegionExtendConfigDAL   dal       = new BaseRegionExtendConfigDAL();
         query.config_type = (int)EnumClass.RegionExtendConfigType.大屏;
         query.region_id   = regionId;
         List <BaseRegionExtendConfigModel> list = dal.GetRegionExtendConfigByRegionIdAndConfigType(query);
         foreach (BaseRegionExtendConfigModel model in list)
         {
             enumModel       = new EnumModel();
             enumModel.key   = model.id;
             enumModel.value = model.ext1;  //取屏的编号
             enumList.Add(enumModel);
         }
         return(enumList);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #3
0
 /// <summary>
 /// 根据园区ID和园区名称获取应急电话配置
 /// </summary>
 /// <param name="regionId"></param>
 /// <param name="regionName"></param>
 /// <returns></returns>
 public List <EmergencyPhoneTree> GetPhoneByRegionId(int regionId, string regionName)
 {
     try
     {
         List <EmergencyPhoneTree>   treeList  = new List <EmergencyPhoneTree>();
         BaseRegionExtendConfigDAL   regionDal = new BaseRegionExtendConfigDAL();
         BaseRegionExtendConfigQuery query     = new BaseRegionExtendConfigQuery();
         query.config_type = (int)EnumClass.RegionExtendConfigType.应急电话;
         query.region_id   = regionId;
         List <BaseRegionExtendConfigModel> regionConfigList = regionDal.GetRegionExtendConfigByRegionIdAndConfigType(query);
         int circle = 1;//定义循环变量起始值
         //赋值根节点
         EmergencyPhoneTree ztree = new EmergencyPhoneTree();
         ztree.id    = -1;
         ztree.name  = regionName;
         ztree.phone = "";
         ztree.pid   = -2;
         treeList.Add(ztree);
         //添加子节点
         if (regionConfigList != null && regionConfigList.Count > 0)
         {
             BaseRegionExtendConfigModel model      = regionConfigList.FirstOrDefault();
             List <EmergencyPhoneCustom> customList = TranXMLToObj(model.ext20);//将应急电话xml转化为对象
             for (int i = 0; i < customList.Count; i++)
             {
                 //将节点加入treeList集合
                 EmergencyPhoneTree tree = new EmergencyPhoneTree();
                 tree.id    = circle;
                 tree.name  = customList[i].groupName;
                 tree.phone = "";
                 tree.pid   = -1;
                 treeList.Add(tree);
                 circle++;
                 //将子节点加入treeList集合
                 for (int j = 0; j < customList[i].phoneList.Count; j++)
                 {
                     EmergencyPhoneTree trees = new EmergencyPhoneTree();
                     trees.id    = circle;
                     trees.pid   = tree.id;
                     trees.name  = customList[i].phoneList[j].phoneName;
                     trees.phone = customList[i].phoneList[j].phoneNum;
                     treeList.Add(trees);
                     circle++;
                 }
             }
         }
         return(treeList);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 /// <summary>
 /// 根据园区ID和配置类型获取当前第一条配置
 /// </summary>
 /// <param name="regionId"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public BaseRegionExtendConfigModel GetFirstRegionExtendConfigByRegionIdAndType(int regionId, int type)
 {
     try
     {
         BaseRegionExtendConfigDAL   regionExtendConfigDal = new BaseRegionExtendConfigDAL();
         BaseRegionExtendConfigQuery query = new BaseRegionExtendConfigQuery();
         query.config_type = type;
         query.region_id   = regionId;
         BaseRegionExtendConfigModel regionExtendConfig = regionExtendConfigDal.GetRegionExtendConfigByRegionIdAndConfigType(query).FirstOrDefault();
         return(regionExtendConfig);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #5
0
        /// <summary>
        /// 修改地图配置
        /// </summary>
        /// <param name="videoConfig">地图配置</param>
        /// <param name="path"></param>
        /// <returns></returns>
        public bool UpdateVideoConfig(VideoConfigCustom videoConfig)
        {
            try
            {
                bool          result  = false;
                StringBuilder builder = new StringBuilder();
                builder.Append("<?xml version = '1.0' encoding='utf-8'?><root><videoPlatform>" + videoConfig.videoPlatform + "</videoPlatform><serverIP>" + videoConfig.serverIP + "</serverIP><userName>" + videoConfig.userName + "</userName><userPwd>" + videoConfig.userPwd + "</userPwd></root>");
                string videoStr = builder.ToString();
                BaseRegionExtendConfigModel model = new BaseRegionExtendConfigModel();
                model.region_id   = videoConfig.regionId;
                model.config_type = (int)RegionExtendConfigType.视频配置;
                model.ext1        = videoStr;
                //根据园区id和配置类型查找配置
                BaseRegionExtendConfigQuery query = new BaseRegionExtendConfigQuery();
                query.region_id   = videoConfig.regionId;
                query.config_type = (int)RegionExtendConfigType.视频配置;
                List <BaseRegionExtendConfigModel> extlist = baseRegionExtendConfigDAL.GetRegionExtendConfigByRegionIdAndConfigType(query);
                int num = 0;
                //修改
                if (extlist.Count > 0)
                {
                    num = baseRegionExtendConfigDAL.UpdateRegionExtendConfigByRegionIdAndConfigType(model);
                }
                else
                {
                    //新增
                    num = baseRegionExtendConfigDAL.AddEntity(model);
                }

                if (num != 0)
                {
                    result = true;
                }
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #6
0
 /// <summary>
 /// 更新应急电话配置
 /// </summary>
 /// <param name="regionId"></param>
 /// <param name="info"></param>
 /// <returns></returns>
 public bool UpdatePhoneByRegionId(int regionId, string info)
 {
     try
     {
         List <EmergencyPhoneCustom> list = new List <EmergencyPhoneCustom>();
         string xml = TranObjToXml(list);
         BaseRegionExtendConfigDAL   regionDal = new BaseRegionExtendConfigDAL();
         BaseRegionExtendConfigQuery query     = new BaseRegionExtendConfigQuery();
         query.config_type = (int)EnumClass.RegionExtendConfigType.应急电话;
         query.region_id   = regionId;
         List <BaseRegionExtendConfigModel> regionConfigList = regionDal.GetRegionExtendConfigByRegionIdAndConfigType(query);
         int res = 0;
         if (regionConfigList != null && regionConfigList.Count > 0)
         {
             //含有该园区配置则进行修改
             BaseRegionExtendConfigModel telePhoneConfig = regionConfigList.FirstOrDefault();
             telePhoneConfig.config_type = (int)EnumClass.RegionExtendConfigType.应急电话;
             telePhoneConfig.ext20       = xml;
             telePhoneConfig.region_id   = regionId;
             res = regionDal.UpdateEntity(telePhoneConfig);
         }
         else
         {
             //未含有该园区配置进行新增
             BaseRegionExtendConfigModel telePhoneConfig = new BaseRegionExtendConfigModel();
             telePhoneConfig.config_type = (int)EnumClass.RegionExtendConfigType.应急电话;
             telePhoneConfig.ext20       = xml;
             telePhoneConfig.region_id   = regionId;
             res = regionDal.AddEntity(telePhoneConfig);
         }
         return(res > 0 ? true : false);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #7
0
 /// <summary>
 /// 通过园区获取园区应急电话配置
 /// </summary>
 /// <param name="regionId"></param>
 /// <returns></returns>
 public List <EmergencyPhoneCustom> GetEmergencyConfig(int regionId, out int configId)
 {
     try
     {
         List <EmergencyPhoneCustom> customList = new List <EmergencyPhoneCustom>();
         BaseRegionExtendConfigDAL   regionDal  = new BaseRegionExtendConfigDAL();
         BaseRegionExtendConfigQuery query      = new BaseRegionExtendConfigQuery();
         query.config_type = (int)EnumClass.RegionExtendConfigType.应急电话;
         query.region_id   = regionId;
         configId          = -1;
         List <BaseRegionExtendConfigModel> regionConfigList = regionDal.GetRegionExtendConfigByRegionIdAndConfigType(query);
         if (regionConfigList != null && regionConfigList.Count > 0)
         {
             BaseRegionExtendConfigModel model = regionConfigList.FirstOrDefault();
             configId   = model.id;
             customList = TranXMLToObj(model.ext20);//将应急电话xml转化为对象
         }
         return(customList);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }