protected override void OnPreInit(EventArgs e) { OwnerInterfaceType interFaceType = SitesHandler.GetOwnerInterfaceType(); if (interFaceType == OwnerInterfaceType.SubSites) { this.Page.MasterPageFile = "~" + SiteDesign.MastersFolder + "GoogleSearch.master"; } else { this.Page.MasterPageFile = "~" + SiteDesign.MastersFolder + "GoogleSearch.master"; } //this.SmartNavigation = true; this.MaintainScrollPositionOnPostBack = true; base.OnPreInit(e); }
//---------------------------------------------------------------------------------------------------------- public static void IncreaseSubSiteVisites() { HttpContext context = HttpContext.Current; OwnerInterfaceType interfaceType = SitesHandler.GetOwnerInterfaceType(); if (interfaceType == OwnerInterfaceType.SubSites) { Guid OwnerID = SitesHandler.GetOwnerIDAsGuid(); string OwnerIdentifire = SitesHandler.GetOwnerIdentifire(); //-------------------------------------- List <string> visitorSubSites = null; try { visitorSubSites = (List <string>)context.Session["VisitorSubSites"]; } catch { } //-------------------------------------- if (visitorSubSites == null) { visitorSubSites = new List <string>(); } //-------------------------------------- foreach (string site in visitorSubSites) { if (OwnerIdentifire == site) { return; } } //-------------------------------------- UsersDataFactory.IncreaseVisits(OwnerID); visitorSubSites.Add(OwnerIdentifire); context.Session["VisitorSubSites"] = visitorSubSites; } }
//------------------------------------------------------------- public static UsersDataEntity GetOwnerData() { UsersDataEntity SiteOwner = null; HttpContext context = HttpContext.Current; if (context.Items["SiteOwnerData"] != null) { SiteOwner = (UsersDataEntity)context.Items["SiteOwnerData"]; } else { if (context.Items["OwnerInterfaceType"] != null) { OwnerInterfaceType ownerInterfaceType = (OwnerInterfaceType)context.Items["OwnerInterfaceType"]; if (ownerInterfaceType == OwnerInterfaceType.SubAdmin) { MembershipUser user = Membership.GetUser(context.User.Identity.Name); if (user != null) { SiteOwner = UsersDataFactory.GetUsersDataObject((Guid)user.ProviderUserKey, Guid.Empty); if (SiteOwner != null) { context.Items["OwnerID"] = new Guid(SiteOwner.UserId.ToString()); context.Items["OwnerIdentifire"] = SiteOwner.UserName; context.Items["OwnerTitle"] = SiteOwner.Name; } else { context.Response.Redirect(SiteSettings.Site_WebsiteDomain); } } } else if (ownerInterfaceType == OwnerInterfaceType.SubSites) { string SubSiteIdentifire = (string)context.Items["SubSiteIdentifire"]; if (!string.IsNullOrEmpty(SubSiteIdentifire)) { MembershipUser user = Membership.GetUser(SubSiteIdentifire); if (user != null) { SiteOwner = UsersDataFactory.GetUsersDataObject((Guid)user.ProviderUserKey, Guid.Empty); if (SiteOwner != null) { context.Items["OwnerID"] = new Guid(SiteOwner.UserId.ToString()); context.Items["OwnerIdentifire"] = SiteOwner.UserName; context.Items["OwnerTitle"] = SiteOwner.Name; } } else { context.Response.Redirect(SiteSettings.Site_WebsiteDomain); } } } } } //--------------------------------------------------------- // if (SiteOwner == null) { context.Items["OwnerID"] = Guid.Empty; context.Items["OwnerIdentifire"] = ""; context.Items["OwnerTitle"] = ""; } //--------------------------------------------------------- return(SiteOwner); //--------------------------------------------------------- }