Beispiel #1
0
        /// <summary>
        /// 获取备用域名集合
        /// </summary>
        /// <returns></returns>
        private List <WebSiteForUrlEntity> GetSpareUrlAddress()
        {
            List <WebSiteForUrlEntity> webSiteForUrlEntitys = new List <WebSiteForUrlEntity>();
            List <string> strsUrlAddress = new List <string>();

            for (int i = 1; i <= 10; i++)
            {
                WebSiteForUrlEntity webSiteForUrlEntity = new WebSiteForUrlEntity();
                webSiteForUrlEntity.SortCode = i;
                webSiteForUrlEntity.MainMark = false;
                string paraNames = "SpareUrlAddress";
                if (i != 10)
                {
                    paraNames = paraNames + "0" + i;
                }
                else
                {
                    paraNames = paraNames + i;
                }
                string strurlAddress = HttpContext.Request[paraNames];
                if (strurlAddress != null)
                {
                    strurlAddress = strurlAddress.Trim();
                    if (strurlAddress == "&nbsp;")
                    {
                        strurlAddress = "";
                    }
                }
                webSiteForUrlEntity.UrlAddress = strurlAddress;
                webSiteForUrlEntitys.Add(webSiteForUrlEntity);
            }
            return(webSiteForUrlEntitys);
        }
Beispiel #2
0
        /// <summary>
        /// 根据域名获取实体
        /// </summary>
        /// <returns></returns>
        public WebSiteEntity GetModelByUrlHost(string urlHost)
        {
            WebSiteEntity       webSiteEntity       = new WebSiteEntity();
            WebSiteForUrlEntity webSiteForUrlEntity = serviceWebSiteForUrl.IQueryable(m => m.UrlAddress == urlHost && m.DeleteMark != true).FirstOrDefault();

            if (webSiteForUrlEntity != null && !string.IsNullOrEmpty(webSiteForUrlEntity.WebSiteId))
            {
                webSiteEntity = service.FindEntity(webSiteForUrlEntity.WebSiteId);
            }

            return(webSiteEntity);
        }
Beispiel #3
0
        /// <summary>
        /// 保存备用域名
        /// </summary>
        /// <param name="moduleEntity"></param>
        /// <param name="webSiteForUrlEntitys"></param>
        /// <param name="keyValue"></param>
        /// <param name="db"></param>
        private void SaveWebSiteForUrl(WebSiteEntity moduleEntity, List <WebSiteForUrlEntity> webSiteForUrlEntitys, string keyValue, IRepositoryBase db)
        {
            //保存备用域名
            if (webSiteForUrlEntitys != null && webSiteForUrlEntitys.Count() > 0)
            {
                webSiteForUrlEntitys.ForEach(m => m.WebSiteId = keyValue);

                WebSiteForUrlEntity webSiteForUrlEntity = new WebSiteForUrlEntity();
                webSiteForUrlEntity.SortCode   = 0;
                webSiteForUrlEntity.MainMark   = true;
                webSiteForUrlEntity.WebSiteId  = keyValue;
                webSiteForUrlEntity.UrlAddress = moduleEntity.UrlAddress;
                webSiteForUrlEntitys.Add(webSiteForUrlEntity);
                if (webSiteForUrlEntitys != null && webSiteForUrlEntitys.Count > 0)
                {
                    foreach (var webSiteForUrlEntityT in webSiteForUrlEntitys)
                    {
                        webSiteForUrlEntityT.UrlAddress = webSiteForUrlEntityT.UrlAddress.Trim();

                        WebSiteForUrlEntity TwebSiteForUrlEntity = iWebSiteForUrlRepository.IQueryable(m => m.DeleteMark != true && m.WebSiteId == webSiteForUrlEntityT.WebSiteId && m.SortCode == webSiteForUrlEntityT.SortCode).FirstOrDefault();
                        string TwebIds = string.Empty;
                        if (TwebSiteForUrlEntity != null)
                        {
                            TwebIds = TwebSiteForUrlEntity.Id;
                        }
                        if (TwebSiteForUrlEntity != null && !string.IsNullOrEmpty(TwebSiteForUrlEntity.Id))
                        {
                            TwebSiteForUrlEntity.Modify(TwebSiteForUrlEntity.Id);
                            TwebSiteForUrlEntity.UrlAddress = webSiteForUrlEntityT.UrlAddress;
                            db.Update(TwebSiteForUrlEntity);
                        }
                        else
                        {
                            webSiteForUrlEntityT.Create();
                            db.Insert(webSiteForUrlEntityT);
                        }
                    }
                }
            }
        }