示例#1
0
 /// <summary>
 /// 转换为数据传输对象
 /// </summary>
 /// <param name="entity">实体</param>
 public static WctAppMstrDto ToDto(this WctAppMstr entity)
 {
     if (entity == null)
     {
         return(new WctAppMstrDto());
     }
     return(new WctAppMstrDto {
         Id = entity.Id,
         APP_KEY = entity.APP_KEY,
         APP_NAME = entity.APP_NAME,
         WCT_MODULE_ID = entity.WCT_MODULE_ID,
         CREATE_PSN = entity.CREATE_PSN,
         CREATE_DATE = entity.CREATE_DATE,
         UPDATE_PSN = entity.UPDATE_PSN,
         UPDATE_DATE = entity.UPDATE_DATE,
         DEL_FLAG = entity.DEL_FLAG,
         BU_NO = entity.BU_NO,
         BG_NO = entity.BG_NO,
         WCT_APP_URL = entity.WCT_APP_URL,
         WCT_MODULE_TYPE = entity.WCT_MODULE_TYPE,
         SYS_MODULE_IDS = entity.SYS_MODULE_IDS,
         UDF1 = entity.UDF1,
         UDF2 = entity.UDF2,
         UDF3 = entity.UDF3,
         UDF4 = entity.UDF4,
         UDF5 = entity.UDF5,
         APP_SORT = entity.APP_SORT
     });
 }
示例#2
0
        public ReturnMsg AddOrUpdateAppMstrInfo(WctAppMstrDto dto, ReturnMsg rm)
        {
            var entity = new WctAppMstr();
            var isAdd  = string.IsNullOrEmpty(dto.Id) ? true : false;

            if (string.IsNullOrEmpty(dto.Id))
            {
                dto.Id      = Guid.NewGuid().ToString("N");
                dto.APP_KEY = "primary";
                _initHelper.InitAdd(dto, AbpSession.USR_ID, AbpSession.ORG_NO, AbpSession.BG_NO);
                using (var unitOfWork = _unitOfWorkManager.Begin(TransactionScopeOption.RequiresNew))
                {
                    entity = dto.ToEntity();
                    _wctAppMstrRepository.Insert(entity);
                    unitOfWork.Complete();
                }
            }
            else
            {
                _initHelper.InitUpdate(dto, AbpSession.USR_ID);
                using (var unitOfWork = _unitOfWorkManager.Begin(TransactionScopeOption.RequiresNew))
                {
                    entity = dto.ToEntity();
                    _wctAppMstrRepository.Update(entity);
                    unitOfWork.Complete();
                }
            }
            if (dto.WCT_MODULE_TYPE == "1")
            {
                var appItem = new WctAppItem();
                if (!isAdd)
                {
                    using (var unitOfWork = _unitOfWorkManager.Begin(TransactionScopeOption.RequiresNew))
                    {
                        _wctAppItemRepository.DelAppItemInfo(dto.Id);
                        unitOfWork.Complete();
                    }
                }
                var i = 1;
                foreach (var item in dto.appItemList)
                {
                    item.Id        = Guid.NewGuid().ToString("N");
                    item.ITEM_SORT = i;
                    _initHelper.InitAdd(item, AbpSession.USR_ID, AbpSession.ORG_NO, AbpSession.BG_NO);
                    using (var unitOfWork = _unitOfWorkManager.Begin(TransactionScopeOption.RequiresNew))
                    {
                        appItem = item.ToEntity();
                        _wctAppItemRepository.Insert(appItem);
                        unitOfWork.Complete();
                    }
                }
            }
            rm.IsSuccess = true;

            return(rm);
        }