public static ProjectInfoList ProjectFetchInfoList(IUser user)
 {
     return(ProjectInfoList.FetchProjectInfoList(
                new ProjectDataCriteria
     {
         UserId = user.UserId
     }));
 }
        public static ProjectInfoList ProjectFetchInfoList(ProjectDataCriteria criteria)
        {
            // this will ensure that users can only view projects that they are assigned to
            criteria.UserId =
                ((IBusinessIdentity)Csla.ApplicationContext.User.Identity).UserId;

            return(ProjectInfoList.FetchProjectInfoList(criteria));
        }
        protected override void Execute(RuleContext context)
        {
            var target   = (IProject)context.Target;
            var projects = ProjectInfoList.FetchProjectInfoList(new ProjectCriteria
            {
                Name = target.Name
            });

            if (projects.Count(row => row.ProjectId != target.ProjectId) != 0)
            {
                context.AddErrorResult("That project name is already in use.");
            }
        }