示例#1
0
        public override void Save(SavingMode mode)
        {
            bool isLocalTransaction = !TransactionScope.IsActive;

            if (isLocalTransaction)
            {
                //TransactionScope.Begin();
            }
            try
            {
                base.Save(mode);

                if (Binary != null)
                {
                    //this is very ugly: recreates pages that use this template
                    PageTemplateManager.GetBinaryData(this.Id, OriginalTemplateStream);
                }

                if (isLocalTransaction)
                {
                    //TransactionScope.Commit();
                }
            }
            finally
            {
                if (isLocalTransaction && TransactionScope.IsActive)
                {
                    //TransactionScope.Rollback();
                }
            }
        }
示例#2
0
        public override void Save(SavingMode mode)
        {
            // Checking for duplicated options
            var doc = new XmlDocument();

            try
            {
                doc.LoadXml(this.ContentListDefinition);
            }
            catch
            {
                return;
            }


            var data   = XDocument.Parse(ContentListDefinition);
            var values = new List <string>();

            var nodes = data.Nodes();

            var descandants = from descendant in data.Descendants() where descendant.Name.LocalName == "Option" select descendant;

            foreach (var descandant in descandants)
            {
                if (values.Contains(descandant.Attribute("value").Value))
                {
                    throw new InvalidOperationException("There are multiple values for answers.");
                }
                values.Add(descandant.Attribute("value").Value);
            }

            base.Save(mode);
        }
示例#3
0
        public override void Save(SavingMode mode)
        {
            _successfulFormCreation = false;
            // Creating registration form if necessary.
            if (GetReferenceCount(REGISTRATIONFORM) == 0 && Convert.ToBoolean(this["RequiresRegistration"]))
            {
                var regFormFolder = Parent.GetPropertySafely("RegistrationFolder") as NodeList <Node>;
                var formFolder    = regFormFolder != null?regFormFolder.FirstOrDefault() : null;

                if (formFolder != null)
                {
                    var formName = String.Format("{0}_{1}", ParentName, this["Name"]);

                    if (Content.Load(formFolder.Path + "/" + formName) == null)
                    {
                        var regForm = Content.CreateNew("EventRegistrationForm", formFolder, formName);

                        regForm["Name"] = formName;

                        regForm["AllowedChildTypes"] = ContentType.GetByName("EventRegistrationFormItem");

                        regForm["EmailList"] = !String.IsNullOrEmpty(this["OwnerEmail"].ToString()) ? this["OwnerEmail"].ToString() : String.Empty;

                        regForm["EmailTemplate"] = !String.IsNullOrEmpty(this["EmailTemplate"].ToString()) ? this["EmailTemplate"] : "{0}";

                        regForm["EmailTemplateSubmitter"] = !String.IsNullOrEmpty(this["EmailTemplateSubmitter"].ToString()) ? this["EmailTemplateSubmitter"] : "{0}";

                        regForm["EmailFrom"] = !String.IsNullOrEmpty(this["EmailFrom"].ToString()) ? this["EmailFrom"] : "*****@*****.**";

                        regForm["EmailFromSubmitter"] = !String.IsNullOrEmpty(this["EmailFromSubmitter"].ToString()) ? this["EmailFromSubmitter"] : "*****@*****.**";

                        regForm["EmailField"] = !String.IsNullOrEmpty(this["EmailField"].ToString()) ? this["EmailField"] : "*****@*****.**";

                        regForm.Save();

                        AddReference(REGISTRATIONFORM, LoadNode(regForm.Id));

                        _successfulFormCreation = true;
                    }
                }
            }

            // validation
            if (this["StartDate"] != null && this["EndDate"] != null)
            {
                var startDate = (DateTime)this["StartDate"];
                var endtDate  = (DateTime)this["EndDate"];

                // check only real values
                if (startDate > DateTime.MinValue && endtDate > DateTime.MinValue)
                {
                    if (startDate > endtDate)
                    {
                        throw new InvalidContentException(SR.GetString(SR.Exceptions.CalendarEvent.Error_InvalidStartEndDate));
                    }
                }
            }

            base.Save(mode);
        }
示例#4
0
        /*================================================================================= Node, IContentList */

        public override void Save(SavingMode mode)
        {
            if (String.IsNullOrEmpty(this.ContentListDefinition))
            {
                this.ContentListDefinition = DefaultContentListDefinition;
            }

            base.Save(mode);
        }
        public override void Save(SavingMode mode)
        {
            // skip this check when content query is not available (e.g. importing)
            if (SearchManager.ContentQueryIsAllowed)
            {
                CheckParticipantNumber(false);
            }

            base.Save(mode);
        }
