public static bool Examine(DataBook book,out string Error)
 {
     Error = string.Empty;
     if (book.Span.Days > 0 || book.Span.Hours > 0 || book.Span.Minutes > 0 || book.Span.Seconds > 0)
     {
         return false;
     }
     string str = string.Empty;
     if (ADController.DeleteUserFromGroup(book.Name, book.GroupName, out str))
     {
         book.Label = true;
         try
         {
             Edit(book);
         }catch(Exception ex){
             Error = ex.Message;
             return false;
         }
     }
     else
     {
         Error = str;
         return false;
     }
     return true;
 }
 public int Add(DataBook Book)
 {
     using (var db = GetJURDataContext())
     {
         db.DataBooks.Add(Book);
         db.SaveChanges();
         return Book.ID;
     }
 }
 public void Add(DataBook book, string Sender)
 {
     Add(new Message()
     {
         Sender = Sender,
         Info = String.Format("申请{0}的权限已经确认!", book.GroupName),
         Receiver = book.Name
     });
 }
 public static void Edit(DataBook Book)
 {
     using (var db = GetJURDataContext())
     {
         var entry = db.DataBooks.Find(Book.ID);
         if (entry != null)
         {
             db.Entry(entry).CurrentValues.SetValues(Book);
             db.SaveChanges();
         }
     }
 }
 public void Edit(DataBook Book)
 {
     using (var db = GetJURDataContext())
     {
         var entry = db.DataBooks.Find(Book.ID);
         if (entry != null)
         {
             //entry.Reason = Book.Reason;
             //entry.Checker = Book.Checker;
             //entry.Check = Book.Check;
             Book.ID=entry.ID;
             db.Entry(entry).CurrentValues.SetValues(Book);
             db.SaveChanges();
         }
     }
 }