示例#1
0
 public bool ChangePassword(AndroidToolkitDB db, int id, string newPassword, string oldPassword)
 {
     try
     {
         AndroidToolkit.Admin editAdmin = _db.Admins.FirstOrDefault(a => a.ID == id);
         if (editAdmin != null && editAdmin.Password == oldPassword)
         {
             editAdmin.Password = newPassword;
             _db.Admins.AddOrUpdate(editAdmin);
             _db.SaveChanges();
             return(true);
         }
         //if (editAdmin != null)
         //{
         //    editAdmin.Password = newPassword;
         //    db.Admins.Attach(editAdmin);
         //    db.Entry(editAdmin).State = EntityState.Modified;
         //    db.SaveChanges();
         //    return true;
         //}
         return(false);
     }
     catch (Exception ex)
     {
         MetroMessageBoxHelper.ShowBox("ERROR", ex.ToString(), 400, 200);
         return(false);
     }
 }
 public bool Edit(AndroidToolkitDB _db)
 {
     try
     {
         _db.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         MetroMessageBoxHelper.ShowBox("Error", ex.ToString(), 400, 200);
         return(false);
     }
 }
示例#3
0
 protected virtual void Dispose(bool disposing)
 {
     if (!_disposed)
     {
         if (disposing)
         {
             _db = null;
             GC.Collect();
             GC.SuppressFinalize(this);
         }
     }
     _disposed = true;
 }
 public bool Delete(AndroidToolkitDB _db, Device device)
 {
     try
     {
         _db.Devices.Remove(device);
         _db.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         MetroMessageBoxHelper.ShowBox("Error", ex.ToString(), 400, 200);
         return(false);
     }
 }
示例#5
0
 public bool CreateAdmin(AndroidToolkitDB db, string name, string username, string password)
 {
     try
     {
         _db.Admins.Add(new AndroidToolkit.Admin()
         {
             Name = name, Username = username, Password = password
         });
         _db.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         MetroMessageBoxHelper.ShowBox("Error", ex.ToString(), 400, 200);
         return(false);
     }
 }
 public bool CreateDevice(AndroidToolkitDB _db, string name, string cwm, string cwmTouch, string twrp, string deviceImg = null)
 {
     try
     {
         _device = new Device()
         {
             Name             = name,
             CWMRecovery      = cwm,
             CWMTouchRecovery = cwmTouch,
             TWRPRecovery     = twrp,
             DeviceImg        = deviceImg
         };
         _db.Devices.Add(_device);
         _db.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         MetroMessageBoxHelper.ShowBox("Error", ex.ToString(), 400, 200);
         return(false);
     }
 }
示例#7
0
 public AdminManager()
 {
     _db = new AndroidToolkitDB();
 }
 public HelpsRepository(AndroidToolkitDB context)
     : base(context)
 {
 }
 public BugReportsRepository(AndroidToolkitDB context)
     : base(context)
 {
 }
示例#10
0
 public RecoveriesRepository(AndroidToolkitDB db)
 {
     _db = db;
 }
 public GenericRepository(AndroidToolkitDB context)
 {
     this.Context = context;
     this.DbSet   = context.Set <TEntity>();
 }
 public DeviceRepository(AndroidToolkitDB db)
 {
     _db = db;
 }
 public ReviewsRepository(AndroidToolkitDB context) : base(context)
 {
 }