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(); } } }
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); }
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); }
/*================================================================================= 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); }
// ================================================================================= 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); } }
public override void Save(SavingMode mode) { SetPageData(); base.Save(mode); //TODO: SetContentPageRelation(); HandleSmartUrlListChanging(); }
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); }
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); }
//================================================================================= 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); }
// ================================================================================= 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); }
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; }
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; }
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(); }
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(); }
/// <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); }
public override void Save(SavingMode mode) { SaveFieldSetting(); }
public override void Save(SavingMode mode) { this["Genre"] = ParentName; base.Save(mode); }
public override void Save(SavingMode mode) { base.Save(mode); SenseNetResourceManager.Reset(); }
public override void Save(SavingMode mode) { SetBinary(); base.Save(mode); }
public override void Save(SavingMode mode) { CheckParticipantNumber(false); base.Save(mode); }
public override void Save(SavingMode mode) { AssertTimeSpan(); base.Save(mode); }
public override void Save(SavingMode mode) { if (String.IsNullOrEmpty(this.ContentListDefinition)) this.ContentListDefinition = DefaultContentListDefinition; base.Save(mode); }
public override void Save(SavingMode mode) { }
public override void Save(SavingMode mode) { AssertTrashBinPath(); base.Save(mode); }
internal ScreenBinder(IList <IElementBinder <TObjectType> > allElements) { _allElements = allElements; BindingMode = BindingMode.TwoWay; SavingMode = SavingMode.OnlyWhenValid; }
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(); }