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


C# UserService.Delete方法代码示例

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


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

示例1: Execute

        /// <summary> 
        /// Job that updates the JobPulse setting with the current date/time.
        /// This will allow us to notify an admin if the jobs stop running.
        /// 
        /// Called by the <see cref="IScheduler" /> when a
        /// <see cref="ITrigger" /> fires that is associated with
        /// the <see cref="IJob" />.
        /// </summary>
        public virtual void Execute(IJobExecutionContext context)
        {
            // get the job map
            JobDataMap dataMap = context.JobDetail.JobDataMap;

            // delete accounts that have not been confirmed in X hours
            int userExpireHours = Int32.Parse( dataMap.GetString( "HoursKeepUnconfirmedAccounts" ) );
            DateTime userAccountExpireDate = DateTime.Now.Add( new TimeSpan( userExpireHours * -1,0,0 ) );

            UserService userService = new UserService();

            foreach (var user in userService.Queryable().Where(u => u.IsConfirmed == false && u.CreationDate < userAccountExpireDate))
            {
                userService.Delete( user, null );
            }

            userService.Save( null, null );

            // purge exception log
            int exceptionExpireDays = Int32.Parse( dataMap.GetString( "DaysKeepExceptions" ) );
            DateTime exceptionExpireDate = DateTime.Now.Add( new TimeSpan( userExpireHours * -1, 0, 0 ) );

            ExceptionLogService exceptionLogService = new ExceptionLogService();

            foreach ( var exception in exceptionLogService.Queryable().Where( e => e.ExceptionDate < exceptionExpireDate ) )
            {
                exceptionLogService.Delete( exception, null );
            }

            exceptionLogService.Save( null, null );
        }
开发者ID:jh2mhs8,项目名称:Rock-ChMS,代码行数:39,代码来源:RockCleanup.cs

示例2: DeleteAssigned

        public void DeleteAssigned()
        {
            ProjectService service = new ProjectService();
            Project project = (Project) CreateRecord();
            Insert(project);

            UserService userService = new UserService();
            User manager = new User(UserRole.Manager, String.Format("project{0}User", project.ID), "asdf");
            userService.Insert(manager);

            service.Assign(project.ID, manager.ID);

            service.Delete(project.ID);

            Assert.AreEqual(0, service.GetByUser(manager.ID).Count);

            userService.Delete(manager.ID);
        }
开发者ID:jrummell,项目名称:projmgt-net,代码行数:18,代码来源:ProjectServiceTests.cs

示例3: DeleteUser

        TestResult DeleteUser()
        {
            using (var unitOfWork = new UnitOfWork(new AuthorizationModuleFactory(false)))
            {
                var UserService = new UserService(unitOfWork);
                var testUser = UserService.Get(user => user.Login == "ivan_test++").FirstOrDefault();
                UserService.Delete(testUser);

                try
                {
                    var result = unitOfWork.Commit();
                    if (result.Count > 0)
                        return new TestResult(TestResultType.Failure, MethodBase.GetCurrentMethod().Name, result.First().ErrorMessage);
                }
                catch (Exception ex)
                {
                    while (ex.InnerException != null)
                        ex = ex.InnerException;
                    return new TestResult(TestResultType.Failure, MethodBase.GetCurrentMethod().Name, ex.Message);
                }

            }

            using (var unitOfWork = new UnitOfWork(new AuthorizationModuleFactory(false)))
            {
                var UserService = new UserService(unitOfWork);
                User testUser = UserService.Get(user => user.Login == "ivan_test++").FirstOrDefault();
                if (testUser != null)
                    return new TestResult(TestResultType.Failure, MethodBase.GetCurrentMethod().Name, "Can find deleted user.");
                else
                    return new TestResult(TestResultType.Success, MethodBase.GetCurrentMethod().Name, "User deleted successfully.");
            }
        }
开发者ID:vano-lukashuk,项目名称:StudentBank,代码行数:33,代码来源:UserTest.cs

示例4: TestFixtureTearDown

        public override void TestFixtureTearDown()
        {
            UserService userService = new UserService();
            userService.Delete(_manager.ID);

            base.TestFixtureTearDown();
        }
开发者ID:jrummell,项目名称:projmgt-net,代码行数:7,代码来源:ProjectServiceTests.cs

示例5: TestFixtureTearDown

        public override void TestFixtureTearDown()
        {
            base.TestFixtureTearDown();

            ModuleService moduleService = new ModuleService();
            moduleService.Delete(_module.ID);

            ProjectService projectService = new ProjectService();
            projectService.Delete(_project.ID);

            UserService userService = new UserService();
            userService.Delete(_developer.ID);
        }
开发者ID:jrummell,项目名称:projmgt-net,代码行数:13,代码来源:TaskServiceTests.cs


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