当前位置: 首页>>代码示例>>C#>>正文


C# IUser.ToSimpleUser方法代码示例

本文整理汇总了C#中IUser.ToSimpleUser方法的典型用法代码示例。如果您正苦于以下问题:C# IUser.ToSimpleUser方法的具体用法?C# IUser.ToSimpleUser怎么用?C# IUser.ToSimpleUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IUser的用法示例。


在下文中一共展示了IUser.ToSimpleUser方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Invoke

        public void Invoke(IUser user,IInferenceType inferenceType,IDocumentSession session)
        {
            //create a new notification and save it
            var notification = new Notification
                                   {
                                       About = user.ToSimpleUser(),
                                       Id = IlluminateDatabase.GenerateId<Notification>(),
                                       SendDate = DateTime.Now,
                                       From = EmailRecipient.GetIlluminateRecipient(),
                                       Title = "Illuminate Inference",
                                       Body = inferenceType.GetDescription(user),
                                       NotificationRecipients = new NotificationRecipient[]
                                                                    {
                                                                        new NotificationRecipient
                                                                            {

                                                                                NotificationDeliveryTypes =
                                                                                    NotificationDeliveryTypes
                                                                                        .Toast |
                                                                                    NotificationDeliveryTypes
                                                                                        .Email,
                                                                                Users = user.Relationships
                                                                                            .Where(
                                                                                                r =>
                                                                                                r.RelationshipName ==
                                                                                                Role.BuiltInRole
                                                                                                    .LineManager
                                                                                                    .ToString())

                                                                            }
                                                                    }
                                   };

           session.Store(notification);
           session.SaveChanges();
            
        }
开发者ID:andyevans2000,项目名称:Illuminate,代码行数:37,代码来源:NotifyManagerAction.cs

示例2: AddNotifications

 private void AddNotifications(IUser user, IUser manager)
 {
     var notifications = _pocoSession.List<Notification>(_numNotificationsPerUser).Get();
     foreach (var notification in notifications)
     {
         notification.Id = Guid.NewGuid();
         notification.NotificationRecipients = new []
                                                   {
                                                       new NotificationRecipient
                                                           {
                                                               NotificationDeliveryTypes =
                                                                   NotificationDeliveryTypes
                                                                       .Email |
                                                                   NotificationDeliveryTypes
                                                                       .Toast,
                                                               Users =
                                                                   new[]
                                                                       {
                                                                           user.ToSimpleUser()
                                                                       }
                                                           }
                                                   };
         Notifications.Add(notification);
     }
 }
开发者ID:andyevans2000,项目名称:Illuminate,代码行数:25,代码来源:OrgCreator.cs

示例3: AddLeaves

        private void AddLeaves(IUser user, IUser manager)
        {
            for (var count = 1; count <= _numLeavesPerUser; count++)
            {
                Leaves.Add(new Leave
                {
                    CurrentProcessOwner = manager.ToSimpleUser(),
                    Id = Guid.NewGuid(),
                    LeaveType = _leaveType,
                    Title = string.Format("test leave for {0}", user.Name),
                    Summary = string.Format("test leave summary for {0} ssa dsasa as dasasdsd dsdsdsd dsd", user.Name),
                    StartOfProcess = DateTime.Now.AddDays(0 - (_rand.Next(365 * _numYearsToGoBack))),
                    Subject = user.ToSimpleUser(),
                    ConsolidatedCompletionDate = DateTime.Now.AddDays(0 - (_rand.Next(365 * _numYearsToGoBack))),

                });
            }

        }
开发者ID:andyevans2000,项目名称:Illuminate,代码行数:19,代码来源:OrgCreator.cs

示例4: AddPraises

 private void AddPraises(IUser user, IUser manager)
 {
     var praises = _pocoSession.List<Praise>(_numPraisesPerUser).Get();
     foreach (var praise in praises)
     {
         praise.Id = Guid.NewGuid();
         praise.SubjectUser = user.ToSimpleUser();
         praise.CreatedBy = manager.ToSimpleUser();
         Praises.Add(praise);
     }
 }
