コード例 #1
0
ファイル: DiyService.cs プロジェクト: phatnguyen81/vlsaomai
        public void DeleteDiyGroup(DiyGroup diyGroup)
        {
            if (diyGroup == null)
                throw new ArgumentNullException("diyGroup");

            diyGroup.Deleted = true;
            UpdateDiyGroup(diyGroup);

            //set a ParentDiyGroup property of the children to 0
            var subdiyProjectGroups = GetAllGroupsByParentGroupId(diyGroup.Id);
            foreach (var subdiyProjectGroup in subdiyProjectGroups)
            {
                subdiyProjectGroup.ParentGroupId = 0;
                UpdateDiyGroup(subdiyProjectGroup);
            }
        }
コード例 #2
0
ファイル: DiyService.cs プロジェクト: phatnguyen81/vlsaomai
        public void UpdateDiyGroup(DiyGroup diyGroup)
        {
            if (diyGroup == null)
                throw new ArgumentNullException("diyGroup");

            //validate diyProjectGroup hierarchy
            var parentDiyGroup = GetDiyGroupById(diyGroup.ParentGroupId);
            while (parentDiyGroup != null)
            {
                if (diyGroup.Id == parentDiyGroup.Id)
                {
                    diyGroup.ParentGroupId = 0;
                    break;
                }
                parentDiyGroup = GetDiyGroupById(parentDiyGroup.ParentGroupId);
            }

            _diyProjectGroupRepository.Update(diyGroup);

            //cache
            _cacheManager.RemoveByPattern(GROUPS_PATTERN_KEY);

            //event notification
            _eventPublisher.EntityUpdated(diyGroup);
        }
コード例 #3
0
        protected void UpdateLocales(DiyGroup diyGroup, DiyGroupModel model)
        {
            foreach (var localized in model.Locales)
            {
                _localizedEntityService.SaveLocalizedValue(diyGroup,
                                                               x => x.Name,
                                                               localized.Name,
                                                               localized.LanguageId);

                _localizedEntityService.SaveLocalizedValue(diyGroup,
                                                           x => x.Description,
                                                           localized.Description,
                                                           localized.LanguageId);

                _localizedEntityService.SaveLocalizedValue(diyGroup,
                                                           x => x.MetaKeywords,
                                                           localized.MetaKeywords,
                                                           localized.LanguageId);

                _localizedEntityService.SaveLocalizedValue(diyGroup,
                                                           x => x.MetaDescription,
                                                           localized.MetaDescription,
                                                           localized.LanguageId);

                _localizedEntityService.SaveLocalizedValue(diyGroup,
                                                           x => x.MetaTitle,
                                                           localized.MetaTitle,
                                                           localized.LanguageId);

                _localizedEntityService.SaveLocalizedValue(diyGroup,
                                                           x => x.SeName,
                                                           localized.SeName,
                                                           localized.LanguageId);
            }
        }
コード例 #4
0
ファイル: DiyService.cs プロジェクト: phatnguyen81/vlsaomai
        public void InsertDiyGroup(DiyGroup diyGroup)
        {
            if (diyGroup == null)
                throw new ArgumentNullException("diyGroup");

            _diyProjectGroupRepository.Insert(diyGroup);

            //cache
            _cacheManager.RemoveByPattern(GROUPS_PATTERN_KEY);

            //event notification
            _eventPublisher.EntityInserted(diyGroup);
        }
コード例 #5
0
 public static DiyGroup ToEntity(this DiyGroupModel model, DiyGroup destination)
 {
     return Mapper.Map(model, destination);
 }