public override RecordPropertyValueCollection GetPropertyValues(Record rec, RecordProperty prop) { roxority.Shared.Func <int> getCount = null; roxority.Shared.Func <object> getValue = null; bool isHtml = false; UserProfile mainItem = rec.MainItem as UserProfile; List <object> list = null; SPUser user = null; Property property2 = prop.Property as Property; if (property2 != null) { isHtml = property2.Type == "HTML"; } if (prop.Name == "roxVcardExport") { return(new RecordPropertyValueCollection(this, rec, prop, new object[] { UserDataSource.GetVcardExport(rec) }, null, null, null)); } if (prop.Name == "roxSiteGroups") { string str; RecordProperty property; RecordPropertyValueCollection values; list = new List <object>(); if ((((property = rec.DataSource.Properties.GetPropertyByName("AccountName")) != null) && ((values = this.GetPropertyValues(rec, property)) != null)) && !string.IsNullOrEmpty(str = values.Value + string.Empty)) { try { user = SPContext.Current.Web.AllUsers[str]; } catch { } if (user != null) { foreach (SPGroup group in ProductPage.TryEach <SPGroup>(user.Groups)) { try { list.Add(group.Name); } catch { } } } } return(new RecordPropertyValueCollection(this, rec, prop, list.ToArray(), null, null, null)); } if (prop.Name == "roxUserPersonalUrl") { return(new RecordPropertyValueCollection(this, rec, prop, new object[] { base.GetPersonalUrl(rec) }, null, null, null)); } if (prop.Name == "roxUserPublicUrl") { return(new RecordPropertyValueCollection(this, rec, prop, new object[] { base.GetPublicUrl(rec) }, null, null, null)); } UserProfileValueCollection vals = mainItem[prop.Name]; if (getCount == null) { getCount = () => vals.Count; } if (getValue == null) { getValue = delegate { if (isHtml) { return("<roxhtml/>" + vals.Value); } return(vals.Value); }; } return(new RecordPropertyValueCollection(this, rec, prop, null, isHtml ? Array.ConvertAll <object, string>(new ArrayList(vals).ToArray(), o => "<roxhtml/>" + o).GetEnumerator() : vals.GetEnumerator(), getCount, getValue)); }
public override RecordPropertyValueCollection GetPropertyValues(Record rec, RecordProperty prop) { SPFieldUrl url; SPListItem relItem = rec.RelItem as SPListItem; SPField property = prop.Property as SPField; SPUser mainItem = rec.MainItem as SPUser; if (prop.Name == "roxVcardExport") { return(new RecordPropertyValueCollection(this, rec, prop, new object[] { UserDataSource.GetVcardExport(rec) }, null, null, null)); } if ((prop.Name == "roxSiteGroups") && (mainItem != null)) { List <object> list = new List <object>(); foreach (SPGroup group in ProductPage.TryEach <SPGroup>(mainItem.Groups)) { try { list.Add(group.Name); } catch { } } return(new RecordPropertyValueCollection(this, rec, prop, list.ToArray(), null, null, null)); } if (prop.Name == "roxUserPersonalUrl") { return(new RecordPropertyValueCollection(this, rec, prop, new object[] { base.GetPersonalUrl(rec) }, null, null, null)); } if (prop.Name == "roxUserPublicUrl") { return(new RecordPropertyValueCollection(this, rec, prop, new object[] { base.GetPublicUrl(rec) }, null, null, null)); } if ((relItem == null) || (property == null)) { return(null); } object obj2 = relItem[property.Id]; if (obj2 is DateTime) { obj2 = ((DateTime)obj2).ToUniversalTime(); } if (((url = property as SPFieldUrl) != null) && (obj2 is string)) { if (url.DisplayFormat == SPUrlFieldFormatType.Image) { obj2 = new SPFieldUrlValue(obj2 as string).Url; } else { obj2 = new SPFieldUrlValue(obj2 as string); } } return(new RecordPropertyValueCollection(this, rec, prop, (obj2 is object[]) ? (obj2 as object[]) : ((obj2 == null) ? new object[0] : new object[] { ((url != null) ? obj2 : property.GetFieldValueAsHtml(obj2)) }), null, null, null)); }
public override RecordPropertyValueCollection GetPropertyValues(Record rec, RecordProperty prop) { Converter <string, string> getSourceValue = null; DirectoryEntry mainItem = rec.MainItem as DirectoryEntry; SearchResult relItem = rec.RelItem as SearchResult; ResultPropertyValueCollection rvals = (relItem == null) ? null : relItem.Properties[prop.Name]; PropertyValueCollection pvals = (mainItem == null) ? null : mainItem.Properties[prop.Name]; object obj1 = rec.MainItem; SPUser user = null; if (prop.Name == "roxVcardExport") { return(new RecordPropertyValueCollection(this, rec, prop, new object[] { UserDataSource.GetVcardExport(rec) }, null, null, null)); } if (prop.Name == "roxSiteGroups") { string str; List <object> list = new List <object>(); if (getSourceValue == null) { getSourceValue = pn => rec[pn, string.Empty]; } if (!string.IsNullOrEmpty(str = Record.GetSpecialFieldValue(this, "rox___pl", getSourceValue))) { try { user = SPContext.Current.Web.AllUsers[str]; } catch { } if (user != null) { foreach (SPGroup group in ProductPage.TryEach <SPGroup>(user.Groups)) { try { list.Add(group.Name); } catch { } } } } return(new RecordPropertyValueCollection(this, rec, prop, list.ToArray(), null, null, null)); } if (rvals != null) { return(new RecordPropertyValueCollection(this, rec, prop, null, rvals.GetEnumerator(), () => rvals.Count, delegate { IEnumerator enumerator = rvals.GetEnumerator(); { while (enumerator.MoveNext()) { return enumerator.Current; } } return null; })); } if (pvals != null) { return(new RecordPropertyValueCollection(this, rec, prop, null, pvals.GetEnumerator(), () => pvals.Count, () => pvals.Value)); } return(null); }