Example #1
0
        public Guid FindImportUser(SiteExportUser u)
        {
            SiteExportUser usr = (from t in this.TheUsers
                                  where t.Login.ToString() == u.Login.ToString() ||
                                  t.Email.ToString() == u.Email.ToString()
                                  select t).FirstOrDefault();

            if (usr == null || (usr != null && usr.ImportUserID != Guid.Empty))
            {
                return(SecurityData.CurrentUserGuid);
            }
            else
            {
                return(usr.ImportUserID);
            }
        }
        public Guid FindImportUser(SiteExportUser u)
        {
            SiteExportUser usr = (from t in this.TheUsers
                                  where t.Login.ToString() == u.Login.ToString()
                                          || t.Email.ToString() == u.Email.ToString()
                                  select t).FirstOrDefault();

            if (usr == null || (usr != null && usr.ImportUserID != Guid.Empty)) {
                return SecurityData.CurrentUserGuid;
            } else {
                return usr.ImportUserID;
            }
        }
        private void SetVals(ContentPage cp, List<Widget> widgets)
        {
            this.CarrotCakeVersion = SiteData.CarrotCakeCMSVersion;
            this.ExportDate = DateTime.UtcNow;
            Guid siteID = cp.SiteID;

            this.NewRootContentID = Guid.NewGuid();

            cp.LoadAttributes();

            this.ThePage = cp;
            this.ThePageWidgets = widgets;

            if (this.ThePage == null) {
                this.ThePage = new ContentPage();
                this.ThePage.Root_ContentID = Guid.NewGuid();
                this.ThePage.ContentID = ThePage.Root_ContentID;
            }
            if (this.ThePageWidgets == null) {
                this.ThePageWidgets = new List<Widget>();
            }

            this.OriginalRootContentID = ThePage.Root_ContentID;
            this.OriginalSiteID = ThePage.SiteID;
            this.OriginalParentContentID = Guid.Empty;
            this.ParentFileName = String.Empty;

            if (this.ThePage.Parent_ContentID != null) {
                ContentPage parent = new ContentPage();
                using (ContentPageHelper cph = new ContentPageHelper()) {
                    parent = cph.FindContentByID(siteID, ThePage.Parent_ContentID.Value);
                }
                this.ParentFileName = parent.FileName;
                this.OriginalParentContentID = parent.Root_ContentID;
            }

            this.ThePage.Root_ContentID = this.NewRootContentID;
            this.ThePage.ContentID = this.NewRootContentID;

            foreach (var w in this.ThePageWidgets) {
                w.Root_ContentID = this.NewRootContentID;
                w.Root_WidgetID = Guid.NewGuid();
                w.WidgetDataID = Guid.NewGuid();
            }

            Guid userID1 = Guid.Empty;

            if (!cp.EditUserId.HasValue) {
                userID1 = cp.CreateUserId;
            } else {
                userID1 = cp.EditUserId.Value;
            }

            ExtendedUserData u1 = new ExtendedUserData(userID1);
            this.TheUser = new SiteExportUser(u1);

            Guid userID2 = Guid.Empty;

            if (cp.CreditUserId.HasValue) {
                userID2 = cp.CreditUserId.Value;
            }

            ExtendedUserData u2 = new ExtendedUserData(userID2);
            if (u2 != null) {
                this.CreditUser = new SiteExportUser(u2);
            } else {
                this.CreditUser = null;
            }
        }