//Esta funcion permite crear un nuevo Usuario public void Create(BaseEntity pojo) { try { if (pojo == null) { throw new BusinessException(3); } Usuario usuario = (Usuario)pojo; var u = crudFactory.RetrieveAll <Usuario>(). FirstOrDefault(x => x.nombreUsuario.ToLower() == usuario.nombreUsuario.ToLower()); if (u != null) { throw new BusinessException(1); } crudFactory.Create(pojo); } catch (Exception ex) { ExceptionManager.GetInstance().Process(ex); } }
public void Create(Usuario usuario) { try { HashedPass = GetMD5(usuario.Contrasena); usuario.Contrasena = HashedPass; _crudFactory.Create(usuario); gestorAccion.Create(AccionPara); } catch (TRV_Exception ex) { throw ex; } catch (SqlException sqlEx) { if (sqlEx.Number == 2627) //2627, es para llaves duplicadas. { throw gestorEx.controlarExcepcion(new TRV_Exception(TRV_Exception.ExceptionCode.CedulaDuplicada)); } } catch (Exception e) { throw e; } }
public void Create(Usuario usuario) { try { var userDB = _crudUsuario.Retrieve <Usuario>(usuario); if (userDB != null) { throw new BusinessException(207); } usuario.PasswordSalt = GenerateSalt(); usuario.PasswordHash = GenerateHash(usuario.Password, usuario.PasswordSalt); usuario.PasswordLastSet = DateTime.Now; _crudUsuario.Create(usuario); //Record password history _crudContrasena.Create(new HistorialContrasena { Email = usuario.Email, PasswordHash = usuario.PasswordHash, Fecha = usuario.PasswordLastSet }); } catch (Exception e) { ExceptionManager.GetInstance().Process(e); } }
public async Task CreateAsync(Usuario usuario) { try { var c = crudUsuario.Exists <Usuario>(usuario); if (c != null) { // Ya existe un usuario con esos datos throw new BussinessException(10); } crudUsuario.Create(usuario); var mng = new Rol_UsuarioManager(); foreach (string rol in usuario.Roles) { var rolUsuario = new Rol_Usuario { IdRol = rol, IdUsuario = usuario.Identificacion }; mng.Create(rolUsuario); } Response response = await EnviarCorreoManager.GetInstance().ExecuteVerificacionUsuario(usuario); } catch (Exception ex) { ExceptionManager.GetInstance().Process(ex); } }
public void Create(Usuario usuario) { try { var c = crudUsuario.Retrieve <Usuario>(usuario); if (c != null) { //Usuario already exists. throw new BussinessException(3); } crudUsuario.Create(usuario); } catch (Exception ex) { ExceptionManager.GetInstance().Process(ex); } }
public void Create(Usuario entidad) { try { var c = crud.Retrieve <Usuario>(entidad); if (c != null) { } else { crud.Create(entidad); } } catch (Exception ex) { ExceptionManager.GetInstance().Process(ex); } }
public void Create(Usuario user) { try { var c = crudUsuario.Retrieve <Usuario>(user); if (c != null) { //Usuario already exist throw new Exception("Error. Usuario ya existe"); } else { crudUsuario.Create(user); } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public void Create(Usuario usuario) { crudUsuario.Create(usuario); }