Пример #1
0
 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;
 }
Пример #2
0
 public int Add(DataBook Book)
 {
     using (var db = GetJURDataContext())
     {
         db.DataBooks.Add(Book);
         db.SaveChanges();
         return Book.ID;
     }
 }
Пример #3
0
 public void Add(DataBook book, string Sender)
 {
     Add(new Message()
     {
         Sender = Sender,
         Info = String.Format("申请{0}的权限已经确认!", book.GroupName),
         Receiver = book.Name
     });
 }
Пример #4
0
 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();
         }
     }
 }
Пример #5
0
 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();
         }
     }
 }