/// <summary> /// 通过园区ID获取快速上大屏配置 /// </summary> /// <param name="regionId"></param> /// <returns></returns> public List <ScreenConfig> GetFastGalleryConfigByRegionId(int regionId) { try { BaseRegionExtendConfigBLL regionConfigbll = new BaseRegionExtendConfigBLL(); BaseRegionExtendConfigModel regionExtendConfig = regionConfigbll.GetFirstRegionExtendConfigByRegionIdAndType(regionId, (int)EnumClass.RegionExtendConfigType.大屏); //获取大屏配置 if (regionExtendConfig != null) { List <ScreenConfig> screenList = GetScreenListFromXML(regionExtendConfig.ext20);//解析大屏配置 if (screenList != null && screenList.Count > 0) { var fastScreen = screenList.Where(n => n.galleryType == (int)EnumClass.GalleryType.快速上大屏); //获取快速上大屏的屏 return(fastScreen == null ? null : fastScreen.ToList()); } else { return(null); } } else { return(null); } } catch (Exception ex) { throw ex; } }
/// <summary> /// 修改大屏配置 /// </summary> /// <param name="configId"></param> /// <param name="column"></param> /// <param name="row"></param> /// <param name="width"></param> /// <param name="height"></param> /// <param name="code"></param> /// <param name="galleryCode"></param> /// <param name="galleryName"></param> /// <param name="type"></param> /// <returns></returns> public bool UpdateGalleryConfig(int configId, int regionId, int column, int row, int width, int height, string code, string galleryCode, string galleryName, string type) { try { BaseRegionExtendConfigModel model = new BaseRegionExtendConfigModel(); List <ScreenConfig> screenConfigList = new List <ScreenConfig>(); ScreenConfig screen = null; //判断是否是单一屏配置 if (code.Contains(',')) { string[] codeArr = code.Split(','); string[] galleryCodeArr = galleryCode.Split(','); string[] galleryNameArr = galleryName.Split(','); string[] typeArr = type.Split(','); for (int i = 0; i < codeArr.Length; i++) { screen = new ScreenConfig(); screen.galleryCode = galleryCodeArr[i]; // screen.galleryName = galleryNameArr[i]; screen.galleryName = galleryNameArr[i] == "无绑定" ? "" : galleryNameArr[i]; screen.galleryType = int.Parse(typeArr[i]); screen.screenCode = codeArr[i]; screenConfigList.Add(screen); } } else { screen = new ScreenConfig(); screen.galleryCode = galleryCode; // screen.galleryName = galleryName; screen.galleryName = galleryName == "无绑定" ? "" : galleryName; screen.galleryType = int.Parse(type); screen.screenCode = code; screenConfigList.Add(screen); } string xml = GetConfigXmlByScreenList(screenConfigList); //将大屏配置转成xml文件 model.id = configId; model.region_id = regionId; model.config_type = (int)EnumClass.RegionExtendConfigType.大屏; model.ext1 = column.ToString(); model.ext2 = row.ToString(); model.ext3 = width.ToString(); model.ext4 = height.ToString(); model.ext20 = xml; if (regionExtendConfigDal.UpdateEntity(model) > 0) //修改并获得返回值 { return(true); } else { return(false); } } 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> /// 新增园区电话配置 /// </summary> /// <param name="regionId"></param> /// <param name="xml"></param> /// <returns></returns> public int AddEmergencyConfig(int regionId, string xml) { try { BaseRegionExtendConfigDAL dal = new BaseRegionExtendConfigDAL(); BaseRegionExtendConfigModel model = new BaseRegionExtendConfigModel(); model.region_id = regionId; model.config_type = (int)EnumClass.RegionExtendConfigType.应急电话; model.ext20 = xml; return(dal.AddEntity(model)); } 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> /// 根据园区ID获取大屏配置 /// </summary> /// <param name="regionId"></param> /// <returns></returns> public LargeScreenCustom GetLargeScreenConfig(int regionId) { try { BaseRegionExtendConfigBLL regionConfigbll = new BaseRegionExtendConfigBLL(); //BaseRegionExtendConfigQuery query = new BaseRegionExtendConfigQuery(); //query.config_type = (int)EnumClass.RegionExtendConfigType.大屏; //query.region_id = regionId; // BaseRegionExtendConfigModel regionExtendConfig = regionExtendConfigDal.GetRegionExtendConfigByRegionIdAndConfigType(query).FirstOrDefault(); BaseRegionExtendConfigModel regionExtendConfig = regionConfigbll.GetFirstRegionExtendConfigByRegionIdAndType(regionId, (int)EnumClass.RegionExtendConfigType.大屏); if (regionExtendConfig != null) { LargeScreenCustom screen = new LargeScreenCustom(); screen.id = regionExtendConfig.id; screen.column = int.Parse(regionExtendConfig.ext1); screen.row = int.Parse(regionExtendConfig.ext2); screen.width = int.Parse(regionExtendConfig.ext3); screen.height = int.Parse(regionExtendConfig.ext4); screen.screenList = GetScreenListFromXML(regionExtendConfig.ext20); screen.galleryList = GetGalleryList(regionId); return(screen); } else { LargeScreenCustom screen = new LargeScreenCustom(); screen.id = 0; screen.column = 0; screen.row = 0; screen.width = 0; screen.height = 0; screen.screenList = null; screen.galleryList = GetGalleryList(regionId); return(screen); } } catch (Exception ex) { throw ex; } }
/// <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; } }
/// <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; } }