开发者ID:andyevans2000,项目名称:Illuminate,代码行数:11,代码来源:OrgCreator.cs

示例5: AddConcerns

 private void AddConcerns(IUser user, IUser manager)
 {
     var concerns = _pocoSession.List<Concern>(_numConcernsPerUser).Get();
     foreach (var concern in concerns)
     {
         concern.Id = Guid.NewGuid();
         concern.SubjectUser = user.ToSimpleUser();
         concern.CreatedBy = manager.ToSimpleUser();
         Concerns.Add(concern);
     }
 }
开发者ID:andyevans2000,项目名称:Illuminate,代码行数:11,代码来源:OrgCreator.cs

示例6: PasswordReset

        public static void PasswordReset(IUser ou, IDocumentStore store, string password)
        {
            
            var body = GetPasswordResetEmailBody(ou, password)+EmailFooter;
            var notification = new Notification
            {
                About = ou.ToSimpleUser(),
                Body = body,
                Id = IlluminateDatabase.GenerateId<Notification>(),
                SendDate = DateTime.Now,
                Title = "Illuminate Password Reset",
                NotificationRecipients = new[]
                                                                    {
                                                                        new NotificationRecipient
                                                                            {
                                                                                NotificationDeliveryTypes =
                                                                                    NotificationDeliveryTypes.Email,
                                                                                Users = new[]
                                                                                            {
                                                                                                ou.ToSimpleUser()
                                                                                            }
                                                                            }
                                                                    }
            };

            using (var session = store.OpenSession())
            {
                session.Store(notification);
                session.SaveChanges();
            }
        }
开发者ID:andyevans2000,项目名称:Illuminate,代码行数:31,代码来源:Email.cs

示例7: EmailActivation

        public static void EmailActivation(IUser ou, IAuthUser au, IDocumentStore store,string password)
        {
            var activationurl = String.Format("{0}://{1}/{2}", "https", ConfigurationManager.AppSettings["ActivationUrl"], au.ActivationCode);

            var body = GetActivationEmailBody(ou, activationurl, au.ActivationCode,password);
            var notification = new Notification
            {
                About = ou.ToSimpleUser(),
                Body = body,
                Id = IlluminateDatabase.GenerateId<Notification>(),
                SendDate = DateTime.Now,
                Title = "Illuminate Account Activation Code",
                NotificationRecipients = new[]
                                                                    {
                                                                        new NotificationRecipient
                                                                            {
                                                                                NotificationDeliveryTypes =
                                                                                    NotificationDeliveryTypes.Email,
                                                                                Users = new[]
                                                                                            {
                                                                                                ou.ToSimpleUser()
                                                                                            }
                                                                            }
                                                                    }
            };

            using (var session = store.OpenSession())
            {
                session.Store(notification);
                session.SaveChanges();
            }
        }
开发者ID:andyevans2000,项目名称:Illuminate,代码行数:32,代码来源:Email.cs

示例8: GenerateAReward

        private Reward GenerateAReward(IUser user, Random rand)
        {
            
            var now = DateTime.UtcNow.Date;
            var date = RandomDate(rand, now.AddDays(0 - _config.DaysHistory), now);
            var possibleComments = _config.RewardsConfig.PotentialComments;
            var toSkip = rand.Next(0, _possibleAttributes.Count() );
            var toTake = rand.Next(1, _possibleAttributes.Count());
            var reward = new Reward()
            {
  
                Id = IlluminateDatabase.GenerateId<Reward>(),
                Attributes = _possibleAttributes.Skip(toSkip).Take(toTake).ToList(),
                ConsolidatedCompletionDate = date,
                Date = date,
                Message =FormatComment(  possibleComments.ElementAt(rand.Next(0,possibleComments.Count()-1)),user),
                SubjectUser = user.ToSimpleUser(),
                RewardGiver = _config.Users.Where(u=>u.Id!=user.Id).ElementAt(rand.Next(0,_config.Users.Count()-1)).ToSimpleUser(),
                Points = rand.Next(_config.RewardsConfig.MinPoints,_config.RewardsConfig.MaxPoints)
            };

            return reward;
        }
