本文整理汇总了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 );
}
示例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);
}
示例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.");
}
}
示例4: TestFixtureTearDown
public override void TestFixtureTearDown()
{
UserService userService = new UserService();
userService.Delete(_manager.ID);
base.TestFixtureTearDown();
}
示例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);
}