public Lease ProlongLease(Lease oldLease, string authenticatedUserName, DateTime time) { Lease newLease = new Lease { License = oldLease.License, AuthenticatedUser = authenticatedUserName, OverwritesLease = oldLease, StartTime = oldLease.StartTime, EndTime = time.AddDays(Settings.Default.NewLeaseDays), Machine = oldLease.Machine, UserName = oldLease.UserName, Grace = oldLease.Grace }; if (!this.FixLease(newLease, time)) { return(null); } this.Leases.InsertOnSubmit(newLease); LeaseService.CheckAssertions(this, newLease.License, time); return(newLease); }
public Lease CreateLease(License license, string user, string machine, string authenticatedUserName, DateTime time, bool grace) { Lease lease = new Lease { License = license, AuthenticatedUser = authenticatedUserName, EndTime = time.AddDays(Settings.Default.NewLeaseDays), Machine = machine, StartTime = time, UserName = user, Grace = grace }; if (!this.FixLease(lease, time)) { return(null); } this.Leases.InsertOnSubmit((lease)); LeaseService.CheckAssertions(this, license, time); return(lease); }