public List<clsPersona> ConsultaPersona() { try { List<clsPersona> Lista = new List<clsPersona>(); RecursosHumanosEntities ent = new RecursosHumanosEntities(); var con = from w in ent.Persona select w; foreach (var item in con) { clsPersona clas = new clsPersona(); clas.IdPersona = item.IdPersona; clas.Identificacion = Convert.ToInt32(item.Identificacion); clas.IdEmpresa = item.IdEmpresa; clas.NombreRazonSocial = item.NombreRazonSocial; clas.Apellido = item.Apellido; clas.FechaNacimiento = Convert.ToDateTime(item.FechaNacimiento); clas.Genero = item.genero; clas.TipoIdentificacion = item.TipoIdentificacion; clas.Direccion = item.direccion; clas.TelefonoGneral = Convert.ToInt32(item.TelefonoGneral); clas.TelefonoMovil = Convert.ToInt32(item.TelefonoMovil); clas.TelefonoCasa = Convert.ToInt32(item.TelefonoCasa); clas.TelefonoOtros = Convert.ToInt32(item.TelefonoOtros); clas.Mail = item.mail; clas.IdEstado = item.IdEstado; Lista.Add(clas); } return Lista; } catch (Exception) { return null; } }
//Esta operacion sera para ver cuales son los proveedores en la tabla persona public List<clsPersona> consultaEspecial() { try { List<clsPersona> lista = new List<clsPersona>(); CompraEntities aux = new CompraEntities(); var auxi = from q in aux.Proveedor select q; foreach (var item in auxi) { RecursosHumanosEntities ent = new RecursosHumanosEntities(); clsPersona perso = new clsPersona(); var x = (from a in ent.Persona where a.IdPersona == item.IdPersona select a).First(); perso.IdPersona = x.IdPersona; perso.Identificacion = Convert.ToInt32(x.Identificacion); perso.IdEmpresa = x.IdEmpresa; perso.NombreRazonSocial = x.NombreRazonSocial; perso.General = Convert.ToInt32(x.TelefonoGneral); perso.mail = x.mail; lista.Add(perso); } return lista; } catch (Exception) { return null; } }
//agregado por Cuentas por pagar public void ConsultaEspecificaPersona(clsPersona pe) { using (RecursosHumanosEntities ent = new RecursosHumanosEntities()) { var x = (from q in ent.Persona where q.IdPersona == pe.IdPersona select q).First(); pe.IdPersona = x.IdPersona; pe.Identificacion = Convert.ToInt32(x.Identificacion); pe.IdTipoPersona = x.IdTipoPersona; pe.NombreRazonSocial = x.NombreRazonSocial; pe.Apellido = x.Apellido; pe.FechaNacimiento = Convert.ToDateTime(x.FechaNacimiento); pe.Genero = x.genero; pe.TipoIdentificacion = x.TipoIdentificacion; pe.Direccion = x.direccion; pe.TelefonoGneral = Convert.ToInt32(x.TelefonoGneral); pe.TelefonoMovil = Convert.ToInt32(x.TelefonoMovil); pe.TelefonoCasa = Convert.ToInt32(x.TelefonoCasa); pe.TelefonoOtros = Convert.ToInt32(x.TelefonoOtros); pe.Mail = x.mail; pe.IdEmpresa = x.IdEmpresa; x.IdEstado = pe.IdEstado; // x.IdFoto =pe.foto; } }
private void btnConsultarConductor_Click(object sender, EventArgs e) { frmMConsultaEmpleado cPer = new frmMConsultaEmpleado(); clsPersona clas = new clsPersona(); cPer.ShowDialog(); clas = cPer.p; txtNumeroConductor.Text = Convert.ToString(clas.IdPersona); txtNombreConductor.Text = clas.NombreRazonSocial + ' ' + clas.Apellido; }
private void simpleButton1_Click_1(object sender, EventArgs e) { frmMConsultaEmpleado cPer = new frmMConsultaEmpleado(); cPer.band = 1; cPer.ShowDialog(); clas1 = cPer.p; id = clas1.IdPersona; txtCedula.Text = Convert.ToString(clas1.Identificacion); txtNombre.Text = clas1.NombreRazonSocial; txtApellido.Text = clas1.Apellido; }
public Boolean Eliminar(clsPersona pe) { try { using (RecursosHumanosEntities ent = new RecursosHumanosEntities()) { var x = (from q in ent.Persona where q.Identificacion == pe.Identificacion select q).First(); ent.DeleteObject(x); ent.SaveChanges(); } return true; } catch (Exception) { return false; } }
// ******************** BUSCAR PERSONA ********************** private void btnBuscarCedula_Click(object sender, EventArgs e) { frmMConsultaEmpleado cPer = new frmMConsultaEmpleado(); cPer.ShowDialog(); clas = cPer.p; IdPersona = clas.IdPersona; txtCedula.Text = Convert.ToString(clas.Identificacion); txtNombres.Text = clas.NombreRazonSocial; txtApellidos.Text = clas.Apellido; if (clas.genero == "M") { rdgGenero.SelectedIndex = 0; } else { rdgGenero.SelectedIndex = 1; } deFechaNacimiento.DateTime = clas.FechaNacimiento; }
//public void GrabarEmpresas(){ // clsUsuarioPorEmpresa oUsuarioPoEmpresa = new clsUsuarioPorEmpresa(); // oUsuarioPoEmpresa.IdUsuario = Convert.ToInt32(txtCedula.Text); // foreach (DataRowView item in checkedListBox1.CheckedItems) // { // oUsuarioPoEmpresa.IdUsuario = Convert.ToInt32(txtCedula.Text); // oUsuarioPoEmpresa.IdEmpresa = Convert.ToInt32(item[checkedListBox1.ValueMember].ToString()); // //oUsuarioPoEmpresa.IdEmpresa = Convert.ToInt32(checkedListBox1.SelectedValue); // if (datUsuarioPorEmpresa.GuardarEmpresa(oUsuarioPoEmpresa)) // MessageBox.Show("Guardado UsuarioPorEmpresa con exito"); // else // MessageBox.Show("No Guardado"); // } //} private void simpleButton3_Click(object sender, EventArgs e) { frmConsultaGeneral of = new frmConsultaGeneral(); of.ShowDialog(); per = of.oPersona; if (Convert.ToString(per.IdPersona) != "0")//if (of.Codigo != String.Empty) { txtCedula.Text = per.IdPersona.ToString(); txtNombre.Text = per.NombreRazonSocial.ToString(); txtApellido.Text = per.Apellido.ToString(); txtGenero.Text = per.genero.ToString(); txtTipoPersona.Text = (per.IdTipoPersona.ToString() == "1") ? "Natural" : "Jurídica"; //txtCedula.Text = of.Codigo; //txtNombre.Text = of.Nombre; //txtApellido.Text = of.Apellido; //txtGenero.Text = of.Genero; //txtTipoPersona.Text = (of.TipoPersona == "1") ? "Natural" : "Jurídica"; if (txtCedula.Text == "") { } else { if (datUsuario.ConsultarPorId(Convert.ToInt32(per.IdPersona)) == true) { Consulta(); } else { MessageBox.Show("Personal sin Usuario", "Atencion", MessageBoxButtons.OK, MessageBoxIcon.Information); crearNombreUsuario(); } } } of = null; }
public void Modificar(clsPersona pe) { using (RecursosHumanosEntities ent = new RecursosHumanosEntities()) { var x = (from q in ent.Persona where q.Identificacion == pe.Identificacion select q).First(); x.IdPersona = pe.IdPersona; x.Identificacion = pe.Identificacion; x.IdTipoPersona = pe.IdTipoPersona; x.NombreRazonSocial = pe.NombreRazonSocial; x.Apellido = pe.Apellido; x.FechaNacimiento = pe.FechaNacimiento; x.genero = pe.Genero; x.TipoIdentificacion = pe.TipoIdentificacion; x.direccion = pe.Direccion; x.TelefonoGneral = pe.TelefonoGneral; x.TelefonoMovil = pe.TelefonoMovil; x.TelefonoCasa = pe.TelefonoCasa; x.TelefonoOtros = pe.TelefonoOtros; x.mail = pe.Mail; x.IdEmpresa = pe.IdEmpresa; x.IdEstado = pe.IdEstado; // x.IdFoto =pe.foto; ent.SaveChanges(); } }
public Boolean Guardar(clsPersona pe) { try { using (RecursosHumanosEntities ent = new RecursosHumanosEntities()) { Persona per = new Persona() { IdPersona = pe.IdPersona, IdEmpresa = pe.IdEmpresa, Identificacion = pe.Identificacion, IdTipoPersona = pe.IdTipoPersona, NombreRazonSocial = pe.NombreRazonSocial, Apellido = pe.Apellido, FechaNacimiento = pe.FechaNacimiento, genero = pe.Genero, TipoIdentificacion = pe.TipoIdentificacion, direccion = pe.Direccion, TelefonoGneral = pe.TelefonoGneral, TelefonoMovil = pe.TelefonoMovil, TelefonoCasa = pe.TelefonoCasa, TelefonoOtros = pe.TelefonoOtros, mail = pe.Mail, IdEstado = pe.IdEstado, //IdFoto = pe.foto, }; ent.AddToPersona(per); ent.SaveChanges(); } return true; } catch (Exception) { return false; } }
private void gridView1_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e) { oPersona = getRow((DevExpress.XtraGrid.Views.Grid.GridView)sender); Close(); }
private void btnBuscarEmpleado_Click(object sender, EventArgs e) { frmMConsultaEmpleado cPer = new frmMConsultaEmpleado(); cPer.band = 2; cPer.ShowDialog(); clas = cPer.p; id = clas.IdPersona; txtCedula.Text = Convert.ToString(clas.Identificacion); txtNombre.Text = clas.NombreRazonSocial + " " + clas.Apellido; }
public List<clsPersona> ConsultaPersona1(int band) { try { List<clsPersona> Lista = new List<clsPersona>(); RecursosHumanosEntities ent = new RecursosHumanosEntities (); if (band == 1) { var con = from w in ent.Persona select w; foreach (var item in con) { clsPersona clas = new clsPersona(); clas.IdPersona = item.IdPersona; clas.Identificacion = Convert.ToInt64(item.Identificacion); clas.IdEmpresa = item.IdEmpresa; clas.IdTipoPersona = item.IdTipoPersona; clas.NombreRazonSocial = item.NombreRazonSocial; clas.Apellido = item.Apellido; clas.FechaNacimiento = Convert.ToDateTime(item.FechaNacimiento); clas.genero = item.genero; clas.TipoIdentificacion = item.TipoIdentificacion; clas.direccion = item.direccion; clas.General = Convert.ToInt32(item.TelefonoGneral); clas.Movil = Convert.ToInt32(item.TelefonoMovil); clas.Casa = Convert.ToInt32(item.TelefonoCasa); clas.Otros = Convert.ToInt32(item.TelefonoOtros); clas.mail = item.mail; clas.IdEstado = item.IdEstado; Lista.Add(clas); } }else { if (band == 2) { var con = from p in ent.Persona join c in ent.Contrato on p.IdPersona equals c.IdPersona where p.IdPersona == c.IdPersona select new { IdPersona = p.IdPersona, Identificacion = p.Identificacion, IdEmpresa = p.IdEmpresa, IdTipoPersona = p.IdTipoPersona, NombreRazonSocial = p.NombreRazonSocial, Apellido = p.Apellido, FechaNacimiento = p.FechaNacimiento, genero = p.genero, TipoIdentificacion = p.TipoIdentificacion, direccion = p.direccion, General = p.TelefonoGneral, Movil = p.TelefonoMovil, Casa = p.TelefonoCasa, Otros = p.TelefonoOtros, mail = p.mail, IdEstado = p.IdEstado, }; foreach (var item in con) { clsPersona clas = new clsPersona(); clas.IdPersona = item.IdPersona; clas.Identificacion = Convert.ToInt64(item.Identificacion); clas.IdEmpresa = item.IdEmpresa; clas.IdTipoPersona = item.IdTipoPersona; clas.NombreRazonSocial = item.NombreRazonSocial; clas.Apellido = item.Apellido; clas.FechaNacimiento = Convert.ToDateTime(item.FechaNacimiento); clas.genero = item.genero; clas.TipoIdentificacion = item.TipoIdentificacion; clas.direccion = item.direccion; clas.General = Convert.ToInt32(item.General); clas.Movil = Convert.ToInt32(item.Movil); clas.Casa = Convert.ToInt32(item.Casa); clas.Otros = Convert.ToInt32(item.Otros); clas.mail = item.mail; clas.IdEstado = item.IdEstado; Lista.Add(clas); } } } return Lista; } catch (Exception) { return null; } }
private void btnBuscarCedula_Click(object sender, EventArgs e) { frmMConsultaEmpleado cPer = new frmMConsultaEmpleado(); cPer.ShowDialog(); clas = cPer.p ; txtid.Text = Convert.ToString(clas.IdPersona ); txtCedula.Text = Convert.ToString(clas.Identificacion); solo = clas.IdEmpresa; txtNombre.Text = clas.NombreRazonSocial ; txtApellido.Text = clas.Apellido; if (clas.genero == "M") { rgGenero.SelectedIndex = 0; } else { rgGenero.SelectedIndex = 1; } deFNacimiento.DateTime = clas.FechaNacimiento; txtDireccion.Text = clas.direccion; txtCorreo.Text = clas.mail; txtGeneral.Text =Convert .ToString ( clas.General); txtMovil.Text = Convert.ToString(clas.Movil); txtCasa.Text = Convert.ToString(clas.Casa); txtOtro.Text = Convert.ToString(clas.Otros); cmbEstado.SelectedIndex = clas.IdEstado; }