private async Task <UserResponse> SetUsuario(SetUserRequest request) { UserResponse _response = new UserResponse(); try { //Recuperamos el usuario de la tabla Person_Person entity = GetPerson(Guid.Parse(request.id)); if (entity == null) { _response.ValidationResults.Add(new ValidationResult("No existe persona", new[] { "No existe persona" })); return(_response); } //Modificamos el person var entityUpdate = await UpdatePersonDb(entity, request); return(_mapper.Parse(entityUpdate)); } catch (CError e) { var jsonModel = JsonConvert.SerializeObject(request); throw _errorManager.AddError("Error Generico", "SetUsuario", e, MethodBase.GetCurrentMethod(), jsonModel); } catch (System.Exception ex) { var jsonModel = JsonConvert.SerializeObject(request); throw _errorManager.AddError("Error Set Usuario", "SetUsuario", ex, MethodBase.GetCurrentMethod(), jsonModel); } }
/// public UserResponse Parse(Person_Person dto) { UserResponse response = new UserResponse(); response.Id = dto.UID.ToString(); response.Foto = !string.IsNullOrEmpty(dto.Foto) ? dto.Foto : ""; response.UiCompany = dto.UID_COMPANY.ToString(); response.Nombre = dto.Nombre; response.Apellidos = dto.Apellidos; response.NombreCompleto = ""; response.Email = !string.IsNullOrEmpty(dto.Email) ? dto.Email : ""; response.IdTypePerson = dto.UID_TIPOPERSONAL == null ? Guid.Empty : dto.UID_TIPOPERSONAL; response.TlfMovil = dto.Telefono; response.TflFijo = dto.Telefono2; response.Direccion = dto.Direccion; response.Ciudad = dto.Ciudad; response.Provincia = dto.Provincia; response.CodigoPostal = dto.CodigoPostal; response.Sexo = dto.Sexo; response.DNI = dto.DNI; response.FNacimiento = dto.FechaNacimiento; response.Talla = dto.Talla; response.NumeroCuenta = dto.Num_Cuenta; response.DomiciliarRecibos = dto.DomiciliarRecibos.HasValue; return(response); }
protected PaginationViewModel() { session = new UnitOfWork(); AvailablePersonCollection = new XPCollection <Person_Person>(session); SelectedPerson = new Person_Person(session); }
protected CardViewModel() { session = new UnitOfWork(); AvailablePersonCollection = new XPCollection <Person_Person>(session); SelectedPerson = new Person_Person(session); SelectedPersonCollection = new ObservableCollection <Person_Person>(); }
private async Task <Person_Person> InsertUsuario(AddUserRequest usuario) { try { string codeUser = GetCodeUser(Guid.Parse(usuario.uiCompany)); Person_Person _entity = new Person_Person(); _entity.UID_COMPANY = Guid.Parse(usuario.uiCompany); _entity.Code = codeUser; _entity.Activo = true; _entity.Fecha_Alta = DateTime.Now; _entity.UID_TIPOPERSONAL = Guid.Parse(usuario.idTypePersona); _entity.Nombre = usuario.Nombre; _entity.Apellidos = usuario.Apellidos; _entity.Telefono = usuario.Movil; _entity.Telefono2 = usuario.TlfFijo; _entity.Email = usuario.Email; _entity.Direccion = usuario.Direccion; _entity.Ciudad = usuario.Ciudad; _entity.Provincia = usuario.Provincia; _entity.CodigoPostal = usuario.CodigPostal; _entity.Foto = usuario.Foto; _entity.Sexo = usuario.Sexo; _entity.DNI = usuario.DNI; _entity.FechaNacimiento = usuario.FNacimiento; _entity.Nacionalidad = usuario.Nacionalidad; _entity.Talla = usuario.Talla; _entity.Num_Cuenta = usuario.NumeroCuenta; _entity.DomiciliarRecibos = usuario.DomiciliarRecibos; _entity.Observaciones = usuario.Observaciones; await _iunitOfWork.PersonPersonRepository.InsertEntity(_entity); await _iunitOfWork.PersonPersonRepository.SaverChangeAsyc(); return(_entity); } catch (System.Exception ex) { var jsonModel = JsonConvert.SerializeObject(usuario); throw _errorManager.AddError("Error Crear Usuario", "CrearUsuario", ex, MethodBase.GetCurrentMethod(), jsonModel); } }
private async Task <Person_Person> UpdatePersonDb(Person_Person entity, SetUserRequest request) { try { entity.UID_TIPOPERSONAL = Guid.Parse(request.idTypePersona); entity.Nombre = request.nombre; entity.Apellidos = request.apellidos; entity.Telefono = request.movil; entity.Telefono2 = request.fijo; entity.Email = request.email; entity.Direccion = request.direccion; entity.Ciudad = request.ciudad; entity.Provincia = request.provincia; entity.CodigoPostal = request.codigoPostal; entity.Foto = request.foto; entity.Sexo = request.sexo; entity.DNI = request.dni; entity.FechaNacimiento = request.fechaNacimiento; entity.Nacionalidad = request.nacionalidad; entity.Talla = request.talla; entity.Num_Cuenta = request.numCuenta; entity.DomiciliarRecibos = request.domiciliarRecibos; entity.Observaciones = request.observaciones; await _iunitOfWork.PersonPersonRepository.UpdateAsync(entity); return(entity); } catch (CError e) { var jsonModel = JsonConvert.SerializeObject(request); throw _errorManager.AddError("Error Generico", "UpdatePersonDb", e, MethodBase.GetCurrentMethod(), jsonModel); } catch (System.Exception ex) { var jsonModel = JsonConvert.SerializeObject(request); throw _errorManager.AddError("Error Generico", "UpdatePersonDb", ex, MethodBase.GetCurrentMethod(), jsonModel); } }
public void OnCreateButtonCommand() { SelectedPerson = new Person_Person(session); }