Example #1
0
 /// <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;
     }
 }
Example #2
0
 /// <summary>
 /// 根据园区修改应急电话配置
 /// </summary>
 /// <param name="configId"></param>
 /// <param name="regionId"></param>
 /// <param name="xml"></param>
 /// <returns></returns>
 public int UpdateEmergencyConfig(int configId, int regionId, string xml)
 {
     try
     {
         BaseRegionExtendConfigDAL   dal   = new BaseRegionExtendConfigDAL();
         BaseRegionExtendConfigModel model = new BaseRegionExtendConfigModel();
         model.id          = configId;
         model.region_id   = regionId;
         model.config_type = (int)EnumClass.RegionExtendConfigType.应急电话;
         model.ext20       = xml;
         return(dal.UpdateEntity(model));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #3
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;
     }
 }