private void btnModificar_Click(object sender, EventArgs e) { try { Persona persona = new Persona(auxId, txtNombre.Text, txtApellido.Text); PersonaDAO.Modificar(persona); MessageBox.Show("Persona modificada exitosamente"); this.Limpiar(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
protected void btnEliminar2_Click(object sender, EventArgs e) { PersonaDAO dao = new PersonaDAO(); Persona p = new Persona(); p.id = int.Parse(DropDownList1.SelectedValue); dao.delete(p); //Actualizar el combo DropDownList1.DataBind(); ClientScript.RegisterStartupScript (this.GetType(), "myalert", "alert('" + "" + "Se elimino" + "');", true); // Response.Write(" < SCRIPT LANGUAGE = 'JavaScript' > alert('Hello this is an Alert') </ SCRIPT > "); }
public string getAll() { string strJSON; PersonaDAO dao = new PersonaDAO(); List <Persona> lista = dao.getAll(); strJSON = JsonConvert.SerializeObject(lista, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); return(strJSON); }
private void btnBuscarId_Click(object sender, EventArgs e) { this.lstId.Items.Clear(); try { Persona persona = PersonaDAO.LeerPorId(Convert.ToInt32(txtId.Text)); this.lstId.Items.Add(persona); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public string Buscar(int idPersona) { if (idPersona >= 0) { PersonaDAO dp = new PersonaDAO(); Persona persona = dp.buscarPersonaId(idPersona); return("<html><body><h1>Resultado de la Busqueda</h1><br /><h3>" + persona.Nombre + "</h3><br />" + "<h3>" + persona.Apellidos + "</h3><br />" + "<h3>" + persona.Edad + "</h3><br />" + "<h3>" + persona.Sexo + "</h3><br />" + "<h3>" + persona.Vive + "</h3><br />" + "</body></html>"); } return(null); }
public HttpResponseMessage Insertar([FromBody] Maestro persona) { try { var personaCreada = PersonaDAO.Insertar(persona); return(Request.CreateResponse(HttpStatusCode.OK, personaCreada)); } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.InternalServerError, new { Mensaje = ex.Message })); } }
public HttpResponseMessage ObternerTodos() { try { var personas = PersonaDAO.ConsultarTodos(); return(Request.CreateResponse(HttpStatusCode.OK, personas)); } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.InternalServerError, new { Mensaje = ex.Message })); } }
public IList <Persona> Listar() { try { return(PersonaDAO.ListarTodos()); } catch (DataAccessException daex) { throw daex; } catch (Exception ex) { log.Error(ex.Message, ex); throw new BusinessLogicException("Ocurrio un error, no se pudo listar los registros", ex); } }
private void btnEliminar_Click(object sender, EventArgs e) { try { Persona persona = (Persona)lstPersonas.SelectedItem; PersonaDAO.Eliminar(persona); MessageBox.Show("Persona Eliminada exitosamente"); this.Limpiar(); this.Refrescar(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public ActionResult CambiarFoto(HttpPostedFileBase img) { PersonaDAO personaDAO = new PersonaDAO(); string ruta = ""; if (img != null) { ruta = Server.MapPath("~/perfile/"); ruta += img.FileName; img.SaveAs(ruta); personaDAO.SubirImagen("/perfile/" + img.FileName, Session["id"].ToString()); Session["perfile"] = "/perfile/" + img.FileName; return(Json("true", JsonRequestBehavior.AllowGet)); } return(Json("false", JsonRequestBehavior.AllowGet)); }
protected void btnCrearAcudiente_Click(object sender, EventArgs e) { try { PersonaDAO infante = new PersonaDAO(); DatosInfanteDAO datosInfante = new DatosInfanteDAO(); infante.verificarPersona(txtDocumento.Text); infante.validarEdad(DateTime.Parse(txtFechaIngreso.Text)); int idInfante = infante.crearPersona(_nombre: txtNombre.Text, _fechaNacimiento: DateTime.Parse(txtFechaNacimiento.Text), _ciudadNacimiento: int.Parse(ddlCiudadNacimiento.SelectedValue), _telefono: txtTelefono.Text, _tipoSangre: txtTipoSangre.Text, _direccion: txtDireccion.Text, _tipoDocumento: int.Parse(ddlTipoDocumento.SelectedValue), _numeroDocumento: txtDocumento.Text); datosInfante.guardarDatosInfante(txtEps.Text, int.Parse(ddlJardin.SelectedValue), int.Parse(ddlAcudiente.SelectedValue), idInfante, float.Parse(txtPeso.Text), float.Parse(txtTalla.Text), _fechaIngreso: DateTime.Parse(txtFechaIngreso.Text)); Response.Write("<script type='text/javascript'>alert('Los Datos del infante han sido almacenados satisfactoriamente')</script>"); } catch (Exception ex) { Response.Write("<script type='text/javascript'>alert('" + ex.Message + "')</script>"); } }
public Boolean verificarExistenciaCliente() { Boolean resul = false; if (!(nroDoc == 0) && CUIT == String.Empty) { try { List <Persona> personas = PersonaDAO.GetAll(); foreach (Persona per in personas) { if (per.NroDoc.Equals(nroDoc) && per.TipoDoc.IDTipoDoc.Equals(tipoDoc.IDTipoDoc)) { resul = true; } } } catch (ApplicationException ex) { throw new ApplicationException(ex.Message); } } if (!(CUIT == String.Empty) && nroDoc == 0) { try { List <Persona> personas = PersonaDAO.GetAll(); foreach (Persona per in personas) { if (per.cuil.Equals(CUIT)) { resul = true; } } } catch (ApplicationException ex) { throw new ApplicationException(ex.Message); } } return(resul); }
private void cargarGrillaProveedores() { try { List <Persona> Proveedor = PersonaDAO.GetAll(); dgv_proveedores.Rows.Clear(); foreach (Persona prov in Proveedor) { if (prov.NroCliente == 0) { dgv_proveedores.Rows.Add(prov.NroProveedor, prov.RazonSocial, prov.cuil, prov.Apellido, prov.Nombre, prov.telefono, prov.mail, prov.condicionIVA.idCondicionIVA, prov.idPersona); } } } catch (ApplicationException ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } }
protected void btnCrearAcudiente_Click(object sender, EventArgs e) { PersonaDAO persona = new PersonaDAO(); UsuarioDAO usuario = new UsuarioDAO(); try { persona.validarMail(txtCorreo.Text); persona.verificarPersona(txtDocumento.Text); persona.verificarPersonaXCorreo(txtCorreo.Text); int idPersona = persona.crearPersona(_nombre: txtNombre.Text, _telefono: txtTelefono.Text, _direccion: txtDireccion.Text, _correo: txtCorreo.Text, _celular: txtCelular.Text, _tipoDocumento: int.Parse(ddlTipoDocumento.SelectedValue), _numeroDocumento: txtDocumento.Text); usuario.crearUsuario(idPersona, 3, txtCorreo.Text, txtDocumento.Text); Response.Write("<script type='text/javascript'>alert('Los datos fueron alamcenados satisfactoriamente')</script>"); } catch (Exception ex) { Response.Write("<script language='JavaScript'>alert(" + ex.Message + "');</script>"); } }
private void cargarGrilla() { try { List <Persona> personas = PersonaDAO.GetAll(); dgv_proveedores.Rows.Clear(); foreach (Persona per in personas) { if (per.NroProveedor != 0) { dgv_proveedores.Rows.Add(per.NroProveedor, per.RazonSocial, per.cuil, per.Apellido, per.Nombre, per.calle, per.calle_nro, per.Barrio, per.Localidad.Nombre, per.Localidad.Provincia.Nombre, per.mail, per.telefono, per.Localidad.Provincia.idProvincia, per.Localidad.codPostal); } } } catch (ApplicationException ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } }
private void BtnLeer_Click(object sender, EventArgs e) { dataGridView.Rows.Clear(); List <Persona> collection = PersonaDAO.Leer(); int contador = 0; if (collection != null && collection.Count > 0) { foreach (var item in collection) { dataGridView.Rows.Insert(contador, item.Id, item.Nombre, item.Apellido); contador++; } } else { MessageBox.Show("Sin Resultados Encontrados"); } }
public bool CorreoRecuperacion(string usuario, string codigo) { PersonaDAO per = new PersonaDAO(); DataTable info = per.TraerInfo(usuario); MailMessage correo = new MailMessage(); correo.To.Add(new MailAddress(info.Rows[0][6].ToString())); correo.From = new MailAddress("*****@*****.**"); correo.Subject = "Cambio de contraseña"; string html = "Buen día Sr(a) " + info.Rows[0][1].ToString() + ",se ha solicitado un cambio de contraseña, el siguiente codigo es para verificar que si eres tu " + codigo; AlternateView htmlView = AlternateView.CreateAlternateViewFromString(html, Encoding.UTF8, MediaTypeNames.Text.Html); correo.AlternateViews.Add(htmlView); correo.IsBodyHtml = true; bool verificar = false; try { using (var smtp = new SmtpClient()) { var credential = new NetworkCredential { UserName = "******", Password = "******" }; smtp.Credentials = credential; smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.EnableSsl = true; smtp.Send(correo); } verificar = true; } catch (Exception) { verificar = false; throw; } return(verificar); }
static void Main(string[] args) { try { Persona persona = new Persona(5, "Silvia", "Aloha"); PersonaDAO personaDAO = new PersonaDAO(); personaDAO.GuardarPersona(persona); //personaDAO.ModificarPersona(persona); //personaDAO.EliminarPersona(persona); List <Persona> listPersona = personaDAO.LeerPersonas(); Console.WriteLine("Leer Personas"); foreach (Persona p in listPersona) { Console.WriteLine($"ID: {p.ID}, Nombre: {p.Nombre}, Apellido: {p.Apellido}"); } Persona persona2 = personaDAO.LeerPersonasID(2); Console.WriteLine(); Console.WriteLine("Persona x ID"); if (persona2 != null) { Console.WriteLine($"ID: {persona2.ID}, Nombre: {persona2.Nombre}, Apellido: {persona2.Apellido}"); } } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.ReadKey(); }
public PersonaDTO read(PersonaDTO personaDTO) { DataTable dt = new DataTable(); PersonaDTO retornoDTO = new PersonaDTO(); PersonaDAO personaDAO = new PersonaDAO(); dt = personaDAO.read(personaDTO); foreach (DataRow row in dt.Rows) { retornoDTO.personaID = Convert.ToInt64(row["personaID"].ToString()); retornoDTO.rut = row["rut"].ToString(); retornoDTO.digito_verificador = row["dv"].ToString(); retornoDTO.nombre = row["nombres"].ToString(); retornoDTO.apellido_paterno = row["ap_paterno"].ToString(); retornoDTO.apellido_materno = row["ap_materno"].ToString(); retornoDTO.direccion = row["direccion"].ToString(); retornoDTO.telefono = row["telefono"].ToString(); } return(retornoDTO); }
private void btn_aplicar_filtro_empresa_Click(object sender, EventArgs e) { Persona per = new Persona(); if (txt_apellido.Text != "") { per.Apellido = txt_apellido.Text; } if (txt_nombre.Text != "") { per.Nombre = txt_nombre.Text; } if (txt_razon_social.Text != "") { per.RazonSocial = txt_razon_social.Text; } if (txt_cuit.Text != " - -") { per.cuil = txt_cuit.Text; } //TipoDocumento tip = new TipoDocumento() { IDTipoDoc = 0 }; //per.TipoDoc = tip; List <Persona> resul = null; try { resul = PersonaDAO.GetByFiltroProveedor(per); } catch (ApplicationException ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } cargarGrillaFiltrada(resul); }
private void btnCobrar_Click(object sender, EventArgs e) { Persona.InformaCajero -= Archivos.Guardar; Persona.InformaCajero -= Serializer.Guardar; Persona.InformaCajero -= PersonaDAO.Insertar; try { if ((Persona)this.lstIngresado.SelectedItem != null) { Persona nuevaPersona = (Persona)this.lstIngresado.SelectedItem; nuevaPersona.informaEstado += this.per_InformaEstado; Persona.InformaCajero += Archivos.Guardar; Persona.InformaCajero += Serializer.Guardar; Persona.InformaCajero += PersonaDAO.Insertar; cajero.Cobrar(cajero, nuevaPersona); PersonaDAO.Insertar(nuevaPersona); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public void crearCliente() { buscarUltimoNroCliente(); Persona per = new Persona() { NroCliente = codCliente, cuil = CUIT, TipoDoc = tipoDoc, NroDoc = nroDoc, Localidad = localidad, Barrio = barrio, mail = email, telefono = telefono, depto = dpto, piso = pisoPer, calle_nro = nroCalle, RazonSocial = razonSocial, Apellido = apellido, Nombre = nombre, calle = calle, condicionIVA = condIva, tipoConsumidor = tipoCons, tefefonoCelular = celular, fechaNAc = fechaNac, Sexo = sexo }; try { PersonaDAO.Insert(per); } catch (ApplicationException ex) { throw new ApplicationException(ex.Message); } }
protected void gvMadresComunitarias_RowUpdating(object sender, GridViewUpdateEventArgs e) { UsuarioDAO madreComunitaria = new UsuarioDAO(); PersonaDAO persona = new PersonaDAO(); try { Label lbId = (Label)gvMadresComunitarias.Rows[e.RowIndex].FindControl("lblId"); TextBox txtNombre = (TextBox)gvMadresComunitarias.Rows[e.RowIndex].FindControl("txtNombre"); TextBox txtDireccion = (TextBox)gvMadresComunitarias.Rows[e.RowIndex].FindControl("txtDireccion"); TextBox txtDocumento = (TextBox)gvMadresComunitarias.Rows[e.RowIndex].FindControl("txtDocumento"); TextBox txtFechaNacimiento = (TextBox)gvMadresComunitarias.Rows[e.RowIndex].FindControl("txtFechaNacimiento"); TextBox txtCorreo = (TextBox)gvMadresComunitarias.Rows[e.RowIndex].FindControl("txtCorreo"); TextBox txtTelefono = (TextBox)gvMadresComunitarias.Rows[e.RowIndex].FindControl("txtTelefono"); DropDownList ddlTipoDocumento = (DropDownList)gvMadresComunitarias.Rows[e.RowIndex].FindControl("ddlTipoDocumento"); madreComunitaria.editarUsuario(int.Parse(lbId.Text), _documento: txtDocumento.Text); persona.editarPersona(int.Parse(lbId.Text), _nombre: txtNombre.Text, _direccion: txtDireccion.Text, _numeroDocumento: txtDocumento.Text, _fechaNacimiento: DateTime.Parse(txtFechaNacimiento.Text), _correo: txtCorreo.Text, _telefono: txtTelefono.Text, _tipoDocumento: int.Parse(ddlTipoDocumento.SelectedValue)); Response.Write("<script>alert('Los datos han sido almacenados satisfactoriamente')</script>"); } catch (Exception ex) { Response.Write("<script>alert('" + ex.Message + "')</script>"); } }
protected void dgvAcudientes_RowUpdating(object sender, GridViewUpdateEventArgs e) { try { UsuarioDAO usuario = new UsuarioDAO(); PersonaDAO persona = new PersonaDAO(); Label lbId = (Label)dgvAcudientes.Rows[e.RowIndex].FindControl("lblId"); TextBox txtNombre = (TextBox)dgvAcudientes.Rows[e.RowIndex].FindControl("txtNombre"); TextBox txtDocumento = (TextBox)dgvAcudientes.Rows[e.RowIndex].FindControl("txtDocumento"); DropDownList ddlTipoDocumento = (DropDownList)dgvAcudientes.Rows[e.RowIndex].FindControl("ddlTipoDocumento"); TextBox txtCorreo = (TextBox)dgvAcudientes.Rows[e.RowIndex].FindControl("txtCorreo"); TextBox txtTelefono = (TextBox)dgvAcudientes.Rows[e.RowIndex].FindControl("txtTelefono"); TextBox txtCelular = (TextBox)dgvAcudientes.Rows[e.RowIndex].FindControl("txtCelular"); TextBox txtDireccion = (TextBox)dgvAcudientes.Rows[e.RowIndex].FindControl("txtDireccion"); usuario.editarUsuario(int.Parse(lbId.Text), txtCorreo.Text, txtDocumento.Text); persona.editarPersona(int.Parse(lbId.Text), _nombre: txtNombre.Text, _numeroDocumento: txtDocumento.Text, _tipoDocumento: int.Parse(ddlTipoDocumento.SelectedValue), _correo: txtCorreo.Text, _celular: txtCelular.Text, _telefono: txtTelefono.Text, _direccion: txtDireccion.Text); acudientesBind(); Response.Write("<script>alert('Los datos han sido actualizados satisfactoriamente')</script>"); } catch (Exception ex) { Response.Write("<script>alert('" + ex.Message + "')</script>"); } }
private void btn_guardar_Click(object sender, EventArgs e) { int nroProv = SingletonNumeroProveedorDAO.GetInstacia().getNumeroCliente(); if (_estado == estados.nuevo && validarCampos() == true) { Provincia pro = new Provincia { idProvincia = (int)cmb_provincia.SelectedValue, Nombre = (string)cmb_provincia.SelectedItem.ToString() }; Localidad loc = new Localidad() { codPostal = (int)cmb_localidad.SelectedValue, Nombre = (string)cmb_localidad.SelectedItem.ToString(), Provincia = pro }; string tele = ""; int call = 0; if (!(txt_telefono.Text == " -")) { tele = txt_telefono.Text; } if (!(txt_calle_nro.Text == "")) { call = Convert.ToInt32(txt_calle_nro.Text); } Persona per = new Persona() { cuil = txt_cuit.Text, Localidad = loc, Barrio = txt_barrio.Text, mail = txt_mail.Text, telefono = tele, calle_nro = call, RazonSocial = txt_razon_social.Text, Apellido = txt_apellido.Text, Nombre = txt_nombre.Text, calle = txt_calle.Text, NroProveedor = nroProv, fechaNAc = DateTime.Now.Date, Sexo = 'O' }; try { PersonaDAO.Insert(per); MessageBox.Show("Registrado con Exito", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); limpiarCampos(); btn_guardar.Enabled = false; } catch (ApplicationException ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } } else { if (_estado == estados.modificar && validarCampos() == true) { Localidad loc = new Localidad() { codPostal = (int)cmb_localidad.SelectedValue }; string tele; int call = 0; tele = txt_telefono.Text; call = Convert.ToInt32(txt_calle_nro.Text); Persona per = new Persona() { Localidad = loc, Barrio = txt_barrio.Text, mail = txt_mail.Text, telefono = tele, calle_nro = call, RazonSocial = txt_razon_social.Text, Apellido = txt_apellido.Text, Nombre = txt_nombre.Text, calle = txt_calle.Text, cuil = txt_cuit.Text, NroProveedor = _persModificar.NroProveedor }; try { PersonaDAO.UpdateProveedor(per); MessageBox.Show("Actualizado con Exito", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); //limpiarCampos(); //btn_guardar.Enabled = false; Close(); Dispose(); } catch (ApplicationException ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } } } }
public Persona buscarClienteEmpresa(int cuit) { return(PersonaDAO.GetClienteEmpresa(cuit)); }
public Persona buscarClientePersona(int idT, int nro) { return(PersonaDAO.GetClientePersona(idT, nro)); }
protected void btnEjecutar_Click(object sender, EventArgs e) { PersonaDAO p = new PersonaDAO(); p.getAll(); }
public string buscarTodos() { PersonaDAO pd = new PersonaDAO(); return(pd.buscarPersonas()); }
private void Form61_Load(object sender, EventArgs e) { basePersonas = new PersonaDAO(); textBoxLeerId.Enabled = false; }