开发者ID:andyevans2000,项目名称:Illuminate,代码行数:23,代码来源:OrgDataGenerator.cs

示例9: FromUser

 /// <summary>
 /// Convert a User into an Invitee with no response status. 
 /// </summary>
 /// <param name="u"></param>
 /// <returns></returns>
 public static Invitee FromUser(IUser u)
 {
     return FromSimpleUser(u.ToSimpleUser()); 
 }
开发者ID:andyevans2000,项目名称:Illuminate,代码行数:9,代码来源:Invitee.cs

示例10: GenerateAConcern

        private Concern GenerateAConcern(IUser user, Random rand)
        {
            var manager = user.Relationships.FirstOrDefault(r => r.RelationshipName == "LineManager");
            if (manager == null)
            {
                return null;
            }
            var now = DateTime.UtcNow.Date;
            var date = RandomDate(rand, now.AddDays(0 - _config.DaysHistory), now);
            var concern = new Concern()
            {
                Comment =FormatComment(
                    _config.ConcernConfig.PotentialComments.ElementAt(rand.Next(0,
                                                                        _config.ConcernConfig.PotentialComments
                                                                               .Count() )),user),
                CreatedBy = manager,
                Id = IlluminateDatabase.GenerateId<Concern>(),
                Severity = rand.Next(Concern.Min, Concern.Max),
                ConsolidatedCompletionDate = date,
                EventDate = date,
                SubjectUser = user.ToSimpleUser()
            };

            return concern;
        }
开发者ID:andyevans2000,项目名称:Illuminate,代码行数:25,代码来源:OrgDataGenerator.cs

示例11: GenerateAPraise

        private Praise GenerateAPraise(IUser user,Random rand)
        {
            var manager = user.Relationships.FirstOrDefault(r => r.RelationshipName == "LineManager");
            if (manager == null)
            {
                return null;
            }
            var now = DateTime.UtcNow.Date;
            var date = RandomDate(rand, now.AddDays(0 - _config.DaysHistory), now);
            var praise = new Praise
                             {
                                 Comment =FormatComment( _config.PraiseConfig.PotentialComments.ElementAt(rand.Next(0,
                                                                                         _config.PraiseConfig.PotentialComments
                                                                                                .Count() - 1)),user)
                                    ,
                                 CreatedBy = manager,
                                 Id = IlluminateDatabase.GenerateId<Praise>(),
                                 Level = rand.Next(Praise.Min, Praise.Max+1),
                                    ConsolidatedCompletionDate = date,
                                    EventDate = date,
                                    SubjectUser = user.ToSimpleUser()
                             };

           return praise;
        }
开发者ID:andyevans2000,项目名称:Illuminate,代码行数:25,代码来源:OrgDataGenerator.cs

