public void ModificarTest() { decimal BalanceActual; Persona persona; bool paso; Prestamo prestamo = new Prestamo(); prestamo.PrestamoId = 1; prestamo.Fecha = DateTime.Now; prestamo.PersonaId = 1; prestamo.Concepto = "Prestamo Detalle"; prestamo.Monto = 50000; prestamo.Balance = prestamo.Monto; paso = PrestamoBLL.Guardar(prestamo); persona = PersonaBLL.Buscar(prestamo.PersonaId); BalanceActual = persona.Balance; if (5000 < BalanceActual) { paso = true; } else { paso = false; } Assert.AreEqual(paso, true); }
private void ConsultarButton_Click(object sender, RoutedEventArgs e) { var listado = new List <Persona>(); if (string.IsNullOrWhiteSpace(CriterioTextBox.Text)) { listado = PersonaBLL.GetList(); } else { switch (FiltroComboBox.SelectedIndex) { case 1: listado = PersonaBLL.GetList(e => e.PersonaId == Convert.ToInt32(CriterioTextBox.Text)); break; case 2: listado = PersonaBLL.GetList(e => e.Nombres.Contains(CriterioTextBox.Text)); break; } } DatosDataGrid.ItemsSource = null; DatosDataGrid.ItemsSource = listado; }
public IHttpActionResult PutPersona(int id, Persona persona) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != persona.idPersona) { return(BadRequest()); } try { PersonaBLL.Update(persona); return(Content(HttpStatusCode.OK, "Persona actualizada correctamente")); } catch (Exception ex) { Persona per = PersonaBLL.Get(id); if (per == null) { return(NotFound()); } else { return(StatusCode(HttpStatusCode.NoContent)); } } }
public void GetListTest() { var Lista = new List <Personas>(); Lista = PersonaBLL.GetList(p => true); Assert.AreEqual(Lista, Lista); }
public void EliminarTest() { bool paso; paso = PersonaBLL.Eliminar(2); Assert.AreEqual(paso, true); }
private void ConsultarBoton_Click(object sender, RoutedEventArgs e) { var listado = new List <Personas>(); string criterio = CriterioTextBox.Text.Trim(); if (criterio.Length > 0) { switch (FiltroComboBox.SelectedIndex) { case 0: listado = PersonaBLL.GetList(p => p.PersonaId == Utilities.ToInt(CriterioTextBox.Text)); break; case 1: listado = PersonaBLL.GetList(p => p.Nombres.ToLower().Contains(criterio.ToLower())); break; } } else { listado = PersonaBLL.GetList(c => true); } DatosDataGrid.ItemsSource = null; DatosDataGrid.ItemsSource = listado; }
private void GuardarButton_Click(object sender, EventArgs e) { Personas persona; bool paso = false; if (!Validar()) { return; } persona = LlenaClase(); //determina si es guardar o modificar if (IDnumericUpDown.Value == 0) { paso = PersonaBLL.Guardar(persona); } else { if (!ExisteEnLaBaseDeDatos()) { MessageBox.Show("no esiste en la vase de datos", "fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } paso = PersonaBLL.Modificar(persona); } if (paso) { MessageBox.Show("Guardado!!", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("guardado!!", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void BuscarButton_Click(object sender, RoutedEventArgs e) { var listado = new List <Personas>(); if (CriterioTextBox.Text.Trim().Length > 0) { switch (FiltroComboBox.SelectedIndex) { case 0: listado = PersonaBLL.GetList(e => e.PersonaId == this.ToInt(CriterioTextBox.Text)); break; case 1: listado = PersonaBLL.GetList(e => e.Nombres == this.CriterioTextBox.Text); break; } } else { listado = PersonaBLL.GetList(c => true); } DatosDataGrid.ItemsSource = null; DatosDataGrid.ItemsSource = listado; }
private void EliminarButton_Click(object sender, RoutedEventArgs e) { var pers = PersonaBLL.Buscar(Convert.ToInt32(PersonaComboBox.SelectedValue)); if (pers != null) { BalanceTextBox.Text = Convert.ToString(pers.Balance); decimal nuevoBalance = Convert.ToDecimal(BalanceTextBox.Text) - Convert.ToDecimal(MontoTextBox.Text); pers.Balance = nuevoBalance; PersonaBLL.Guardar(pers); this.DataContext = prestamo; if (PrestamoBLL.Eliminar(Convert.ToInt32(PrestamoIdTextBox.Text))) { Limpiar(); MessageBox.Show("Registro Eliminado con exito", "Exito", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show("No se pudo Eliminar", "Fallo", MessageBoxButton.OK, MessageBoxImage.Error); } } else { MessageBox.Show("Transaccion Fallida Persona no encontrada", "Fallo", MessageBoxButton.OK, MessageBoxImage.Error); } }
public void GetListTest() { var lista = new List <Persona>(); lista = PersonaBLL.GetList(p => true); Assert.AreEqual(lista, lista); }
private void ConsultarButton_Click(object sender, RoutedEventArgs e) { var listado = new List <Persona>(); if (CriterioTextBox.Text.Trim().Length > 0) { switch (FiltroComboBox.SelectedIndex) { case 0: //PersonaId listado = PersonaBLL.GetList(e => e.PersonaId == Convert.ToInt32(CriterioTextBox.Text)); break; case 1: //Nombres //listado = PersonaBLL.GetList(e => e.Nombres.Contains(CriterioTextBox.Text, StringComparison.OrdinalIgnoreCase)); break; } } else { listado = PersonaBLL.GetList(c => true); } DatosDataGrid.ItemsSource = null; DatosDataGrid.ItemsSource = listado; }
private void GuardarButton_Click(object sender, RoutedEventArgs e) { if (!Validar()) { return; } var pers = PersonaBLL.Buscar(Convert.ToInt32(PersonaComboBox.SelectedValue)); if (pers != null) { BalanceTextBox.Text = Convert.ToString(pers.Balance); decimal nuevoBalance = Convert.ToDecimal(BalanceTextBox.Text) + Convert.ToDecimal(MontoTextBox.Text); pers.Balance = nuevoBalance; PersonaBLL.Guardar(pers); this.DataContext = prestamo; var paso = PrestamoBLL.Guardar(this.prestamo); if (paso) { Limpiar(); MessageBox.Show("Transaccion exitosa!", "Exito", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show("Transaccion Fallida", "Fallo", MessageBoxButton.OK, MessageBoxImage.Error); } } else { MessageBox.Show("Transaccion Fallida, Persona no encontrada", "Fallo", MessageBoxButton.OK, MessageBoxImage.Error); } }
public void EliminarTest() { bool paso; paso = PersonaBLL.Eliminar(1); Assert.IsNotNull(paso); }
public void BuscarTest() { Persona personas; personas = PersonaBLL.Buscar(1); Assert.AreEqual(personas, personas); }
private void Guardarbutton_Click(object sender, EventArgs e) { bool paso = false; Personas persona; if (!Validar()) { return; } persona = LlenaClase(); if (IdnumericUpDown.Value == 0) { paso = PersonaBLL.Guardar(persona); } else { if (!ExiteEnLaBaseDeDatos()) { MessageBox.Show("Nose puede Modificar No Exite", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } paso = PersonaBLL.Modificar(persona); } Limpiar(); if (paso) { MessageBox.Show("Guardado!!", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No se pudo guardar!!", "fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void guardarButton_Click(object sender, RoutedEventArgs e) { Personas personas; bool paso = false; if (!Validar()) { return; } personas = LlenaClase(); if (Convert.ToInt32(IdTextBox.Text) == 0) { paso = PersonaBLL.Guardar(personas); } else { if (!ExisteEnLaBaseDeDatos()) { MessageBox.Show("No se puede Modificar una persona que no existe", "Fallo", MessageBoxButton.OK, MessageBoxImage.Error); return; } paso = PersonaBLL.Modificar(personas); } if (paso) { Limpiar(); MessageBox.Show("Guardado!", "Exito", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show("No fue posible guardar!!", "Fallo"); } }
private void Button_Click(object sender, RoutedEventArgs e) { var listado = new List <Personas>(); if (CriterioTex.Text.Trim().Length > 0) { switch (FiltrarComboBox.SelectedIndex) { case 0: listado = PersonaBLL.GetLis(prop => true); break; case 1: int id = Convert.ToInt32(CriterioTex.Text); listado = PersonaBLL.GetLis(p => p.PersonaId == id); break; default: MessageBox.Show("No existe esa opción en el Filtro"); break; } // listado = listado.Where(c => c.Fecha.Date >= DesdeDateTimePcker.SelectedDate.Value && c.PersonaId.ToString <= HastaDateTimePicker.SelectedDate.Value).ToList(); } else { listado = PersonaBLL.GetLis(p => true); } ConsultaDateGridView.ItemsSource = null; ConsultaDateGridView.ItemsSource = listado; }
private void GuardarButton_Click(object sender, EventArgs e) { Persona persona; bool paso = false; if (!Validar()) { return; } persona = LlenaClase(); if (IDNumericUpDowm.Value == 0) { paso = PersonaBLL.Guardar(persona); } else { if (!ExisteEnLaBaseDeDatos()) { MessageBox.Show("No se puede modificar una persona que no existe", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } paso = PersonaBLL.Modificar(persona); } if (paso) { MessageBox.Show("Guardado", "Exito!!", MessageBoxButtons.OK, MessageBoxIcon.Information); Limpiar(); } else { MessageBox.Show("No se pudo Guardar!!", "Fallo!!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public async Task <IHttpActionResult> CreateUser(JObject jsonData) { dynamic json = jsonData; JObject jalbum = json.CreateUserBindingModel; JObject juser = json.Persona; var createUserModel = jalbum.ToObject <CreateUserBindingModel>(); var person = juser.ToObject <PersonaDTO>(); createUserModel.FirstName = person.Nombres; createUserModel.LastName = person.Apellidos; createUserModel.Email = person.Email; var existepersona = new PersonaBLL().FindPersonaByIdentificacion(person.Identificacion); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var user = new ApplicationUser(); user.UserName = createUserModel.Username; user.Email = createUserModel.Email; user.FirstName = createUserModel.FirstName; user.LastName = createUserModel.LastName; user.Level = 3; user.JoinDate = DateTime.Now.Date; if (existepersona == null) {//QUIERE DECIR QUE LA PERSONA YA EXISTE user.Persona = Persona.MapeoDTOToDAL(person); } else { //user.PersonaId = existepersona.PersonaId; este deberia ser el codigo para que aqui se le agregue un nuevo rol return(Content(HttpStatusCode.Conflict, person)); } IdentityResult addUserResult = await this.AppUserManager.CreateAsync(user, createUserModel.Password); if (!addUserResult.Succeeded) { return(GetErrorResult(addUserResult)); } var createdUser = await this.AppUserManager.FindByNameAsync(createUserModel.Username); await this.AppUserManager.AddToRoleAsync(createdUser.Id, createUserModel.RoleName); string code = await this.AppUserManager.GenerateEmailConfirmationTokenAsync(user.Id); var callbackUrl = new Uri(Url.Link("ConfirmEmailRoute", new { userId = user.Id, code = code })); await this.AppUserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>"); Uri locationHeader = new Uri(Url.Link("GetUserById", new { id = user.Id })); return(Created(locationHeader, TheModelFactory.Create(user))); }
public void BuscarTest() { Persona personas = new Persona(); personas = PersonaBLL.Buscar(2); Assert.AreEqual(personas, personas); }
public string getDatosExt(string nroDocumento, string tipoDocumento) { var datosPersona = new PersonaBLL().consultaDatosExt(nroDocumento, tipoDocumento); JavaScriptSerializer jss = new JavaScriptSerializer(); string output = jss.Serialize(datosPersona); return(output); }
//private Persona persona; public rPrestamo() { InitializeComponent(); PersonaComboBox.ItemsSource = PersonaBLL.GetList(); PersonaComboBox.SelectedValuePath = "PersonaId"; PersonaComboBox.DisplayMemberPath = "PersonaId"; Limpiar(); }
public rPrestamos() { InitializeComponent(); PersonaIdComboBox.ItemsSource = PersonaBLL.GetList(p => true); PersonaIdComboBox.SelectedValuePath = "PersonaId"; PersonaIdComboBox.DisplayMemberPath = "Nombres"; prestamo.Monto += prestamo.Balance; this.DataContext = prestamo; }
public static DataTable Persona(int NoSeq) { DataTable dt = new DataTable(); try { dt = PersonaBLL.Persona(NoSeq); } catch (Exception ex) { } return dt }
private void Guardarbutton_Click(object sender, EventArgs e) { if (PersonaBLL.Guardar(LlenarClase())) { MessageBox.Show("Guardo"); } else { MessageBox.Show("Error"); } }
private void Eliminarbutton_Click(object sender, EventArgs e) { if (PersonaBLL.eliminar(int.Parse(PersonaIdtextBox.Text))) { MessageBox.Show("fue eliminado "); } else { MessageBox.Show("Error al Eliminar"); } }
public rPrestamos() { InitializeComponent(); prestamo = new Prestamos(); prestamo.Fecha = DateTime.Now; this.DataContext = prestamo; PersonaComboBox.ItemsSource = PersonaBLL.GetList(p => true); PersonaComboBox.SelectedValuePath = "PersonaId"; PersonaComboBox.DisplayMemberPath = "Nombres"; }
private void buttonGuardar_Click(object sender, EventArgs e) { if (PersonaBLL.Guardar(LlenaClase()) == true) { MessageBox.Show("Guardo con exito"); } else { MessageBox.Show("No Guardo"); } }
public void EliminarButton_Click(object sender, RoutedEventArgs e) { if (PersonaBLL.Eliminar(int.Parse(IDTextBox.Text))) { Limpiar(); MessageBox.Show("Registro eliminado", "Existo"); } else { MessageBox.Show("No fue posible eliminar", "Fallo"); } }
private void EliminarButton_Click(object sender, RoutedEventArgs e) { if (PersonaBLL.Eliminar(Convert.ToInt32(PersonaIdTextBox.Text))) { Limpiar(); MessageBox.Show("Se eliminó exitosamente.", "¡Exito!", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show("No se pudo eliminar la persona. El ID ingrasado no coincide con ninguna persona.", "¡Fallo!", MessageBoxButton.OK, MessageBoxImage.Error); } }