コード例 #1
0
        public AppMenuSettingEntity Clone(string deptId, string dpetName, string deptCode, List <AppSettingAssociationEntity> oldEntities, List <AppSettingAssociationEntity> newAssociationEntities)
        {
            AppMenuSettingEntity cloneEntity = new AppMenuSettingEntity()
            {
                Id           = Guid.NewGuid().ToString(),
                DeptId       = deptId,
                DeptCode     = deptCode,
                DeptName     = dpetName,
                Name         = this.Name,
                PlatformType = this.PlatformType,
                Remark       = this.Remark,
                Sort         = this.Sort,
                ThemeCode    = this.ThemeCode
            };

            //找到当前栏目对应的菜单

            oldEntities.Where(p => p.ColumnId == this.Id).ToList().ForEach(p =>
            {
                AppSettingAssociationEntity association = new AppSettingAssociationEntity()
                {
                    ColumnId   = cloneEntity.Id,
                    ColumnName = cloneEntity.Name,
                    DeptId     = deptId,
                    Id         = Guid.NewGuid().ToString(),
                    ModuleId   = p.ModuleId,
                    Sort       = p.Sort
                };
                newAssociationEntities.Add(association);
            });
            return(cloneEntity);
        }
コード例 #2
0
        /// <summary>
        /// 复制实体中的所有的数据,并生产一个新的实体
        /// 会生成主键
        /// </summary>
        /// <returns></returns>
        public AppMenuSettingEntity Clone(string deptId, string dpetName, string deptCode)
        {
            AppMenuSettingEntity cloneEntity = new AppMenuSettingEntity()
            {
                Id           = Guid.NewGuid().ToString(),
                DeptId       = deptId,
                DeptCode     = deptCode,
                DeptName     = dpetName,
                Name         = this.Name,
                PlatformType = this.PlatformType,
                Remark       = this.Remark,
                Sort         = this.Sort,
                ThemeCode    = this.ThemeCode
            };

            return(cloneEntity);
        }