public ResponseEntity RegistrarPersonalUsuario(SRV_PERSONAL personal, SRV_USUARIO usuario) { try { var existeUsuario = _usuarioData.ExisteUsuarioReg(usuario); if (existeUsuario) { return(new ResponseEntity("El correo que ingreso ya se encuentra registrado")); } var existePersonal = _personalData.ExistePersonal(personal); if (existePersonal) { return(new ResponseEntity("El DNI que ingreso ya se encuentra registrado")); } using (var scope = new TransactionScope()) { usuario.CODPER = (int)PerfilesSistema.USUARIOSISTEMA; var usuarioReg = _usuarioData.Registrar(usuario); personal.CODUSU = usuarioReg.CODUSU; var personalReg = _personalData.Registrar(personal); scope.Complete(); } return(new ResponseEntity("Registro un personal satisfactoriamente", true)); } catch (Exception) { return(new ResponseEntity(Response.ErrorGeneral)); } }
public ResponseEntity ActualizarPersonalUsuario(SRV_PERSONAL personal, SRV_USUARIO usuario) { try { var personalReg = _personalData.BuscarPorId(personal.CODPER); using (var scope = new TransactionScope()) { if (!string.IsNullOrEmpty(usuario.CLAUSU)) { var usuarioReg = _usuarioData.BuscarPorId(usuario.CODUSU); usuarioReg.CLAUSU = usuario.CLAUSU; _usuarioData.Actualizar(usuarioReg); } personalReg.NOMPER = personal.NOMPER; personalReg.APEPER = personal.APEPER; _personalData.Actualizar(personalReg); scope.Complete(); } return(new ResponseEntity("Se actualizo un personal satisfactoriamente", true)); } catch (Exception) { return(new ResponseEntity(Response.ErrorGeneral)); } }
public IEnumerable <SRV_VW_CONSULTA_PERSONAL> ListarPersonal(SRV_PERSONAL personal) { if (!string.IsNullOrEmpty(personal.DNIPER) && !string.IsNullOrEmpty(personal.NOMPER) && !string.IsNullOrEmpty(personal.APEPER)) { return(this.GetMany(c => c.DNIPER.Equals(personal.DNIPER) && c.NOMPER.ToLower().Contains(personal.NOMPER.ToLower()) && c.APEPER.ToLower().Contains(personal.APEPER.ToLower()))); } if (!string.IsNullOrEmpty(personal.DNIPER) && !string.IsNullOrEmpty(personal.NOMPER) && string.IsNullOrEmpty(personal.APEPER)) { return(this.GetMany(c => c.DNIPER.Equals(personal.DNIPER) && c.NOMPER.ToLower().Contains(personal.NOMPER.ToLower()))); } if (!string.IsNullOrEmpty(personal.DNIPER) && string.IsNullOrEmpty(personal.NOMPER) && string.IsNullOrEmpty(personal.APEPER)) { return(this.GetMany(c => c.DNIPER.Equals(personal.DNIPER))); } if (string.IsNullOrEmpty(personal.DNIPER) && !string.IsNullOrEmpty(personal.NOMPER) && !string.IsNullOrEmpty(personal.APEPER)) { return(this.GetMany(c => c.NOMPER.ToLower().Contains(personal.NOMPER.ToLower()) && c.APEPER.ToLower().Contains(personal.APEPER.ToLower()))); } if (string.IsNullOrEmpty(personal.DNIPER) && string.IsNullOrEmpty(personal.NOMPER) && !string.IsNullOrEmpty(personal.APEPER)) { return(this.GetMany(c => c.APEPER.ToLower().Contains(personal.APEPER.ToLower()))); } if (string.IsNullOrEmpty(personal.DNIPER) && !string.IsNullOrEmpty(personal.NOMPER) && string.IsNullOrEmpty(personal.APEPER)) { return(this.GetMany(c => c.NOMPER.ToLower().Contains(personal.NOMPER.ToLower()))); } return(this.GetMany()); }
public IEnumerable <SRV_VW_CONSULTA_PERSONAL> ListarPersonal(SRV_PERSONAL personal) { return(this._consultaPersonalData.ListarPersonal(personal)); }