Example #1
0
 public RecordPropertyValueCollection(roxority.Data.DataSource dataSource, roxority.Data.Record record, roxority.Data.RecordProperty prop, object[] values, IEnumerator enumerator, roxority.Shared.Func <int> getCount, roxority.Shared.Func <object> getValue)
 {
     this.DataSource       = dataSource;
     this.Record           = record;
     this.RecordProperty   = prop;
     this.GetCountDelegate = getCount;
     this.GetValueDelegate = getValue;
     this.Values           = values;
     if (this.Values != null)
     {
         this.Enum = this.Values.GetEnumerator();
     }
     else if (enumerator != null)
     {
         this.Enum = enumerator;
     }
 }
Example #2
0
        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));
        }