コード例 #1
0
 public bool CreateWebsite(EwhWebsite ewhWebsite)
 {
     if (!CheckValidWebsite(ewhWebsite))
     {
         return(false);
     }
     ewhWebsite.Create();
     return(true);
 }
コード例 #2
0
 public bool UpdateWebsite(EwhWebsite website)
 {
     if (!CheckValidWebsite(website))
     {
         return(false);
     }
     website.Save();
     website.SelfSync();
     return(true);
 }
コード例 #3
0
        private bool CheckValidWebsite(EwhWebsite website)
        {
            var     owner = website.Accounts.FirstOrDefault(x => x.AccessLevels.Contains(AccessLevels.Owner.ToString()));
            Account accountAsOwner;

            if (owner == null)
            {
                this.EwhStatus = GlobalStatus.HaveNoAnOwner;
                return(false);
            }
            return(true);
        }
コード例 #4
0
 public WebsiteInfoDto(EwhWebsite entity)
 {
     this.WebsiteId      = entity.WebsiteId;
     this.Name           = entity.Name;
     this.DisplayName    = entity.DisplayName;
     this.Url            = entity.Url;
     this.WebTemplateId  = entity.WebTemplateId;
     this.WebsiteType    = entity.WebsiteType;
     this.Source         = entity.Source;
     this.Git            = entity.Git;
     this.CreateDate     = entity.CreatedDate;
     this.RepositoryName = entity.RepositoryName;
 }
コード例 #5
0
        public Website ToEntity(Website website, EwhWebsite ewhWebsite)
        {
            website.DisplayName    = ewhWebsite.DisplayName;
            website.Name           = StringUtils.GetSeName(string.IsNullOrEmpty(ewhWebsite.Name)? ewhWebsite.DisplayName: ewhWebsite.Name);
            website.Url            = ewhWebsite.Url;
            website.Stagging       = ewhWebsite.Stagging;
            website.Production     = ewhWebsite.Production;
            website.Accounts       = ewhWebsite.Accounts;
            website.WebTemplateId  = ewhWebsite.WebTemplateId;
            website.WebsiteType    = ewhWebsite.WebsiteType;
            website.Source         = ewhWebsite.Source;
            website.Git            = ewhWebsite.Git;
            website.LastModifyDate = ewhWebsite.LastModifyDate;

            return(website);
        }
コード例 #6
0
        public EwhWebsite ToEntity(EwhWebsite entity)
        {
            entity.WebsiteId     = this.WebsiteId;
            entity.Name          = this.Name;
            entity.DisplayName   = this.DisplayName;
            entity.Url           = this.Url;
            entity.WebTemplateId = this.WebTemplateId;
            entity.WebsiteType   = this.WebsiteType;
            entity.Source        = this.Source;
            entity.Git           = this.Git;

            entity.Accounts   = this.Accounts;
            entity.Stagging   = this.Stagging;
            entity.Production = this.Production;
            return(entity);
        }
コード例 #7
0
        public bool CreateWebsite(CreateWebsiteDto dto)
        {
            var ewhWebsite = new EwhWebsite(_websiteRepository, _accountRepository, _ewhMapper, _entityFactory);

            ewhMapper.ToEntity(ewhWebsite, dto);
            ewhWebsite.WebsiteType = WebsiteTypes.Free.ToString();
            var check = false;

            // create website
            if (ewhWebsite.Create())
            {
                check = true;
                ewhWebsite.InitGogSource();
                EwhWebsiteAdded = ewhWebsite;
            }
            SyncStatus(this, ewhWebsite);
            return(check);
        }
コード例 #8
0
        public EwhWebsite ToEntity(EwhWebsite ewhWebsite, CreateWebsiteDto dto)
        {
            ewhWebsite.DisplayName   = dto.DisplayName;
            ewhWebsite.Url           = dto.Url;
            ewhWebsite.Name          = dto.Name;
            ewhWebsite.WebTemplateId = dto.WebTemplateId;

            var listWebsiteAccountAccessLevel = new List <AccountsAccessLevelOfWebsite>();

            if (dto.Accounts != null)
            {
                foreach (var item in dto.Accounts)
                {
                    var waal = this.ToEntity(new AccountsAccessLevelOfWebsite(), item);
                    listWebsiteAccountAccessLevel.Add(waal);
                }
            }
            ewhWebsite.Accounts = listWebsiteAccountAccessLevel;
            return(ewhWebsite);
        }
コード例 #9
0
 public WebsiteDetailDto(EwhWebsite entity) : base(entity)
 {
     this.Stagging   = entity.Stagging;
     this.Production = entity.Production;
     this.Accounts   = entity.Accounts;
 }
コード例 #10
0
 public NyWebsiteInfoDto(EwhWebsite entity, string userId) : base(entity)
 {
     this.AccessLevels = entity.Accounts.Where(x => x.AccountId == userId).Select(x => x.AccessLevels).FirstOrDefault();
 }