public DataBook Check(int ID, string Reason, string Checker, int?Day, bool?Check, CheckStatus status) { if (string.IsNullOrEmpty(Checker)) { return(null); } var book = Get(ID); if (book == null) { throw new ArgumentException("内部服务器错误!"); } if (status == CheckStatus.Agree) { ADController.AddUserToGroup(book.sAMAccountName, book.GroupName); } if (status != CheckStatus.Wait) { book.Checker = Checker; book.Reason = Reason; book.CheckTime = DateTime.Now; book.Status = status; var time = book.CheckTime; if (Day.HasValue) { time = time.AddDays(Day.Value); } var span = time.Subtract(book.CheckTime); if (span.Days == 0 && span.Minutes == 0 && span.Hours == 0 && span.Seconds == 0) { time = new DateTime(9999, 12, 31, 12, 00, 00); } if (Check.HasValue && Check.Value) { time = new DateTime(9999, 12, 31, 12, 00, 00); } book.MaturityTime = time; Edit(book); } return(book); }