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 Crud Create(string login, string password, string name) { LogBLL log = new LogBLL(); Crud crud = new Crud(); try { User u = new User(); u.Login = login; u.Password = password; u = Authentication.Login(u); log.log.UserId = u.UserId; Authentication.HaveAccess(u); crud.Name = name; crud = controller.Create(crud); } catch (Exception e) { log.log.Exception = e.Message; throw e; } finally { log.Create(); } return crud; }
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 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 bool CreateSelectingUserProfile(string login, string name, string password, string email, string sexo, string apptoken, int? userprofile) { LogBLL log = new LogBLL(); bool success = false; try { Client cl = new Client(); cl.Token = new Guid(apptoken); cl = bll.FindClient(cl); if (cl == null) throw new SecurityException("Token inválido!"); UserProfile up = new UserProfile(); up.ClientId = cl.ClientId; if (userprofile != null) up.UserProfileId = Convert.ToInt32(userprofile); up = bll.FindUserProfile(up); if (up == null || ! (up.UserProfileId > 0)) throw new SecurityException("Perfil de usuario não encontrado!"); User user = new User(); user.Login = login; user.Name = name; user.Password = password; user.Email = email; user.Sexo = sexo; user.UserProfileId = up.UserProfileId; success = bll.CreateUser(user); } catch (Exception e) { log.log.Exception = e.Message; throw e; } finally { log.Create(); } return success; }
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 Crud[] Index(string login, string password) { LogBLL log = new LogBLL(); Crud[] 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 Crud Find(string login, string password, int crudId) { LogBLL log = new LogBLL(); Crud Crud = null; try { User u = new User(); u.Login = login; u.Password = password; u = Authentication.Login(u); log.log.UserId = u.UserId; Authentication.HaveAccess(u); Crud = controller.Find(crudId); } catch (Exception e) { log.log.Exception = e.Message; throw e; } finally { log.Create(); } return Crud; }
public User Login(string login, string password) { LogBLL log = new LogBLL(); User user = new User(); try { user.Login = login; user.Password = password; user = Authentication.Login(user); } catch (Exception e) { log.log.Exception = e.Message; } finally { log.Create(); } return user; }
public User[] IndexFiltering(string login, string password, PerfilUsuarioEnum perfilusuario) { LogBLL log = new LogBLL(); User[] 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 = db.Users.Where(us => us.UserProfileId == (int)perfilusuario).ToArray(); } catch (Exception e) { log.log.Exception = e.Message; throw e; } finally { log.Create(); } return list; }
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; }