gridview empleados

This commit is contained in:
carlos
2023-12-30 19:48:52 -06:00
parent 04fef7a7de
commit 36859334e4
16 changed files with 198 additions and 33 deletions
+1 -3
View File
@@ -1,8 +1,6 @@
{
"ExpandedNodes": [
"",
"\\database",
"\\database\\modelos"
""
],
"SelectedNode": "\\.sln",
"PreviewInSolutionExplorer": false
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
+3
View File
@@ -308,6 +308,9 @@
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
+20 -23
View File
@@ -101,31 +101,28 @@ namespace compabetov2.database
List<Empleado> empleados = new List<Empleado>();
using (SQLiteDataReader reader = DAO.conseguirEmpleadosDAO()) {
if(reader == null) { MessageBox.Show("null");
return empleados;
} else
while (reader.Read())
{
while (reader.Read())
{
Empleado empleado = new Empleado(
(int)reader["idempleado"],
(string)reader["nombre"].ToString(),
(string)reader["apellidos"].ToString(),
(string)reader["calle"].ToString(),
(string)reader["fecha_contratacion"].ToString(),
(string)reader["estado"].ToString(),
(string)reader["colonia"].ToString(),
(string)reader["cp"].ToString(),
(string)reader["no_ext"].ToString(),
(string)reader["no_int"].ToString(),
(string)reader["referencia"].ToString(),
(string)reader["fecha_nac"].ToString(),
(string)reader["telefono"].ToString()
);
empleados.Add(empleado);
}
return empleados;
Empleado empleado = new Empleado(
int.Parse(reader["idempleado"].ToString()),
reader["nombre"].ToString(),
reader["apellidos"].ToString(),
reader["calle"].ToString(),
reader["fecha_contratacion"].ToString(),
reader["estado"].ToString(),
reader["colonia"].ToString(),
reader["cp"].ToString(),
reader["no_ext"].ToString(),
reader["no_int"].ToString(),
reader["referencia"].ToString(),
reader["fecha_nac"].ToString(),
reader["telefono"].ToString()
);
empleados.Add(empleado);
}
return empleados;
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+109 -3
View File
@@ -68,6 +68,19 @@
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.empleadoBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.conexionBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.Id = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Nombre = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Apellidos = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.fecha_con = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.estado = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.calle = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.calonia = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.cp = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.no_ext = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.no_int = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.referencia = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.fecha_nac = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.telefono = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.pictureBox7)).BeginInit();
this.panel2.SuspendLayout();
this.flowLayoutPanel1.SuspendLayout();
@@ -517,9 +530,23 @@
// dataGridView1
//
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Location = new System.Drawing.Point(444, 75);
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Id,
this.Nombre,
this.Apellidos,
this.fecha_con,
this.estado,
this.calle,
this.calonia,
this.cp,
this.no_ext,
this.no_int,
this.referencia,
this.fecha_nac,
this.telefono});
this.dataGridView1.Location = new System.Drawing.Point(258, 75);
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.Size = new System.Drawing.Size(240, 150);
this.dataGridView1.Size = new System.Drawing.Size(1100, 150);
this.dataGridView1.TabIndex = 44;
this.dataGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentClick);
//
@@ -531,11 +558,76 @@
//
this.conexionBindingSource.DataSource = typeof(compabetov2.database.Conexion);
//
// Id
//
this.Id.HeaderText = "Id";
this.Id.Name = "Id";
//
// Nombre
//
this.Nombre.HeaderText = "Nombre";
this.Nombre.Name = "Nombre";
//
// Apellidos
//
this.Apellidos.HeaderText = "Apellidos";
this.Apellidos.Name = "Apellidos";
//
// fecha_con
//
this.fecha_con.HeaderText = "Fecha contratacion";
this.fecha_con.Name = "fecha_con";
//
// estado
//
this.estado.HeaderText = "Estado";
this.estado.Name = "estado";
//
// calle
//
this.calle.HeaderText = "Calle";
this.calle.Name = "calle";
//
// calonia
//
this.calonia.HeaderText = "Calonia";
this.calonia.Name = "calonia";
//
// cp
//
this.cp.HeaderText = "Cp";
this.cp.Name = "cp";
//
// no_ext
//
this.no_ext.HeaderText = "No. Exterior";
this.no_ext.Name = "no_ext";
//
// no_int
//
this.no_int.HeaderText = "No. Interior";
this.no_int.Name = "no_int";
//
// referencia
//
this.referencia.HeaderText = "Referencia";
this.referencia.Name = "referencia";
//
// fecha_nac
//
this.fecha_nac.HeaderText = "Fecha nacimiento";
this.fecha_nac.Name = "fecha_nac";
//
// telefono
//
this.telefono.HeaderText = "Telefono";
this.telefono.Name = "telefono";
//
// personal
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1028, 609);
this.ClientSize = new System.Drawing.Size(1370, 609);
this.Controls.Add(this.dataGridView1);
this.Controls.Add(this.label12);
this.Controls.Add(this.button9);
@@ -570,6 +662,7 @@
this.Name = "personal";
this.Text = "personal";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Load += new System.EventHandler(this.personal_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBox7)).EndInit();
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
@@ -623,5 +716,18 @@
private System.Windows.Forms.DataGridView dataGridView1;
private System.Windows.Forms.BindingSource conexionBindingSource;
private System.Windows.Forms.BindingSource empleadoBindingSource;
private System.Windows.Forms.DataGridViewTextBoxColumn Id;
private System.Windows.Forms.DataGridViewTextBoxColumn Nombre;
private System.Windows.Forms.DataGridViewTextBoxColumn Apellidos;
private System.Windows.Forms.DataGridViewTextBoxColumn fecha_con;
private System.Windows.Forms.DataGridViewTextBoxColumn estado;
private System.Windows.Forms.DataGridViewTextBoxColumn calle;
private System.Windows.Forms.DataGridViewTextBoxColumn calonia;
private System.Windows.Forms.DataGridViewTextBoxColumn cp;
private System.Windows.Forms.DataGridViewTextBoxColumn no_ext;
private System.Windows.Forms.DataGridViewTextBoxColumn no_int;
private System.Windows.Forms.DataGridViewTextBoxColumn referencia;
private System.Windows.Forms.DataGridViewTextBoxColumn fecha_nac;
private System.Windows.Forms.DataGridViewTextBoxColumn telefono;
}
}
+23 -1
View File
@@ -54,7 +54,29 @@ namespace compabetov2
private void llenarGrid()
{
List<Empleado> empleados = service.conseguirEmpleados();
//dataGridView1.DataSource = empleados;
empleados.Reverse();
foreach(Empleado empleado in empleados)
{
dataGridView1.Rows.Insert(0,
empleado.idempleado,
empleado.nombre,
empleado.apellidos,
empleado.fecha_contratacion,
empleado.estado,
empleado.calle,
empleado.colonia,
empleado.cp,
empleado.no_ext,
empleado.no_int,
empleado.referencia,
empleado.fecha_nac,
empleado.telefono);
}
}
private void personal_Load(object sender, EventArgs e)
{
}
}
}
+39
View File
@@ -117,6 +117,45 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="Id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Nombre.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Apellidos.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="fecha_con.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="estado.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="calle.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="calonia.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cp.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="no_ext.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="no_int.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="referencia.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="fecha_nac.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="telefono.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="empleadoBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>197, 17</value>
</metadata>