// ======================================== // constructor // ======================================== protected internal MemoTag() { _subTags = new AssociationCollection <MemoTag>( subTag => { if (subTag.SuperTag != this) { subTag.SuperTag = this; } }, subTag => subTag.SuperTag = null, this, "SubTags" ); _subTags.DetailedPropertyChanged += (sender, e) => OnPropertyChanged(this, e); _memos = new AssociationCollection <Memo>( memo => { if (!memo.Tags.Contains(this)) { memo.AddTag(this); } }, memo => memo.RemoveTag(this), this, "Memos" ); _memos.DetailedPropertyChanged += (sender, e) => OnPropertyChanged(this, e); }
void Refresh() { this.Name = m_Item[TemplateCT.TemplateName] as string; this.State = EnumConverter.ToState(m_Item[TemplateCT.TemplateState] as string); SPFieldUserValueCollection v = new SPFieldUserValueCollection(m_Item.Web, m_Item.GetFieldValue <object>(TemplateCT.SendDraftTo, string.Empty).ToString()); this.SendDraftToAdresses = v.Select(p => p.User.Email).ToList(); this.UseFileForSubject = m_Item.GetFieldValue <bool>(TemplateCT.TemplateSubjectUseFile); this.UseFileForBody = m_Item.GetFieldValue <bool>(TemplateCT.TemplateBodyUseFile); this.UseFileForFrom = m_Item.GetFieldValue <bool>(TemplateCT.TemplateFromUseFile); this.UseFileForReply = m_Item.GetFieldValue <bool>(TemplateCT.TemplateReplayUseFile); this.From = m_Item.GetValueFromTextFieldOrFile(this.UseFileForFrom, TemplateCT.TemplateFrom, TemplateCT.TemplateFromFile, out FromAttached); this.Replay = m_Item.GetValueFromTextFieldOrFile(this.UseFileForReply, TemplateCT.TemplateReplay, TemplateCT.TemplateReplayFile, out ReplyAttached); this.Body = m_Item.GetValueFromTextFieldOrFile(this.UseFileForBody, TemplateCT.TemplateBody, TemplateCT.TemplateBodyFile, out this.BodyAttached); this.Subject = m_Item.GetValueFromTextFieldOrFile(this.UseFileForSubject, TemplateCT.TemplateSubject, TemplateCT.TemplateSubjectFile, out this.SubjectAttached); if (m_Item[TemplateCT.TemplateType] != null) { var val = new SPFieldMultiChoiceValue(m_Item[TemplateCT.TemplateType].ToString()); this.EventTypes = EnumConverter.ToType(val); } else { this.EventTypes = (int)TemplateTypeEnum.Unknown; } this.Associations = AssociationCollection.ParseOrDefault(m_Item[TemplateCT.Associations] as string); }
// ======================================== // constructor // ======================================== protected internal MemoNode() { _outgoings = new AssociationCollection <MemoEdge>( edge => { if (edge.Source != this) { edge.Source = this; } }, edge => edge.Source = null, this, "Outgoings" ); _outgoings.DetailedPropertyChanged += (sender, e) => OnPropertyChanged(this, e); _incomings = new AssociationCollection <MemoEdge>( edge => { if (edge.Target != this) { edge.Target = this; } }, edge => edge.Target = null, this, "Incomings" ); _incomings.DetailedPropertyChanged += (sender, e) => OnPropertyChanged(this, e); }
public override string GetFieldValueAsHtml(object value) { try { var config = AssociationCollection.ParseOrDefault(SPHttpUtility.ConvertSimpleHtmlToText(value.ToString(), -1)); int count = config.Count; if (count > 0) { var sb = new StringBuilder(); sb.Append("<table border=\"1\">"); sb.Append(string.Format("<tr><th>#</th><th>Name</th><th>Type</th><th>Value</th></tr>")); foreach (var a in config) { sb.Append(string.Format("<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td></tr>", config.IndexOf(a) + 1, a.Name, a.Type, a.ValueToShortDisplay)); } sb.Append("</table>"); return(sb.ToString()); } else { return("no associations"); } } catch (Exception ex) { return(ex.Message); } }
public AssociationCollectionHelper(object entity, PropertyInfo prop) { this.entity = entity; this.prop = prop; typelessCollection = (IEnumerable)prop.GetValue(entity); assocColl = typelessCollection as AssociationCollection; }
// ======================================== // constructor // ======================================== protected internal Memo() { _tags = new AssociationCollection <MemoTag>( tag => { if (!tag.Memos.Contains(this)) { tag.AddMemo(this); } }, tag => tag.RemoveMemo(this), this, "Tags" ); _tags.DetailedPropertyChanged += (sender, e) => OnPropertyChanged(this, e); _containedFolders = new AssociationCollection <MemoFolder>( folder => { if (!folder.ContainingMemos.Contains(this)) { folder.AddContainingMemo(this); } }, folder => folder.RemoveContainingMemo(this), this, "ContainedFolders" ); _containedFolders.DetailedPropertyChanged += (sender, e) => OnPropertyChanged(this, e, false); _title = ""; _source = ""; _accessedDate = ModifiedDate; }
// ======================================== // constructor // ======================================== protected internal MemoFolder() { _subFolders = new AssociationCollection <MemoFolder>( folder => { if (folder.ParentFolder != this) { folder.ParentFolder = this; } }, folder => folder.ParentFolder = null, this, "SubFolders" ); _subFolders.DetailedPropertyChanged += (sender, e) => OnPropertyChanged(this, e); _containingMemos = new AssociationCollection <Memo>( memo => { if (!memo.ContainedFolders.Contains(this)) { memo.AddContainedFolder(this); } }, memo => memo.RemoveContainedFolder(this), this, "ContainingMemos" ); _containingMemos.DetailedPropertyChanged += (sender, e) => OnPropertyChanged(this, e); }
public Type(string name) { if (name == null) { throw Error.SchemaRequirementViolation("Type", "Name"); } this.name = name; columns = new ColumnCollection(); associations = new AssociationCollection(); subTypes = new TypeCollection(); }
public ConstituentInfo(DataSet tessResults) { DataTableCollection tables = tessResults.Tables; if (tables.Contains("Addresses") && tables["Addresses"].Rows.Count > 0) { Addresses = new AddressCollection(tables["Addresses"]); } if (tables.Contains("ConstituentAttribute") && tables["ConstituentAttribute"].Rows.Count > 0) { Attributes = new ConstituentAttributeCollection(tables["ConstituentAttribute"]); } if (tables.Contains("EmailAddresses") && tables["EmailAddresses"].Rows.Count > 0) { EmailAddresses = new EmailAddressCollection(tables["EmailAddresses"]); } if (tables.Contains("Associations") && tables["Associations"].Rows.Count > 0) { Associations = new AssociationCollection(tables["Associations"]); } if (tables.Contains("Constituency") && tables["Constituency"].Rows.Count > 0) { Constituencies = new ConstituencyCollection(tables["Constituency"]); } if (tables.Contains("ConstituentHeader") && tables["ConstituentHeader"].Rows.Count > 0) { Header = new ConstituentHeader(tables["ConstituentHeader"]); } if (tables.Contains("Contribution") && tables["Contribution"].Rows.Count > 0) { Contributions = new ContributionRecordCollection(tables["Contribution"]); } if (tables.Contains("Interests") && tables["Interests"].Rows.Count > 0) { Interests = new InterestCollection(tables["Interests"]); } if (tables.Contains("Memberships") && tables["Memberships"].Rows.Count > 0) { Memberships = new MembershipCollection(tables["Memberships"]); } if (tables.Contains("Phones") && tables["Phones"].Rows.Count > 0) { PhoneNumbers = new PhoneNumberCollection(tables["Phones"]); } if (tables.Contains("ProgramListings") && tables["ProgramListings"].Rows.Count > 0) { ProgramListings = new ProgramListingCollection(tables["ProgramListings"]); } if (tables.Contains("Rankings") && tables["Rankings"].Rows.Count > 0) { Rankings = new RankCollection(tables["Rankings"]); } }
ITemplate CreateTemplate(int eventTypes, TemplateStateEnum templateState, AssociationCollection asses) { var res = new Mock <ITemplate>() { DefaultValue = DefaultValue.Mock }; res.Setup(p => p.Name).Returns(Guid.NewGuid().ToString()); res.Setup(p => p.Id).Returns(Guid.NewGuid()); res.Setup(p => p.EventTypes).Returns(eventTypes); res.Setup(p => p.State).Returns(templateState); res.Setup(p => p.Associations).Returns(asses); return(res.Object); }
// ======================================== // constructor // ======================================== protected internal MemoMarkableElement() { if (IsMarkable) { _marks = new AssociationCollection <MemoMark>( mark => { if (mark.Content != this) { mark.Content = this; } }, mark => mark.Content = null, this, "Marks" ); _marks.DetailedPropertyChanged += (sender, e) => OnPropertyChanged(this, e); } }
void Update(AssociationCollection config) { Temp = config; }