/// <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; } }
/// <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; } }
/// <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; } }
/// <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; } }
/// <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; } }