Exemple #1
0
 /// <summary>
 /// 新增大屏配置
 /// </summary>
 /// <param name="regionId"></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 int AddGalleryConfig(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.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.AddEntity(model) > 0)  //新增并获得返回值
         //{
         //    return true;
         //}
         //else
         //{
         //    return false;
         //}
         return(regionExtendConfigDal.AddEntity(model));
     }
     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;
     }
 }
Exemple #3
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;
            }
        }
 /// <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;
     }
 }