editar empleado listo

This commit is contained in:
carlos
2024-01-12 01:16:51 -06:00
parent 629334100c
commit 58838e4ed1
22 changed files with 451 additions and 28 deletions
+1 -2
View File
@@ -1,8 +1,7 @@
{ {
"ExpandedNodes": [ "ExpandedNodes": [
"", "",
"\\database", "\\database"
"\\database\\modelos"
], ],
"SelectedNode": "\\.sln", "SelectedNode": "\\.sln",
"PreviewInSolutionExplorer": false "PreviewInSolutionExplorer": false
Binary file not shown.
File diff suppressed because one or more lines are too long
+199
View File
@@ -0,0 +1,199 @@
namespace compabetov2
{
partial class AgregarLogin
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
this.flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.tableLayoutPanel1.SuspendLayout();
this.flowLayoutPanel1.SuspendLayout();
this.flowLayoutPanel2.SuspendLayout();
this.flowLayoutPanel3.SuspendLayout();
this.SuspendLayout();
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 1;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel2, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel3, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 3);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 4;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 51.07914F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 48.92086F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 84F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 72F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(584, 311);
this.tableLayoutPanel1.TabIndex = 0;
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.Controls.Add(this.label1);
this.flowLayoutPanel1.Controls.Add(this.textBox1);
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 3);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(578, 73);
this.flowLayoutPanel1.TabIndex = 0;
//
// flowLayoutPanel2
//
this.flowLayoutPanel2.Controls.Add(this.label2);
this.flowLayoutPanel2.Controls.Add(this.textBox2);
this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel2.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flowLayoutPanel2.Location = new System.Drawing.Point(3, 82);
this.flowLayoutPanel2.Name = "flowLayoutPanel2";
this.flowLayoutPanel2.Size = new System.Drawing.Size(578, 69);
this.flowLayoutPanel2.TabIndex = 1;
//
// flowLayoutPanel3
//
this.flowLayoutPanel3.Controls.Add(this.label3);
this.flowLayoutPanel3.Controls.Add(this.textBox3);
this.flowLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel3.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flowLayoutPanel3.Location = new System.Drawing.Point(3, 157);
this.flowLayoutPanel3.Name = "flowLayoutPanel3";
this.flowLayoutPanel3.Size = new System.Drawing.Size(578, 78);
this.flowLayoutPanel3.TabIndex = 2;
//
// tableLayoutPanel2
//
this.tableLayoutPanel2.ColumnCount = 3;
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 80.65844F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 19.34156F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 91F));
this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 241);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 1;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(578, 67);
this.tableLayoutPanel2.TabIndex = 3;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(3, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(178, 24);
this.label1.TabIndex = 0;
this.label1.Text = "Nombre de usuario:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(3, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(103, 24);
this.label2.TabIndex = 0;
this.label2.Text = "contraseña";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(3, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(106, 13);
this.label3.TabIndex = 0;
this.label3.Text = "confirmar contraseña";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(3, 27);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(100, 20);
this.textBox1.TabIndex = 1;
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(3, 27);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(100, 20);
this.textBox2.TabIndex = 1;
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(3, 16);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(100, 20);
this.textBox3.TabIndex = 1;
//
// AgregarLogin
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(584, 311);
this.Controls.Add(this.tableLayoutPanel1);
this.Name = "AgregarLogin";
this.Text = "AgregarLogin";
this.tableLayoutPanel1.ResumeLayout(false);
this.flowLayoutPanel1.ResumeLayout(false);
this.flowLayoutPanel1.PerformLayout();
this.flowLayoutPanel2.ResumeLayout(false);
this.flowLayoutPanel2.PerformLayout();
this.flowLayoutPanel3.ResumeLayout(false);
this.flowLayoutPanel3.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel3;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.TextBox textBox3;
}
}
+20
View File
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace compabetov2
{
public partial class AgregarLogin : Form
{
public AgregarLogin()
{
InitializeComponent();
}
}
}
+120
View File
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+2
View File
@@ -532,6 +532,7 @@ namespace compabetov2
this.button1.TabIndex = 0; this.button1.TabIndex = 0;
this.button1.Text = "Editar"; this.button1.Text = "Editar";
this.button1.UseVisualStyleBackColor = true; this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
// //
// btnCancelar // btnCancelar
// //
@@ -543,6 +544,7 @@ namespace compabetov2
this.btnCancelar.TabIndex = 1; this.btnCancelar.TabIndex = 1;
this.btnCancelar.Text = "Cancelar"; this.btnCancelar.Text = "Cancelar";
this.btnCancelar.UseVisualStyleBackColor = true; this.btnCancelar.UseVisualStyleBackColor = true;
this.btnCancelar.Click += new System.EventHandler(this.btnCancelar_Click);
// //
// EditarEmpleado // EditarEmpleado
// //
+29 -3
View File
@@ -1,4 +1,5 @@
using compabetov2.database.modelos; using compabetov2.database;
using compabetov2.database.modelos;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
@@ -44,9 +45,34 @@ namespace compabetov2
} }
void CargarDatos(Empleado empleado)
private void button1_Click(object sender, EventArgs e)
{ {
this.empleado = empleado; Empleado empleadoNuevo = new Empleado(
empleado.idempleado,
txtNombre.Text,
txtApellido.Text,
txtCalle.Text,
dtFechaCon.Text,
cbEstado.Text,
txtColonia.Text,
txtCp.Text,
txtNoExt.Text,
txtNoInt.Text,
txtReferencia.Text,
dtFechaNac.Text,
txtTelefono.Text);
if (service.actualizarEmpleado(empleadoNuevo))
{
ventanaPadre.llenarPanel();
}
}
private void btnCancelar_Click(object sender, EventArgs e)
{
this.Close();
} }
} }
} }
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
+9
View File
@@ -109,6 +109,12 @@
<Compile Include="AgregarEmpleado.Designer.cs"> <Compile Include="AgregarEmpleado.Designer.cs">
<DependentUpon>AgregarEmpleado.cs</DependentUpon> <DependentUpon>AgregarEmpleado.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="AgregarLogin.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="AgregarLogin.Designer.cs">
<DependentUpon>AgregarLogin.cs</DependentUpon>
</Compile>
<Compile Include="cuentas.cs"> <Compile Include="cuentas.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@@ -176,6 +182,9 @@
<EmbeddedResource Include="AgregarEmpleado.resx"> <EmbeddedResource Include="AgregarEmpleado.resx">
<DependentUpon>AgregarEmpleado.cs</DependentUpon> <DependentUpon>AgregarEmpleado.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="AgregarLogin.resx">
<DependentUpon>AgregarLogin.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="cuentas.resx"> <EmbeddedResource Include="cuentas.resx">
<DependentUpon>cuentas.cs</DependentUpon> <DependentUpon>cuentas.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
+13 -11
View File
@@ -151,10 +151,9 @@ namespace compabetov2.database
{ {
conexion.Open(); conexion.Open();
string sql = "UPDATE Empleado SET " + string sql = "UPDATE Empleado SET nombre = @nombre, apellidos = @apellidos, calle = @calle, fecha_contratacion = @fecha_contratacion, " +
"VALUES (@nombre, @apellidos, @calle, @fecha_contratacion, @estado, @colonia, @cp, @no_ext, @no_int, @referencia, @fecha_nac, @telefono)"; "estado = @estado, colonia = @colonia, cp = @cp, no_ext = @no_ext, no_int = @no_int, referencia = @referencia, " +
"fecha_nac = @fecha_nac, telefono = @telefono WHERE idempleado = @idempleado;";
using (SQLiteCommand command = new SQLiteCommand(sql, conexion)) using (SQLiteCommand command = new SQLiteCommand(sql, conexion))
{ {
@@ -170,6 +169,7 @@ namespace compabetov2.database
command.Parameters.AddWithValue("@referencia", empleado.referencia); command.Parameters.AddWithValue("@referencia", empleado.referencia);
command.Parameters.AddWithValue("@fecha_nac", empleado.fecha_nac); command.Parameters.AddWithValue("@fecha_nac", empleado.fecha_nac);
command.Parameters.AddWithValue("@telefono", empleado.telefono); command.Parameters.AddWithValue("@telefono", empleado.telefono);
command.Parameters.AddWithValue("@idempleado", empleado.idempleado);
int filasAfectadas = command.ExecuteNonQuery(); int filasAfectadas = command.ExecuteNonQuery();
@@ -490,18 +490,19 @@ namespace compabetov2.database
conexion.Open(); conexion.Open();
string[] consultas = new string[] string[] consultas = new string[]
{ {
"DROP TABLE IF EXISTS Login",
"DROP TABLE IF EXISTS Empleado", "DROP TABLE IF EXISTS Empleado",
"DROP TABLE IF EXISTS Login",
"DROP TABLE IF EXISTS Producto", "DROP TABLE IF EXISTS Producto",
"DROP TABLE IF EXISTS Categoria", "DROP TABLE IF EXISTS Categoria",
"DROP TABLE IF EXISTS Cliente", "DROP TABLE IF EXISTS Cliente",
"CREATE TABLE Login (idlogin INTEGER PRIMARY KEY AUTOINCREMENT, tipo TEXT NOT NULL, usuario TEXT NOT NULL, "+
"contra TEXT NOT NULL)",
"CREATE TABLE Empleado (idempleado INTEGER PRIMARY KEY AUTOINCREMENT, nombre TEXT NOT NULL, "+ "CREATE TABLE Empleado (idempleado INTEGER PRIMARY KEY AUTOINCREMENT, nombre TEXT NOT NULL, "+
"apellidos TEXT NOT NULL, calle TEXT NOT NULL, fecha_contratacion TEXT NOT NULL,estado TEXT NOT NULL, colonia TEXT NOT NULL, cp TEXT NOT NULL, no_ext TEXT NOT NULL," + "apellidos TEXT NOT NULL, calle TEXT NOT NULL, fecha_contratacion TEXT NOT NULL,estado TEXT NOT NULL, colonia TEXT NOT NULL, cp TEXT NOT NULL, no_ext TEXT NOT NULL," +
"no_int TEXT NOT NULL, referencia TEXT NOT NULL, fecha_nac TEXT NOT NULL, telefono TEXT NOT NULL)", "no_int TEXT NOT NULL, referencia TEXT NOT NULL, fecha_nac TEXT NOT NULL, telefono TEXT NOT NULL, fk_idLogin INTEGER," +
"FOREIGN KEY (fk_idLogin) REFERENCES Login(idlogin))",
"CREATE TABLE Login (idlogin INTEGER PRIMARY KEY AUTOINCREMENT, tipo TEXT NOT NULL, usuario TEXT NOT NULL, "+
"contra TEXT NOT NULL, fk_idempleado INTEGER NOT NULL, FOREIGN KEY (fk_idempleado) REFERENCES Empleado (idempleado))",
"CREATE TABLE Categoria (idcategoria INTEGER PRIMARY KEY AUTOINCREMENT, nombre TEXT NOT NULL, descripcion TEXT NOT NULL)", "CREATE TABLE Categoria (idcategoria INTEGER PRIMARY KEY AUTOINCREMENT, nombre TEXT NOT NULL, descripcion TEXT NOT NULL)",
@@ -513,8 +514,9 @@ namespace compabetov2.database
"calle TEXT NOT NULL, colonia TEXT NOT NULL, cp TEXT NOT NULL, no_ext TEXT NOT NULL, no_int TEXT NOT NULL, referencia TEXT NOT NULL, " + "calle TEXT NOT NULL, colonia TEXT NOT NULL, cp TEXT NOT NULL, no_ext TEXT NOT NULL, no_int TEXT NOT NULL, referencia TEXT NOT NULL, " +
"telefono TEXT NOT NULL, telefono_extra TEXT NOT NULL)", "telefono TEXT NOT NULL, telefono_extra TEXT NOT NULL)",
"INSERT INTO Empleado ( nombre, apellidos, calle, fecha_contratacion,estado, colonia, cp, no_ext,no_int, referencia, fecha_nac, telefono) VALUES('jefe', '', '', '', '', '', '', '', '', '', '', '');", "INSERT INTO Login ( tipo, usuario, contra) VALUES('admin', 'admin', '12345');",
"INSERT INTO Login ( tipo, usuario, contra, fk_idempleado) VALUES('admin', 'admin', '12345', 1);" "INSERT INTO Empleado ( nombre, apellidos, calle, fecha_contratacion,estado, colonia, cp, no_ext,no_int, referencia, fecha_nac, telefono,fk_idLogin) VALUES('jefe', '', '', '', '', '', '', '', '', '', '', '',1);",
}; };
foreach (string consulta in consultas) foreach (string consulta in consultas)
+21 -1
View File
@@ -21,8 +21,9 @@ namespace compabetov2.database.modelos
public string referencia; public string referencia;
public string fecha_nac; public string fecha_nac;
public string telefono; public string telefono;
public int? fkIdLogin;
public Empleado(int idempeado = -1, string nombre ="", string apellidos = "", string calle = "", string fecha_contratacion = "", string estado = "", string colonia = "", string cp = "", string no_ext = "", string no_int = "", string referencia = "", string fecha_nac = "", string telefono ="") public Empleado(int idempeado = -1, string nombre ="", string apellidos = "", string calle = "", string fecha_contratacion = "", string estado = "", string colonia = "", string cp = "", string no_ext = "", string no_int = "", string referencia = "", string fecha_nac = "", string telefono ="",int? fkIdLogin = null)
{ {
this.idempleado = idempeado; this.idempleado = idempeado;
this.nombre = nombre; this.nombre = nombre;
@@ -37,6 +38,25 @@ namespace compabetov2.database.modelos
this.referencia = referencia; this.referencia = referencia;
this.fecha_nac=fecha_nac; this.fecha_nac=fecha_nac;
this.telefono = telefono; this.telefono = telefono;
this.fkIdLogin = fkIdLogin;
}
public bool CompareEmpleado(Empleado emp2)
{
if (nombre != emp2.nombre) return false;
if (apellidos != emp2.apellidos) return false;
if (calle != emp2.calle) return false;
if (fecha_contratacion != emp2.fecha_contratacion) return false;
if (estado != emp2.estado) return false;
if (colonia != emp2.colonia) return false;
if (cp != emp2.cp) return false;
if (no_ext != emp2.no_ext) return false;
if (no_int != emp2.no_int) return false;
if (referencia != emp2.referencia) return false;
if (fecha_nac != emp2.fecha_nac) return false;
if (telefono != emp2.telefono) return false;
return true;
} }
} }
} }
+12 -3
View File
@@ -105,8 +105,11 @@ namespace compabetov2.database
while (reader.Read()) while (reader.Read())
{ {
long fkIdLogin = reader.GetInt64(0);
long id = reader.GetInt64(0);
Empleado empleado = new Empleado( Empleado empleado = new Empleado(
int.Parse(reader["idempleado"].ToString()), Convert.ToInt32(id),
reader["nombre"].ToString(), reader["nombre"].ToString(),
reader["apellidos"].ToString(), reader["apellidos"].ToString(),
reader["calle"].ToString(), reader["calle"].ToString(),
@@ -118,8 +121,9 @@ namespace compabetov2.database
reader["no_int"].ToString(), reader["no_int"].ToString(),
reader["referencia"].ToString(), reader["referencia"].ToString(),
reader["fecha_nac"].ToString(), reader["fecha_nac"].ToString(),
reader["telefono"].ToString() reader["telefono"].ToString(),
); Convert.ToInt32(fkIdLogin)
) ;
empleados.Add(empleado); empleados.Add(empleado);
} }
return empleados; return empleados;
@@ -136,5 +140,10 @@ namespace compabetov2.database
{ {
return DAO.eliminarEmpleadoDAO(idEmpleado); return DAO.eliminarEmpleadoDAO(idEmpleado);
} }
public static bool actualizarEmpleado(Empleado empleado)
{
return DAO.actualizarEmpleadoDAO(empleado);
}
} }
} }
Binary file not shown.
@@ -1 +1 @@
0de1c424268dd16d06d975ef2c499f33dbd19721fb5a2d42d29e7a4ca4bce0d1 5d59b1013627d47320299052a443bf2f5f938b5e44e9ca7b957196b5427dd7b6
@@ -90,3 +90,4 @@ C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.exe
C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.pdb C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.pdb
C:\Users\carsu\source\repos\compabetoOG\obj\Debug\compabetov2.AgregarEmpleado.resources C:\Users\carsu\source\repos\compabetoOG\obj\Debug\compabetov2.AgregarEmpleado.resources
C:\Users\carsu\source\repos\compabetoOG\obj\Debug\compabetov2.EditarEmpleado.resources C:\Users\carsu\source\repos\compabetoOG\obj\Debug\compabetov2.EditarEmpleado.resources
C:\Users\carsu\source\repos\compabetoOG\obj\Debug\compabetov2.AgregarLogin.resources
Binary file not shown.
Binary file not shown.
Binary file not shown.
+22 -6
View File
@@ -35,8 +35,8 @@ namespace compabetov2
empleadoLayout.ColumnCount = 2; empleadoLayout.ColumnCount = 2;
empleadoLayout.Height = 100; empleadoLayout.Height = 100;
empleadoLayout.Width = 900; empleadoLayout.Width = 900;
empleadoLayout.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 60F)); empleadoLayout.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
empleadoLayout.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 40F)); empleadoLayout.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
empleadoLayout.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); empleadoLayout.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
empleadoLayout.BorderStyle = BorderStyle.FixedSingle; empleadoLayout.BorderStyle = BorderStyle.FixedSingle;
@@ -68,11 +68,12 @@ namespace compabetov2
TableLayoutPanel panelBotones = new TableLayoutPanel(); TableLayoutPanel panelBotones = new TableLayoutPanel();
panelBotones.RowCount = 1; panelBotones.RowCount = 1;
panelBotones.ColumnCount = 3; panelBotones.ColumnCount = 4;
panelBotones.Dock = DockStyle.Fill; panelBotones.Dock = DockStyle.Fill;
panelBotones.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F)); panelBotones.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
panelBotones.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F)); panelBotones.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
panelBotones.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F)); panelBotones.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
panelBotones.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
Button btnVer = new Button(); Button btnVer = new Button();
btnVer.Text = "Ver"; btnVer.Text = "Ver";
@@ -123,6 +124,20 @@ namespace compabetov2
} }
}); });
Button btnLogin = new Button();
btnLogin.Text = "Login";
btnLogin.BackColor = Color.Red;
btnLogin.Dock = DockStyle.Fill;
btnLogin.FlatStyle = FlatStyle.Flat;
btnLogin.FlatAppearance.BorderSize = 0;
btnLogin.Font = new Font(btnVer.Font.FontFamily, 16);
btnLogin.ForeColor = Color.White;
btnLogin.Click += new EventHandler(delegate (object sender, EventArgs e)
{
});
infoEmpleado.Controls.Add(imgEmpleado,0,0); infoEmpleado.Controls.Add(imgEmpleado,0,0);
infoEmpleado.Controls.Add(nombreEmpleado,1,0); infoEmpleado.Controls.Add(nombreEmpleado,1,0);
@@ -130,6 +145,7 @@ namespace compabetov2
panelBotones.Controls.Add(btnVer,0,0); panelBotones.Controls.Add(btnVer,0,0);
panelBotones.Controls.Add(btnEditar,1,0); panelBotones.Controls.Add(btnEditar,1,0);
panelBotones.Controls.Add(btnEliminar,2,0); panelBotones.Controls.Add(btnEliminar,2,0);
panelBotones.Controls.Add(btnLogin,3,0);
empleadoLayout.Controls.Add(infoEmpleado,0,0); empleadoLayout.Controls.Add(infoEmpleado,0,0);
empleadoLayout.Controls.Add(panelBotones,1,0); empleadoLayout.Controls.Add(panelBotones,1,0);