/// <summary> /// Creates the site. /// </summary> /// <param name="row">The row.</param> /// <returns></returns> public static CmsSite CreateSite(SiteDto.SiteRow row) { CmsSite site = new CmsSite(); site.Description = row.Description; if (String.IsNullOrEmpty(row.Domain)) { string rowDomain = row.Domain.Replace("\r\n", "\n"); string[] domains = rowDomain.Split(new char[] { '\n' }); site.Domains = domains; } site.ID = row.SiteId; site.Name = row.Name; // Add attributes site.Attributes = new StringDictionary(); foreach (SiteDto.main_GlobalVariablesRow varRow in row.Getmain_GlobalVariablesRows()) { site.Attributes.Add(varRow.KEY, varRow.VALUE); } return(site); }
public static Dictionary<Guid, CmsSite> GetSites() { var context = new DataContext(); var sites = context.Sites.ToList(); if (!sites.Any()) { var site = AddStandardSite(context); sites.Add(site); } var siteList = new Dictionary<Guid, CmsSite>(); foreach (var site in sites) { var cmsSite = new CmsSite { SiteId = site.SiteId, Author = site.Author, ChildSortDirection = site.ChildSortDirection, ChildSortOrder = site.ChildSortOrder, Name = site.Name, UpdateDate = site.UpdateDate, Property = PropertyData.GetPropertiesForSite(site.SiteId, Language.CurrentLanguageId, context) }; siteList.Add(site.SiteId, cmsSite); } return siteList; }
public static CmsSite SaveSite(CmsSite obj) { BaseService.CheckSite(); if (SessionObject.CurrentBitplateUser == null) { HttpContext.Current.Response.Redirect("~/_bitplate/Login.aspx?SessionExpired=true"); } obj.Save(); //foreach (CmsLanguage lang in SessionObject.CurrentSite.Languages) //{ // lang.Delete(); //} SessionObject.CurrentSite = obj; //bij wijzigingen in veld licentiecode if (SessionObject.CurrentLicense != null && SessionObject.CurrentLicense.Code != obj.LicenceCode) { //herladen van licentie moet worden afgedwongen SessionObject.CurrentLicense = SessionObject.LoadLicense(); } SessionObject.CurrentSite.IsValidLicense = (SessionObject.CurrentLicense != null); return(SessionObject.CurrentSite); }
public void DropDataCollectionEnvironmentTables(CmsSite site, CmsSiteEnvironment newEnvironment) { //bool ValidQuery = false; //string sql = "SET FOREIGN_KEY_CHECKS = 0;\r\nDROP TABLE IF EXISTS "; //foreach (string tableName in this.GetAllTables()) //{ // if (tableName.ToLower().StartsWith("data")) // { // sql += newEnvironment.DatabaseName + "." + tableName + ",\r\n"; // ValidQuery = true; // } //} //sql = sql.Substring(0, sql.Length - 3); //sql += ";\r\nSET FOREIGN_KEY_CHECKS = 1;"; //if (ValidQuery) //{ // DataBase.Get().Execute(sql); //} DataBase.Get().Execute("SET foreign_key_checks = 0;"); foreach (DatabaseTableDefinition table in this.DataCollectionTables) { string sql = String.Format(@"DROP TABLE IF EXISTS {0}." + table.Name + ";", newEnvironment.DatabaseName, site.ID); DataBase.Get().Execute(sql); } DataBase.Get().Execute("SET foreign_key_checks = 1;"); }
public static Dictionary <Guid, CmsSite> GetSites() { var context = new DataContext(); var sites = context.Sites.ToList(); if (!sites.Any()) { var site = AddStandardSite(context); sites.Add(site); } var siteList = new Dictionary <Guid, CmsSite>(); foreach (var site in sites) { var cmsSite = new CmsSite { SiteId = site.SiteId, Author = site.Author, ChildSortDirection = site.ChildSortDirection, ChildSortOrder = site.ChildSortOrder, Name = site.Name, UpdateDate = site.UpdateDate, Property = PropertyData.GetPropertiesForSite(site.SiteId, Language.CurrentLanguageId, context) }; siteList.Add(site.SiteId, cmsSite); } return(siteList); }
//private string[] CreateSubscriber(string[] data, NewsletterImportDefinition obj, int[] importProgress)//BaseCollection<NewsletterGroup> newsGroups //{ // string[] log = new string[6]; // BaseCollection<NewsletterSubscriber> subscribers = BaseCollection<NewsletterSubscriber>.Get("FK_Site = '" + SessionObject.CurrentSite.ID.ToString() + "' AND Email = '" + data[obj.EmailColumnNo].Trim() + "'"); // NewsletterSubscriber subscriber; // var existingSubscriber = subscribers.Where(b => b.Email == data[obj.EmailColumnNo]).FirstOrDefault();//Where(b => b.Name == data[obj.NameColumnNo]).FirstOrDefault(); // if (existingSubscriber == null) // { // if (EmailManager.isValidEmailAddress(data[obj.EmailColumnNo].Trim())) // { // if (isValidDataLength(obj, data) == true) // { // subscriber = new NewsletterSubscriber(); // subscriber.Site = SessionObject.CurrentSite; // subscriber.Email = data[obj.EmailColumnNo].Trim(); // subscriber.Confirmed = (obj.AutoConfirm); // if (obj.ForeNameColumn != "" && obj.ForeNameColumnNo != 9999) subscriber.ForeName = data[obj.ForeNameColumnNo]; // if (obj.NameColumn != "" && obj.NameColumnNo != 9999) subscriber.Name = data[obj.NameColumnNo]; // if (obj.NamePrefixColumn != "" && obj.NamePrefixColumnNo != 9999) subscriber.NamePrefix = data[obj.NamePrefixColumnNo]; // //subscriber.Gender = data[obj.GenderCoumnNo] // ERROR: cannot convert string/int > sexeEnum // subscriber.SubscribedGroups.AddRange(obj.Groups); // subscriber.Save(); // log[0] = importProgress[0].ToString(); // if (obj.NameColumnNo != 9999) log[1] = data[obj.NameColumnNo]; // log[2] = data[obj.EmailColumnNo]; // log[3] = "Geimporteerd"; // log[4] = importProgress[1].ToString(); // log[5] = true.ToString(); // } // else // { // string tooLong = "Het "; // if (obj.EmailColumnNo != 9999) // { // if (data[obj.EmailColumnNo].ToString().Length > 50) // { // tooLong += "email adres, "; // } // } // if (obj.NameColumnNo != 9999) // { // if (data[obj.NameColumnNo].ToString().Length > 150) // { // tooLong += "achternaam, "; // } // } // if (obj.ForeNameColumnNo != 9999) // { // if (data[obj.ForeNameColumnNo].ToString().Length > 250) // { // tooLong += "voornaam, "; // } // } // if (obj.NamePrefixColumnNo != 9999) // { // if (data[obj.NamePrefixColumnNo].ToString().Length > 25) // { // tooLong += "tussenvoegsel, "; // } // } // log[0] = importProgress[0].ToString(); // if (obj.NameColumnNo != 9999) log[1] = data[obj.NameColumnNo]; // log[2] = data[obj.EmailColumnNo]; // log[3] = tooLong += "is te lang"; // log[4] = importProgress[1].ToString(); // log[5] = false.ToString(); // } // } // else // { // log[0] = importProgress[0].ToString(); // if (obj.NameColumnNo != 9999) log[1] = data[obj.NameColumnNo]; // log[2] = data[obj.EmailColumnNo]; // log[3] = "Geen geldig email adres"; // log[4] = importProgress[1].ToString(); // log[5] = false.ToString(); // } // } // else if (existingSubscriber != null && obj.SkipDoubleRecords == false) // { // if (EmailManager.isValidEmailAddress(data[obj.EmailColumnNo].Trim()) && isValidDataLength(obj, data) == true) // { // if (obj.AppendGroups == true) // { // for (int i = 0; i < existingSubscriber.SubscribedGroups.Count(); i++) // { // for (int j = 0; j < obj.Groups.Count(); j++) // { // if (obj.Groups[j].ID == existingSubscriber.SubscribedGroups[i].ID) // { // obj.Groups.RemoveAt(j); // break; // } // } // } // } // /* subscriber = new NewsletterSubscriber(); // subscriber.Site = SessionObject.CurrentSite; // subscriber.Email = data[obj.EmailColumnNo].Trim(); // subscriber.Confirmed = (obj.AutoConfirm); // subscriber.ForeName = data[obj.ForeNameColumnNo]; // subscriber.Name = data[obj.NameColumnNo]; // subscriber.NamePrefix = data[obj.NamePrefixColumnNo]; // //subscriber.Gender = data[obj.GenderColumnNo]; // ERROR: cannot convert string/int > sexeEnum // subscriber.SubscribedGroups.AddRange(obj.Groups); // subscriber.Save();*/ // existingSubscriber.Site = SessionObject.CurrentSite; // existingSubscriber.Confirmed = (obj.AutoConfirm); // if (obj.ForeNameColumn != "" && obj.ForeNameColumnNo != 9999) // { // existingSubscriber.ForeName = data[obj.ForeNameColumnNo]; // } // else { existingSubscriber.ForeName = ""; } // if (obj.NameColumn != "" && obj.NameColumnNo != 9999) // { // existingSubscriber.Name = data[obj.NameColumnNo]; // } // else { existingSubscriber.Name = ""; } // if (obj.NamePrefixColumn != "" && obj.NamePrefixColumnNo != 9999) // { // existingSubscriber.NamePrefix = data[obj.NamePrefixColumnNo]; // } // else { existingSubscriber.NamePrefix = ""; } // if (obj.AppendGroups == false) existingSubscriber.SubscribedGroups.Clear(); // if (existingSubscriber.SubscribedGroups != obj.Groups) // existingSubscriber.SubscribedGroups.AddRange(obj.Groups); // existingSubscriber.Save(); // log[0] = importProgress[0].ToString(); // if (obj.NameColumnNo != 9999) log[1] = data[obj.NameColumnNo]; // log[2] = data[obj.EmailColumnNo]; // log[3] = "Abonnee bestaat al. overschreven"; // log[4] = importProgress[1].ToString(); // log[5] = true.ToString(); // } // else if (isValidDataLength(obj, data) == false) // { // string tooLong = "Het "; // if (obj.EmailColumnNo != 9999) // { // if (data[obj.EmailColumnNo].ToString().Length > 50) // { // tooLong += "email adres, "; // } // } // if (obj.NameColumnNo != 9999) // { // if (data[obj.NameColumnNo].ToString().Length > 150) // { // tooLong += "achternaam, "; // } // } // if (obj.ForeNameColumnNo != 9999) // { // if (data[obj.ForeNameColumnNo].ToString().Length > 250) // { // tooLong += "voornaam, "; // } // } // if (obj.NamePrefixColumnNo != 9999) // { // if (data[obj.NamePrefixColumnNo].ToString().Length > 25) // { // tooLong += "tussenvoegsel, "; // } // } // log[0] = importProgress[0].ToString(); // if (obj.NameColumnNo != 9999) log[1] = data[obj.NameColumnNo]; // log[2] = data[obj.EmailColumnNo]; // log[3] = tooLong += "is te lang"; // log[4] = importProgress[1].ToString(); // log[5] = false.ToString(); // } // else // { // log[0] = importProgress[0].ToString(); // if (obj.NameColumnNo != 9999) log[1] = data[obj.NameColumnNo]; // log[2] = data[obj.EmailColumnNo]; // log[3] = "Geen geldig email adres"; // log[4] = importProgress[1].ToString(); // log[5] = false.ToString(); // } // } // else // { // log[0] = importProgress[0].ToString(); // if (obj.NameColumnNo != 9999) log[1] = data[obj.NameColumnNo]; // log[2] = data[obj.EmailColumnNo]; // log[3] = "Dubbele abonnee is overgeslagen"; // log[4] = importProgress[1].ToString(); // log[5] = true.ToString(); // } // return log; //} public void SendVerificationEmail(NewsletterSubscriber subscriber) { CmsSite site = SessionObject.CurrentSite; string content = ReplaceVerificationEmailTags(site.NewsletterOptInEmailContent, subscriber); //content = content.Replace("[OPTINURL]", site.DomainName + "/" + site.NewsletterOptInEmailPage.LastPublishedUrl + "?subsciber=" + subscriber.ID.ToString()); EmailManager.SendMail(site.NewsletterSender, subscriber.Email, site.NewsletterOptInEmailSubject, content, true); }
private void SendVerificationEmail(NewsletterSubscriber subscriber) { CmsSite site = SessionObject.CurrentSite; string content = site.NewsletterOptInEmailContent; content = content.Replace("[verificatielink]", "<a href=\"" + site.DomainName + "/" + site.NewsletterOptInEmailPage.LastPublishedUrl + "?svid=" + subscriber.ID.ToString() + "\" >").Replace("[/verificatielink]", "</a>"); EmailManager.SendMail(site.NewsletterSender, subscriber.Email, site.NewsletterOptInEmailSubject, content, true); }
public void CloneDataCollectionEnvironmentTables(CmsSite site, CmsSiteEnvironment currentEnvorinment, CmsSiteEnvironment newEnvironment) { foreach (DatabaseTableDefinition table in this.DataCollectionTables) { string sql = String.Format(@"CREATE TABLE IF NOT EXISTS {0}." + table.Name + " LIKE {1}." + table.Name + ";", newEnvironment.DatabaseName, currentEnvorinment.DatabaseName, site.ID); DataBase.Get().Execute(sql); } }
public PublicSite(CmsSite site) { ChildSortDirection = site.ChildSortDirection; ChildSortOrder = site.ChildSortOrder; StartPageId = SiteSettings.Instance.StartPageId; Properties = site.Property.ToDictionary(x => x.PropertyName, x => x.PropertyData); }
public static bool PublishSite(string environmentID, bool cleanUp, bool publishPages, bool publishFilesAndImages, bool publishData, bool publishBin, bool reGenerateSearchIndex, bool reGenerateSitemap) { BaseService.CheckLoginAndLicense(); CmsSite site = SessionObject.CurrentSite; bool returnValue = site.Publish(new Guid(environmentID), cleanUp, publishPages, publishFilesAndImages, publishData, publishBin, reGenerateSearchIndex, reGenerateSitemap); return(returnValue); }
private static void Clone(CmsSite source, CmsSite destination) { destination.SiteId = source.SiteId; destination.Author = source.Author; destination.ChildSortDirection = source.ChildSortDirection; destination.ChildSortOrder = source.ChildSortOrder; destination.Name = source.Name; destination.UpdateDate = source.UpdateDate; destination.Property = source.Property; }
private static CmsSite GetSite() { CmsSite returnValue = null; if (HttpContext.Current.Session["CurrentSite"] != null) { returnValue = (CmsSite)HttpContext.Current.Session["CurrentSite"]; } return(returnValue); }
public static BaseCollection <UnpublishedItem> GetUnpublishedItemsPerType(string type, string sort, int page, int pagesize) { BaseService.CheckLoginAndLicense(); CmsSite site = SessionObject.CurrentSite; string where = String.Format("FK_Site = '{0}' AND Type='{1}'", site.ID, type); BaseCollection <UnpublishedItem> items = BaseCollection <UnpublishedItem> .Get(where, sort, page, pagesize); return(items); }
/// <summary> /// Gets the site. /// </summary> /// <param name="siteId">The site id.</param> /// <param name="responseGroup">The response group.</param> /// <returns></returns> internal static CmsSite GetSite(Guid siteId, SiteResponseGroup responseGroup) { // Assign new cache key, specific for site guid and response groups requested string cacheKey = CmsCache.CreateCacheKey("site-object", siteId.ToString(), responseGroup.CacheKey); CmsSite site = null; // check cache first object cachedObject = CmsCache.Get(cacheKey); if (cachedObject != null) { site = (CmsSite)cachedObject; } // Load the object if (site == null) { lock (CmsCache.GetLock(cacheKey)) { cachedObject = CmsCache.Get(cacheKey); if (cachedObject != null) { site = (CmsSite)cachedObject; } else { SiteDto siteDto = GetSite(siteId); // Load main site parameters site = ObjectHelper.CreateSite(siteDto.Site[0]); // Load menus if (responseGroup.ContainsGroup(SiteResponseGroup.ResponseGroup.Full) || responseGroup.ContainsGroup(SiteResponseGroup.ResponseGroup.Menus)) { List <SiteMenu> menuList = new List <SiteMenu>(); MenuDto menuDto = MenuManager.GetMenuDto(siteId); foreach (MenuDto.MenuRow row in menuDto.Menu) { menuList.Add(ObjectHelper.CreateMenu(menuDto, row)); } site.Menus = menuList.ToArray(); } // Insert to the cache collection CmsCache.Insert(cacheKey, site, CmsConfiguration.Instance.Cache.SitesCollectionTimeout); } } } return(site); }
public async Task <ApiResult <string> > SaveSite([FromBody] CmsSite parm) { if (!string.IsNullOrEmpty(parm?.Guid)) { return(await _siteService.UpdateAsync(parm)); } else { parm.Guid = Guid.NewGuid().ToString(); return(await _siteService.AddAsync(parm)); } }
public async Task <IActionResult> UpdateNowSite([FromBody] CmsSite parm) { var menuSaveType = _config[KeyHelper.LOGINAUTHORIZE]; if (menuSaveType == "Redis") { await _cache.SetAsync(KeyHelper.NOWSITE, parm); } else { await _cache.SetAsync(KeyHelper.NOWSITE, parm); } return(Ok(new ApiResult <string>())); }
public IActionResult UpdateNowSite([FromBody] CmsSite parm) { var menuSaveType = ConfigExtensions.Configuration[KeyHelper.LOGINAUTHORIZE]; if (menuSaveType == "Redis") { RedisHelper.Set(KeyHelper.NOWSITE, parm); } else { MemoryCacheService.Default.SetCache(KeyHelper.NOWSITE, parm); } return(Ok(new ApiResult <string>())); }
public void OnGet() { //获得站点信息 if (_cacheService.Exists(CacheKey.WEBCMSSITE)) { Site = _cacheService.GetCache <CmsSite>(CacheKey.WEBCMSSITE); } else { Site = _siteService.GetModelAsync(m => m.Guid == "78756a6c-50c8-47a5-b898-5d6d24a20327").Result.data; //加入到缓存 _cacheService.SetCache(CacheKey.WEBCMSSITE, Site, DateTimeOffset.Now.AddDays(30)); } }
internal static void SetSiteObject() { string siteID = ConfigurationManager.AppSettings["SiteID"]; if (siteID != null && siteID != "") { CmsSite site = BaseObject.GetById <CmsSite>(new Guid(siteID)); if (site != null) { site.CurrentWorkingEnvironment = SessionObject.GetWorkingEnvironment(new Guid(siteID)); } HttpContext.Current.Session["CurrentSite"] = site; } }
public void InsertEnvironmentDataInTables(CmsSite site, CmsSiteEnvironment currentEnvorinment, CmsSiteEnvironment newEnvironment) { DataBase.Get().Execute("SET foreign_key_checks = 0;"); string sql; foreach (DatabaseTableDefinition tableDef in this.SiteTables) { if (tableDef.Name == "eventlog") { continue; } if (!tableDef.isManyToManyLinkTable) { if (tableDef.Name == "site") { sql = String.Format(@"INSERT INTO {0}." + tableDef.Name + " SELECT * FROM {1}." + tableDef.Name + " WHERE ID='{2}';", newEnvironment.DatabaseName, currentEnvorinment.DatabaseName, site.ID); DataBase.Get().Execute(sql); } else { sql = String.Format(@"INSERT INTO {0}." + tableDef.Name + " SELECT * FROM {1}." + tableDef.Name + " WHERE FK_Site='{2}';", newEnvironment.DatabaseName, currentEnvorinment.DatabaseName, site.ID); DataBase.Get().Execute(sql); } } else { sql = String.Format(@"INSERT INTO {0}.{2} SELECT * FROM {1}.{2} WHERE EXISTS(SELECT * FROM {1}.{3} WHERE {1}.{3}.FK_Site='{5}' AND {1}.{3}.ID = {1}.{2}.{4})", newEnvironment.DatabaseName, currentEnvorinment.DatabaseName, tableDef.Name, tableDef.ParentTableName, tableDef.ForeignKey, site.ID); DataBase.Get().Execute(sql); } } ////modules references //sql = String.Format(@"INSERT INTO {0}.moduleperpage SELECT * FROM {1}.moduleperpage WHERE EXISTS(SELECT * FROM {1}.page WHERE {1}.page.FK_Site='{2}' AND {1}.page.ID = {1}.moduleperpage.FK_Page)", newEnvironment.DataBaseName, currentEnvorinment.DataBaseName, site.ID); //DataBase.Get().Execute(sql); ////scripts references ////per template //sql = String.Format(@"INSERT INTO {0}.scriptpertemplate SELECT * FROM {1}.scriptpertemplate WHERE EXISTS(SELECT * FROM {1}.template WHERE {1}.template.FK_Site='{2}' AND {1}.template.ID = {1}.scriptpertemplate.FK_Template)", newEnvironment.DataBaseName, currentEnvorinment.DataBaseName, site.ID); //DataBase.Get().Execute(sql); ////per page //sql = String.Format(@"INSERT INTO {0}.scriptperpage SELECT * FROM {1}.scriptperpage WHERE EXISTS(SELECT * FROM {1}.page WHERE {1}.page.FK_Site='{2}' AND {1}.page.ID = {1}.scriptperpage.FK_Page)", newEnvironment.DataBaseName, currentEnvorinment.DataBaseName, site.ID); //DataBase.Get().Execute(sql); ////Newsletters //sql = String.Format(@"INSERT INTO {0}.newsletterpergroup SELECT * FROM {1}.newsletterpergroup WHERE EXISTS(SELECT * FROM {1}.newsletter WHERE {1}.newsletter.FK_Site='{2}' AND {1}.newsletter.ID = {1}.newsletterpergroup.FK_Newsletter)", newEnvironment.DataBaseName, currentEnvorinment.DataBaseName, site.ID); //DataBase.Get().Execute(sql); DataBase.Get().Execute("SET foreign_key_checks = 1;"); }
public static void FillSearchIndex(CmsSite site) { //eerst oude weggooien string sql = "DELETE FROM SearchIndex WHERE FK_Site = '" + site.ID.ToString() + "'"; DataBase.Get().Execute(sql); //nieuwe lege dict aanmaken voor check of url al is toegevoegd allUrls = new Dictionary <string, string>(); //dan per pagina vullen foreach (CmsPage page in site.Pages) { string pageUrl = page.RelativeUrl; FillSearchIndex(pageUrl, site); } }
public void ClearDataCollectionEnvironmentTables(CmsSite site, CmsSiteEnvironment newEnvironment) { DataBase.Get().Execute("SET foreign_key_checks = 0;"); foreach (DatabaseTableDefinition table in this.DataCollectionTables) { try { string sql = String.Format(@"DELETE FROM {0}." + table.Name + " WHERE FK_Site='{1}';", newEnvironment.DatabaseName, site.ID); DataBase.Get().Execute(sql); } catch { //NIET ELKE TABEL HEEFT FK_SITE. } } DataBase.Get().Execute("SET foreign_key_checks = 1;"); }
private static bool isInternalPageLink(string href, CmsSite site) { if (href.StartsWith("javascript:")) { return(false); } if ((href.StartsWith("http:") || href.StartsWith("https:")) && !href.StartsWith(site.DomainName)) { return(false); } if (href.EndsWith(".pdf")) { return(false); } return(true); }
public static List <CmsLanguage> DeleteLanguage(string languageId) { BaseService.CheckLoginAndLicense(); CmsLanguage Lang = SessionObject.CurrentSite.Languages.Where(c => c.ID == new Guid(languageId)).FirstOrDefault(); if (Lang != null) { CmsSite site = SessionObject.CurrentSite; if (Lang.Name != site.DefaultLanguage) { Lang.Delete(); site.Languages.Remove(Lang); } SessionObject.CurrentSite = site; } return(SessionObject.CurrentSite.Languages); }
public void InsertEnvironmentDataCollectionInTables(CmsSite site, CmsSiteEnvironment currentEnvorinment, CmsSiteEnvironment newEnvironment) { DataBase.Get().Execute("SET foreign_key_checks = 0;"); string sql; foreach (DatabaseTableDefinition table in this.DataCollectionTables) { if (!table.isManyToManyLinkTable) { sql = String.Format(@"INSERT INTO {0}." + table.Name + " SELECT * FROM {1}." + table.Name + " WHERE FK_Site='{2}';", newEnvironment.DatabaseName, currentEnvorinment.DatabaseName, site.ID); DataBase.Get().Execute(sql); } } //lookupvalues sql = String.Format(@"INSERT INTO {0}.datalookupvalueperitem SELECT * FROM {1}.datalookupvalueperitem WHERE EXISTS(SELECT * FROM {1}.datalookupvalue WHERE {1}.datalookupvalue.FK_Site='{2}' AND {1}.datalookupvalue.ID = {1}.datalookupvalueperitem.FK_LookupValue)", newEnvironment.DatabaseName, currentEnvorinment.DatabaseName, site.ID); DataBase.Get().Execute(sql); DataBase.Get().Execute("SET foreign_key_checks = 1;"); }
public async Task <IActionResult> SaveSite([FromBody] CmsSite parm) { var res = new ApiResult <string>(); if (!string.IsNullOrEmpty(parm?.Guid)) { res = await _siteService.UpdateAsync(parm); } else { res.message = "请选择修改站点"; res.success = false; return(Ok(res)); } await _cache.SiteSiteGuidAsync(parm); return(Ok(res)); }
public List <CmsPage> IsInUseAtPages(CmsSite site) { List <CmsPage> returnPages = new List <CmsPage>(); foreach (CmsPage page in site.Pages) { foreach (BaseModule mod in page.Modules) { BaseDataModule dataModule = BaseObject.GetById <BaseDataModule>(mod.ID); //FIX DataCollection dataCollection = dataModule.DataCollection; if (dataCollection != null && dataCollection.Equals(this)) { if (!returnPages.Contains(page)) { returnPages.Add(page); } } } } return(returnPages); }
private static string getFromAddress() { string from = ""; CmsSite currentSite = (CmsSite)HttpContext.Current.Session["CurrentSite"]; string webconfigPath = null; if (currentSite != null) { webconfigPath = "/bitSites/" + currentSite.Name + "/wwwroot/"; } //Configuration configurationFile = WebConfigurationManager.OpenWebConfiguration(System.Web.HttpContext.Current.Request.ApplicationPath); Configuration configurationFile = WebConfigurationManager.OpenWebConfiguration(webconfigPath); MailSettingsSectionGroup mailSettings = configurationFile.GetSectionGroup("system.net/mailSettings") as MailSettingsSectionGroup; if (mailSettings != null) { from = mailSettings.Smtp.From; } //string test = configurationFile.ConnectionStrings[0].ConnectionStrings.ToString(); return(from); }
protected void Page_Load(object sender, EventArgs e) { if (HttpContext.Current.Session["CurrentSite"] == null) { string siteID = ConfigurationManager.AppSettings["SiteID"]; if (siteID != null && siteID != "") { CmsSite site = BaseDomainObject.GetById <CmsSite>(new Guid(siteID)); HttpContext.Current.Session["CurrentSite"] = site; } } string id = Request.QueryString["id"]; //CmsPage page = BaseDomainObject.GetById<CmsPage>(new Guid(id)); CmsPage page = PageService.GetPreviewPage(id, ""); //Response.ClearContent(); //Response.Write(page.GetPublishHtml()); //Response.Flush(); //LiteralTitle.Text = "Preview: " + page.Title; LiteralHead.Text = page.Head; LiteralBody.Text = page.Body; }
private string ReplaceVerificationEmailTags(string content, NewsletterSubscriber subscriber) { CmsSite site = SessionObject.CurrentSite; string newsgroups = ""; foreach (NewsletterGroup group in subscriber.SubscribedGroups.Where(c => c.IsMandatoryGroup == false)) { newsgroups += group.Name + ", "; } if (newsgroups != "") { newsgroups = newsgroups.Substring(0, newsgroups.Length - 2); } string optinUrl = site.DomainName + "/" + site.NewsletterOptInEmailPage.RelativeUrl + "?subscriber=" + subscriber.ID.ToString(); content = content.Replace("[OPTINURL]", optinUrl) .Replace("[NAME]", subscriber.Name) .Replace("[FORENAME]", subscriber.ForeName) .Replace("[NAMEPREFIX]", subscriber.NamePrefix) .Replace("[USERCODE]", subscriber.ID.ToString()) .Replace("[NEWSGROUPS]", newsgroups) .Replace("[OPTINLINK]", "<a href=\"" + optinUrl + "\">").Replace("[/OPTINLINK]", "</a>"); return(content); }
public static Task SiteSiteGuidAsync(this IDistributedCache cache, CmsSite site) { return(cache.SetAsync(KeyHelper.NOWSITE, site)); }