示例12: GenerateALeave

        private Leave GenerateALeave(bool isCurrent, IUser user,Random rand)
        {

            var manager = user.Relationships.FirstOrDefault(r => r.RelationshipName == "LineManager");
            if (manager == null)
            {
                return null;
            }
            var leave = new Leave
            {
                CurrentProcessOwner = manager,
                Id = IlluminateDatabase.GenerateId<Leave>(),
                Title = "Annual Leave",
                Subject = user.ToSimpleUser(),
                UserCreatedProcess = manager,
                Summary = "Off to the coast!",
                LeaveType = _leaveType
            };
            
            var now = DateTime.UtcNow.Date;
            if (isCurrent)
            {
                leave.StartOfProcess = RandomDate(rand, now.AddDays(0 - _config.LeaveConfig.MaxDurationDays), now);
                leave.ConsolidatedCompletionDate = now;
            }
            else
            {
                var startDate = RandomDate(rand, now.AddDays(0 - _config.DaysHistory), now);
                var endDate = startDate.AddDays(rand.Next(1, _config.LeaveConfig.MaxDurationDays));
                if (endDate >= now)
                    endDate = now.AddDays(-1);
                leave.ConsolidatedCompletionDate = endDate;
                leave.EndOfProcess = endDate;
                leave.StartOfProcess = startDate;
            }
            leave.Approval = new Approval {ApprovalDate = leave.StartOfProcess.AddDays(-5), ApprovedBy = manager};
            return leave;
        }
开发者ID:andyevans2000,项目名称:Illuminate,代码行数:38,代码来源:OrgDataGenerator.cs

示例13: GenerateATask

        private Task GenerateATask(IUser user, Random rand)
        {
            var manager = user.Relationships.FirstOrDefault(r => r.RelationshipName == "LineManager");
            if (manager == null)
            {
                return null;
            }
            var now = DateTime.UtcNow.Date;
            var dueDate = RandomDate(rand, now.AddDays(0 - 10), now);
            var commentNum = rand.Next(0, _config.TasksConfig.PossibleTitles.Count());
            var task = new Task
                           {
                               AssignedUsers = new List<SimpleUser> {manager},
                               ConsolidatedAssignees = new List<SimpleUser> {manager},
                               CreatedBy = user.ToSimpleUser(),
                               DueDate = dueDate,
                               Id = IlluminateDatabase.GenerateId<Task>(),
                               Title =FormatCommentFullName(_config.TasksConfig.PossibleTitles.ElementAt(commentNum),user) ,

                               Description = FormatCommentFullName(_config.TasksConfig.PossibleDescriptions.ElementAt(commentNum), user),
                               ConsolidatedCompletionDate = now

                           };
            
            

            return task;
        }
开发者ID:andyevans2000,项目名称:Illuminate,代码行数:28,代码来源:OrgDataGenerator.cs

示例14: GenerateASickness

        private Sickness GenerateASickness(bool isCurrent,IUser user,Random rand)
        {
            
            var sicknessReason = _sicknessClassification.GetRandomReason(rand);
            var manager = user.Relationships.FirstOrDefault(r => r.RelationshipName == "LineManager");
            if (manager == null)
            {
                return null;
            }
            var sickness = new Sickness
                               {
                                   CurrentProcessOwner = manager,
                                   Id = IlluminateDatabase.GenerateId<Sickness>(),
                                   SicknessReason = SicknessReasonSimple.Create(sicknessReason),
                                   Subject = user.ToSimpleUser(),
                                   UserCreatedProcess = manager,
                                   Title = sicknessReason.FullName,
                                   Summary = sicknessReason.Description


                               };
            var now = DateTime.UtcNow.Date;
            if (isCurrent)
            {
                sickness.StartOfProcess = RandomDate(rand, now.AddDays(0 - _config.SicknessConfig.MaxDurationDays), now);
                sickness.ConsolidatedCompletionDate = now;
            }
            else
            {
                var startDate = RandomDate(rand, now.AddDays(0 - _config.DaysHistory), now);
                var endDate = startDate.AddDays(rand.Next(1, _config.SicknessConfig.MaxDurationDays));
                if (endDate >= now)
                    endDate = now.AddDays(-1);
                sickness.ConsolidatedCompletionDate = endDate;
                sickness.EndOfProcess = endDate;
                sickness.StartOfProcess = startDate;
            }
            
            return sickness;
        }
开发者ID:andyevans2000,项目名称:Illuminate,代码行数:40,代码来源:OrgDataGenerator.cs


注:本文中的IUser.ToSimpleUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。