示例#6
0
        // ================================================================================= Methods

        public override void Save(SavingMode mode)
        {
            base.Save(mode);

            if (Binary != null)
            {
                // this is very ugly: recreates pages that use this template
                PageTemplateManager.GetBinaryData(this.Id, OriginalTemplateStream);
            }
        }
示例#7
0
文件: Page.cs 项目: vlslavik/SenseNet
        public override void Save(SavingMode mode)
        {
            SetPageData();

            base.Save(mode);

            //TODO: SetContentPageRelation();

            HandleSmartUrlListChanging();
        }
示例#8
0
文件: Page.cs 项目: maxpavlov/FlexNet
        public override void Save(SavingMode mode)
		{
            SetPageData();

            base.Save(mode);

			//TODO: SetContentPageRelation();
            
            HandleSmartUrlListChanging();
		}
示例#9
0
        public override void Save(SavingMode mode)
        {
            _successfulFormCreation = false;
            // Creating registration form if necessary.
            if (GetReferenceCount("RegistrationForm") == 0 && Convert.ToBoolean(this["RequiresRegistration"]))
            {
                try
                {
                    var regFormFolder = Parent.GetPropertySafely("RegistrationFolder") as NodeList<Node>;


                    if (regFormFolder != null)
                    {
                        var formFolder = regFormFolder[0];

                        var formName = String.Format("{0}_{1}", ParentName, this["Name"]);

                        if (Content.Load(formFolder.Path + "/" + formName) == null)
                        {
                            var regForm = Content.CreateNew("EventRegistrationForm", formFolder, formName);

                            regForm["Name"] = formName;

                            //regForm["ContentTypes"] = LoadNode("/Root/System/Schema/ContentTypes/GenericContent/ListItem/FormItem/EventRegistrationFormItem");
                            regForm["AllowedChildTypes"] = ContentType.GetByName("EventRegistrationFormItem");

                            regForm["EmailList"] = !String.IsNullOrEmpty(this["OwnerEmail"].ToString()) ? this["OwnerEmail"].ToString() : String.Empty;

                            regForm["EmailTemplate"] = !String.IsNullOrEmpty(this["EmailTemplate"].ToString()) ? this["EmailTemplate"] : "{0}";

                            regForm["EmailTemplateSubmitter"] = !String.IsNullOrEmpty(this["EmailTemplateSubmitter"].ToString()) ? this["EmailTemplateSubmitter"] : "{0}";

                            regForm["EmailFrom"] = !String.IsNullOrEmpty(this["EmailFrom"].ToString()) ? this["EmailFrom"] : "*****@*****.**";

                            regForm["EmailFromSubmitter"] = !String.IsNullOrEmpty(this["EmailFromSubmitter"].ToString()) ? this["EmailFromSubmitter"] : "*****@*****.**";

                            regForm["EmailField"] = !String.IsNullOrEmpty(this["EmailField"].ToString()) ? this["EmailField"] : "*****@*****.**";

                            regForm.Save();

                            AddReference("RegistrationForm", LoadNode(regForm.Id));
                            
                            _successfulFormCreation = true;
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }


            base.Save(mode);
        }
示例#10
0
        public override void Save(SavingMode mode)
        {
            _successfulFormCreation = false;
            // Creating registration form if necessary.
            if (GetReferenceCount("RegistrationForm") == 0 && Convert.ToBoolean(this["RequiresRegistration"]))
            {
                try
                {
                    var regFormFolder = Parent.GetPropertySafely("RegistrationFolder") as NodeList <Node>;


                    if (regFormFolder != null)
                    {
                        var formFolder = regFormFolder[0];

                        var formName = String.Format("{0}_{1}", ParentName, this["Name"]);

                        if (Content.Load(formFolder.Path + "/" + formName) == null)
                        {
                            var regForm = Content.CreateNew("EventRegistrationForm", formFolder, formName);

                            regForm["Name"] = formName;

                            //regForm["ContentTypes"] = LoadNode("/Root/System/Schema/ContentTypes/GenericContent/ListItem/FormItem/EventRegistrationFormItem");
                            regForm["AllowedChildTypes"] = ContentType.GetByName("EventRegistrationFormItem");

                            regForm["EmailList"] = !String.IsNullOrEmpty(this["OwnerEmail"].ToString()) ? this["OwnerEmail"].ToString() : String.Empty;

                            regForm["EmailTemplate"] = !String.IsNullOrEmpty(this["EmailTemplate"].ToString()) ? this["EmailTemplate"] : "{0}";

                            regForm["EmailTemplateSubmitter"] = !String.IsNullOrEmpty(this["EmailTemplateSubmitter"].ToString()) ? this["EmailTemplateSubmitter"] : "{0}";

                            regForm["EmailFrom"] = !String.IsNullOrEmpty(this["EmailFrom"].ToString()) ? this["EmailFrom"] : "*****@*****.**";

                            regForm["EmailFromSubmitter"] = !String.IsNullOrEmpty(this["EmailFromSubmitter"].ToString()) ? this["EmailFromSubmitter"] : "*****@*****.**";

                            regForm["EmailField"] = !String.IsNullOrEmpty(this["EmailField"].ToString()) ? this["EmailField"] : "*****@*****.**";

                            regForm.Save();

                            AddReference("RegistrationForm", LoadNode(regForm.Id));

                            _successfulFormCreation = true;
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }


            base.Save(mode);
        }
示例#11
0
        //================================================================================= Overrides

        public override void Save(SavingMode mode)
        {
            if (this.Id > 0 && StorageContext.Search.IsOuterEngineEnabled)
            {
                if (ContentQuery.Query("+Type:surveyitem +ParentId:@0 .COUNTONLY .LIFESPAN:OFF .AUTOFILTERS:OFF", null, this.Id)
                    .Count > 0 && _originalContentListDefinition != this.ContentListDefinition)
                {
                    throw new InvalidOperationException("Cannot modify questions due to existing filled survey(s).");
                }
            }
            base.Save(mode);
        }
示例#12
0
文件: Survey.cs 项目: sztomi/sensenet
        // ================================================================================= Overrides

        public override void Save(SavingMode mode)
        {
            if (this.Id > 0 && RepositoryInstance.ContentQueryIsAllowed)
            {
                if (ContentQuery.Query(SafeQueries.SurveyItemsInFolderCount, null, this.Id)
                    .Count > 0 && _originalContentListDefinition != this.ContentListDefinition)
                {
                    throw new InvalidOperationException("Cannot modify questions due to existing filled survey(s).");
                }
            }
            base.Save(mode);
        }
示例#13
0
        public override void Save(SavingMode mode)
        {
            var originalId = this.Id;

            base.Save(mode);

            // AD Sync
            if (_syncObject)
            {
                SynchADContainer(this, originalId);
            }
            // default: object should be synced. if it was not synced now (sync properties updated only) next time it should be.
            _syncObject = true;
        }
示例#14
0
        public override void Save(SavingMode mode)
        {
            var originalId = this.Id;

            base.Save(mode);

            // AD Sync
            if (_syncObject)
            {
                ADFolder.SynchADContainer(this, originalId);
            }
            // default: object should be synced. if it was not synced now (sync properties updated only) next time it should be.
            _syncObject = true;
        }
示例#15
0
        public override void Save(SavingMode mode)
        {
            RefreshUrlList();

            if (this.CopyInProgress)
            {
                //we need to reset these values to avoid
                //conflict with the source site
                this.UrlList   = new Dictionary <string, string>();
                this.StartPage = null;
            }
            else
            {
                ValidateUrlList();
            }

            base.Save(mode);

            var action = new PortalContext.ReloadSiteListDistributedAction();

            action.Execute();
        }
示例#16
0
        public virtual void Save(SavingMode mode)
        {
            var action = SavingAction.Create(this);

            switch (mode)
            {
            case SavingMode.RaiseVersion:
                action.CheckOutAndSaveAndCheckIn();
                break;

            case SavingMode.RaiseVersionAndLock:
                action.CheckOutAndSave();
                break;

            case SavingMode.KeepVersion:
                action.SaveSameVersion();
                break;

            default:
                throw new NotImplementedException("Unknown SavingMode: " + mode);
            }
            action.Execute();
        }
示例#17
0
文件: Aspect.cs 项目: y1027/sensenet
 /// <summary>
 /// Persists the modifications of this Content.
 /// Do not use this method directly from your code.
 /// If the AspectDefinition is invalid, <see cref="InvalidContentException"/> will be thrown.
 /// Also throws an <see cref="InvalidContentException"/> if the Path of the instance is not under the Aspects container.
 /// </summary>
 public override void Save(SavingMode mode)
 {
     Validate();
     base.Save(mode);
 }
示例#18
0
 public override void Save(SavingMode mode)
 {
     SaveFieldSetting();
 }
示例#19
0
 public override void Save(SavingMode mode)
 {
     SaveFieldSetting();
 }
示例#20
0
 public override void Save(SavingMode mode)
 {
     this["Genre"] = ParentName;
     base.Save(mode);
 }
示例#21
0
        public override void Save(SavingMode mode)
        {
            base.Save(mode);

            SenseNetResourceManager.Reset();
        }
示例#22
0
 public override void Save(SavingMode mode)
 {
     SetBinary();
     base.Save(mode);
 }
示例#23
0
 public virtual void Save(SavingMode mode)
 {
     var action = SavingAction.Create(this);
     switch (mode)
     {
         case SavingMode.RaiseVersion:
             action.CheckOutAndSaveAndCheckIn();
             break;
         case SavingMode.RaiseVersionAndLock:
             action.CheckOutAndSave();
             break;
         case SavingMode.KeepVersion:
             action.SaveSameVersion();
             break;
         default:
             throw new NotImplementedException("Unknown SavingMode: " + mode);
     }
     action.Execute();
 }
示例#24
0
        public override void Save(SavingMode mode)
        {
            base.Save(mode);

            SenseNetResourceManager.Reset();
        }
 public override void Save(SavingMode mode)
 {
     CheckParticipantNumber(false);
     
     base.Save(mode);
 }
示例#26
0
 public override void Save(SavingMode mode)
 {
     AssertTimeSpan();
     base.Save(mode);
 }
示例#27
0
        public override void Save(SavingMode mode)
        {
            if (String.IsNullOrEmpty(this.ContentListDefinition))
                this.ContentListDefinition = DefaultContentListDefinition;

            base.Save(mode);
        }
示例#28
0
 public override void Save(SavingMode mode)
 {
 }
示例#29
0
文件: Book.cs 项目: jhuntsman/FlexNet
        public override void Save(SavingMode mode)
        {

            this["Genre"] = ParentName;
            base.Save(mode);
        }
示例#30
0
 public override void Save(SavingMode mode)
 {
 }
示例#31
0
 public override void Save(SavingMode mode)
 {
     AssertTimeSpan();
     base.Save(mode);
 }
示例#32
0
 public override void Save(SavingMode mode)
 {
     AssertTrashBinPath();
     base.Save(mode);
 }
示例#33
0
        public override void Save(SavingMode mode)
        {
            CheckParticipantNumber(false);

            base.Save(mode);
        }
示例#34
0
 public override void Save(SavingMode mode)
 {
     AssertTrashBinPath();
     base.Save(mode);
 }
示例#35
0
 public override void Save(SavingMode mode)
 {
     SetBinary();
     base.Save(mode);
 }
示例#36
0
 internal ScreenBinder(IList <IElementBinder <TObjectType> > allElements)
 {
     _allElements = allElements;
     BindingMode  = BindingMode.TwoWay;
     SavingMode   = SavingMode.OnlyWhenValid;
 }
示例#37
0
文件: Site.cs 项目: maxpavlov/FlexNet
        public override void Save(SavingMode mode)
        {
            RefreshUrlList();

            if (this.CopyInProgress)
            {
                //we need to reset these values to avoid 
                //conflict with the source site
                this.UrlList = new Dictionary<string, string>();
                this.StartPage = null;
            }
            else
            {
                ValidateUrlList();
            }

            base.Save(mode);

            var action = new PortalContext.ReloadSiteListDistributedAction();
            action.Execute();
        }
示例#38
0
        public override void Save(SavingMode mode)
        {
            bool isLocalTransaction = !TransactionScope.IsActive;
            if (isLocalTransaction)
            {
                //TransactionScope.Begin();
            }
            try
            {
                base.Save(mode);

                if (Binary != null)
                {
                    //this is very ugly: recreates pages that use this template
                    PageTemplateManager.GetBinaryData(this.Id, OriginalTemplateStream);
                }

                if (isLocalTransaction)
                {
                    //TransactionScope.Commit();
                }
            }
            finally
            {
                if (isLocalTransaction && TransactionScope.IsActive)
                {
                    //TransactionScope.Rollback();
                }
            }
        }