Beispiel #1
0
        /// <summary>
        /// Retreives all owners by location
        /// </summary>
        /// <param name="location"></param>
        /// <returns></returns>
        public static IEnumerable <IOwner> GetOwners(this IHasLocationId location)
        {
            var db = new MembershipCashierDL.Access.LowLevelAccess();

            return(db.FindOwner(null, new LocationDiscriminator()
            {
            }).Select(o => o.Owner).ToArray());
        }
Beispiel #2
0
        public static IEnumerable <LocationModel> GetLocations(this IHasOwnerId user)
        {
            var db = new MembershipCashierDL.Access.LowLevelAccess();

            return(db.FindLocation(null, new OwnerVsLocationDiscriminator()
            {
                Filter = x => x.OwnerId == user.OwnerId
            }, null).Select(l => l.Location.ToLocationModel()));
        }
Beispiel #3
0
        /// <summary>
        /// Gets IOwner record by IUserProfile record
        /// </summary>
        /// <param name="profile"></param>
        /// <returns></returns>
        public static IOwner GetRelatedOwner(this IUserProfile profile)
        {
            var db    = new MembershipCashierDL.Access.LowLevelAccess();
            var owner = db.FindOwner(new OwnerDiscriminator()
            {
                Filter = x => x.OwnerUserId == profile.UserId
            }, null).FirstOrDefault();

            if (owner != null)
            {
                return(owner.Owner);
            }

            return(null);
        }
Beispiel #4
0
        public static OwnerPrincipal ToOwnerPrincipal(this IUserProfile profile)
        {
            var ret = new OwnerPrincipal(new GenericIdentity(profile.UserName), profile);

            if (ret.IsInRole(Constants.OWNER))
            {
                var db    = new MembershipCashierDL.Access.LowLevelAccess();
                var owner = db.FindOwner(new OwnerDiscriminator()
                {
                    Filter = x => x.OwnerUserId == profile.UserId
                }, null).FirstOrDefault();
                if (owner != null)
                {
                    ret.Owner = owner.Owner;
                }
            }

            return(ret);
        }