public bool Delete(string login, string password, int ProdutoId) { LogBLL log = new LogBLL(); bool valid = false; try { User u = new User(); u.Login = login; u.Password = password; u = Authentication.Login(u); log.log.UserId = u.UserId; Authentication.HaveAccess(u); valid = controller.DeleteConfirmed(ProdutoId); } catch (Exception e) { log.log.Exception = e.Message; throw e; } finally { log.Create(); } return valid; }
public Categoria Create(string login, string password, Categoria Categoria) { LogBLL log = new LogBLL(); try { User u = new User(); u.Login = login; u.Password = password; u = Authentication.Login(u); log.log.UserId = u.UserId; Authentication.HaveAccess(u); Categoria = controller.Create(Categoria); } catch (Exception e) { log.log.Exception = e.Message; throw e; } finally { log.Create(); } return Categoria; }
public Produto Create(string login, string password, Produto Produto) { LogBLL log = new LogBLL(); try { User u = new User(); u.Login = login; u.Password = password; u = Authentication.Login(u); log.log.UserId = u.UserId; Authentication.HaveAccess(u); Produto = controller.Create(Produto); } catch (Exception e) { log.log.Exception = e.Message; throw e; } finally { log.Create(); } return Produto; }
public bool CreateUser(int UserProfile, string Name, string Login, string Password) { User u = new User(); u.Name = Name; u.Login = Login; u.Password = Password; u.DateCreated = DateTime.Now; u.DateLastLogin = null; u.UserProfileId = UserProfile; return sys.CreateUser(u); }
public Produto[] ListByUserPreferences(string login, string password) { LogBLL log = new LogBLL(); Produto[] list; try { User u = new User(); u.Login = login; u.Password = password; u = Authentication.Login(u); log.log.UserId = u.UserId; Authentication.HaveAccess(u); list = controller.ListByUserPreferences(u.UserId); } catch (Exception e) { log.log.Exception = e.Message; throw e; } finally { log.Create(); } return list; }
public bool UpdateAndroidUserPreferences(string login, string password, int[] interesses) { LogBLL log = new LogBLL(); bool valid = false; try { User u = new User(); u.Login = login; u.Password = password; u = Authentication.Login(u); log.log.UserId = u.UserId; Authentication.HaveAccess(u); valid = controller.UpdateAndroidUserPreferences(u.UserId, interesses); } catch (Exception e) { log.log.Exception = e.Message; throw e; } finally { log.Create(); } return valid; }
public bool Edit(string login, string password, Empresa Empresa) { LogBLL log = new LogBLL(); bool valid = false; try { User u = new User(); u.Login = login; u.Password = password; u = Authentication.Login(u); log.log.UserId = u.UserId; Authentication.HaveAccess(u); valid = controller.Edit(Empresa); } catch (Exception e) { log.log.Exception = e.Message; throw e; } finally { log.Create(); } return valid; }
public Empresa[] Index(string login, string password) { LogBLL log = new LogBLL(); Empresa[] list; try { User u = new User(); u.Login = login; u.Password = password; u = Authentication.Login(u); log.log.UserId = u.UserId; Authentication.HaveAccess(u); list = controller.Index(); } catch (Exception e) { log.log.Exception = e.Message; throw e; } finally { log.Create(); } return list; }
public Empresa Find(string login, string password, int EmpresaId) { LogBLL log = new LogBLL(); Empresa Empresa = null; try { User u = new User(); u.Login = login; u.Password = password; u = Authentication.Login(u); log.log.UserId = u.UserId; Authentication.HaveAccess(u); Empresa = controller.Find(EmpresaId); } catch (Exception e) { log.log.Exception = e.Message; throw e; } finally { log.Create(); } return Empresa; }
public bool CreateUser(User user) { user.DateCreated = DateTime.Now; db.Users.Add(user); return db.SaveChanges() > 0; }