diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json index 249c658..dc00168 100644 --- a/.vs/VSWorkspaceState.json +++ b/.vs/VSWorkspaceState.json @@ -1,6 +1,8 @@ { "ExpandedNodes": [ - "" + "", + "\\database", + "\\database\\modelos" ], "SelectedNode": "\\.sln", "PreviewInSolutionExplorer": false diff --git a/.vs/compabetoOG/v17/.wsuo b/.vs/compabetoOG/v17/.wsuo index 473814e..045ece8 100644 Binary files a/.vs/compabetoOG/v17/.wsuo and b/.vs/compabetoOG/v17/.wsuo differ diff --git a/bin/Debug/compabetov2.exe b/bin/Debug/compabetov2.exe index 9c47dd5..d5cd94e 100644 Binary files a/bin/Debug/compabetov2.exe and b/bin/Debug/compabetov2.exe differ diff --git a/bin/Debug/compabetov2.pdb b/bin/Debug/compabetov2.pdb index d2f5e52..8bdb528 100644 Binary files a/bin/Debug/compabetov2.pdb and b/bin/Debug/compabetov2.pdb differ diff --git a/bin/Debug/data.db b/bin/Debug/data.db index ef4609c..8054df2 100644 Binary files a/bin/Debug/data.db and b/bin/Debug/data.db differ diff --git a/database/DAO.cs b/database/DAO.cs index 2437943..68fddac 100644 --- a/database/DAO.cs +++ b/database/DAO.cs @@ -141,6 +141,77 @@ namespace compabetov2.database return reader; } } + + public static bool actualizarEmpleadoDAO(Empleado empleado) + { + var db_conexion = new Conexion(); + try + { + using (SQLiteConnection conexion = db_conexion.get_connection()) + { + conexion.Open(); + + string sql = "UPDATE Empleado SET " + + "VALUES (@nombre, @apellidos, @calle, @fecha_contratacion, @estado, @colonia, @cp, @no_ext, @no_int, @referencia, @fecha_nac, @telefono)"; + + + + using (SQLiteCommand command = new SQLiteCommand(sql, conexion)) + { + command.Parameters.AddWithValue("@nombre", empleado.nombre); + command.Parameters.AddWithValue("@apellidos", empleado.apellidos); + command.Parameters.AddWithValue("@calle", empleado.calle); + command.Parameters.AddWithValue("@fecha_contratacion", empleado.fecha_contratacion); + command.Parameters.AddWithValue("@estado", empleado.estado); + command.Parameters.AddWithValue("@colonia", empleado.colonia); + command.Parameters.AddWithValue("@cp", empleado.cp); + command.Parameters.AddWithValue("@no_ext", empleado.no_ext); + command.Parameters.AddWithValue("@no_int", empleado.no_int); + command.Parameters.AddWithValue("@referencia", empleado.referencia); + command.Parameters.AddWithValue("@fecha_nac", empleado.fecha_nac); + command.Parameters.AddWithValue("@telefono", empleado.telefono); + + int filasAfectadas = command.ExecuteNonQuery(); + + if (filasAfectadas > 0) { return true; } + else { return false; } + } + } + } + catch (SQLiteException ex) + { + MessageBox.Show(ex.Message); + return false; + } + } + + public static bool eliminarEmpleadoDAO(int idEmpleado) { + var db_conexion = new Conexion(); + try + { + using (SQLiteConnection conexion = db_conexion.get_connection()) + { + conexion.Open(); + + string sql = "DELETE FROM Empleado WHERE idproducto = @idempleado"; + + using (SQLiteCommand command = new SQLiteCommand(sql, conexion)) + { + command.Parameters.AddWithValue("@idempleado", idEmpleado); + int filasAfectadas = command.ExecuteNonQuery(); + + if (filasAfectadas > 0) { return true; } + else { return false; } + } + } + } + catch (SQLiteException ex) + { + MessageBox.Show(ex.Message); + return false; + } + } + public static SQLiteDataReader conseguirProductosDAO() { SQLiteDataReader reader = null; diff --git a/database/service.cs b/database/service.cs index 6ae0621..05a81e9 100644 --- a/database/service.cs +++ b/database/service.cs @@ -131,5 +131,10 @@ namespace compabetov2.database { return DAO.aumentarStockDAO(stockNuevo); } + + public static bool eliminarEmpleado(int idEmpleado) + { + return DAO.eliminarEmpleadoDAO(idEmpleado); + } } } diff --git a/inventario.Designer.cs b/inventario.Designer.cs index 2dbcdfa..e3b225c 100644 --- a/inventario.Designer.cs +++ b/inventario.Designer.cs @@ -200,6 +200,7 @@ this.stockPanel.Name = "stockPanel"; this.stockPanel.Size = new System.Drawing.Size(834, 518); this.stockPanel.TabIndex = 13; + this.stockPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.stockPanel_Paint); // // inventario // diff --git a/inventario.cs b/inventario.cs index 80da35e..af8b2b8 100644 --- a/inventario.cs +++ b/inventario.cs @@ -212,5 +212,10 @@ namespace compabetov2 { } + + private void stockPanel_Paint(object sender, PaintEventArgs e) + { + + } } } diff --git a/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/obj/Debug/DesignTimeResolveAssemblyReferences.cache index 562d4b7..05a8049 100644 Binary files a/obj/Debug/DesignTimeResolveAssemblyReferences.cache and b/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ diff --git a/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index 331e5bd..eaa118c 100644 Binary files a/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/obj/Debug/compabetov2.csproj.AssemblyReference.cache b/obj/Debug/compabetov2.csproj.AssemblyReference.cache index 6e284d8..46c7c97 100644 Binary files a/obj/Debug/compabetov2.csproj.AssemblyReference.cache and b/obj/Debug/compabetov2.csproj.AssemblyReference.cache differ diff --git a/obj/Debug/compabetov2.csproj.GenerateResource.cache b/obj/Debug/compabetov2.csproj.GenerateResource.cache index 02cf15a..344312f 100644 Binary files a/obj/Debug/compabetov2.csproj.GenerateResource.cache and b/obj/Debug/compabetov2.csproj.GenerateResource.cache differ diff --git a/obj/Debug/compabetov2.exe b/obj/Debug/compabetov2.exe index 9c47dd5..d5cd94e 100644 Binary files a/obj/Debug/compabetov2.exe and b/obj/Debug/compabetov2.exe differ diff --git a/obj/Debug/compabetov2.pdb b/obj/Debug/compabetov2.pdb index d2f5e52..8bdb528 100644 Binary files a/obj/Debug/compabetov2.pdb and b/obj/Debug/compabetov2.pdb differ diff --git a/personal.Designer.cs b/personal.Designer.cs index 575439c..7404df3 100644 --- a/personal.Designer.cs +++ b/personal.Designer.cs @@ -37,55 +37,15 @@ this.button4 = new System.Windows.Forms.Button(); this.button5 = new System.Windows.Forms.Button(); this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); - this.txtnombrepersonal = new System.Windows.Forms.TextBox(); - this.txtapellidopersonal = new System.Windows.Forms.TextBox(); - this.txtnointpersonal = new System.Windows.Forms.TextBox(); - this.txtnoextpersonal = new System.Windows.Forms.TextBox(); - this.txtcodigopersonal = new System.Windows.Forms.TextBox(); - this.txtcoloniapersonal = new System.Windows.Forms.TextBox(); - this.txtcallepersonal = new System.Windows.Forms.TextBox(); - this.txttelefonopersonal = new System.Windows.Forms.TextBox(); - this.txtreferenciapersonal = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.dtpfechapersonal = new System.Windows.Forms.DateTimePicker(); - this.cbestadopersonal = new System.Windows.Forms.ComboBox(); - this.label4 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.label6 = new System.Windows.Forms.Label(); - this.label7 = new System.Windows.Forms.Label(); - this.label8 = new System.Windows.Forms.Label(); - this.label9 = new System.Windows.Forms.Label(); - this.dtpnacimientopersonal = new System.Windows.Forms.DateTimePicker(); - this.label10 = new System.Windows.Forms.Label(); - this.label11 = new System.Windows.Forms.Label(); - this.btnEliminar = new System.Windows.Forms.Button(); - this.btnEditar = new System.Windows.Forms.Button(); - this.btnModificar = new System.Windows.Forms.Button(); - this.btnAgregar = new System.Windows.Forms.Button(); - this.label12 = new System.Windows.Forms.Label(); - this.dataGridView1 = new System.Windows.Forms.DataGridView(); - 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(); - this.btnNuevo = new System.Windows.Forms.Button(); + this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel(); + this.personalPanel = new System.Windows.Forms.FlowLayoutPanel(); + this.lblhora = new System.Windows.Forms.Label(); this.empleadoBindingSource = new System.Windows.Forms.BindingSource(this.components); this.conexionBindingSource = new System.Windows.Forms.BindingSource(this.components); + this.btnAgregar = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox7)).BeginInit(); this.panel2.SuspendLayout(); this.flowLayoutPanel1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.empleadoBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.conexionBindingSource)).BeginInit(); this.SuspendLayout(); @@ -93,8 +53,8 @@ // pictureBox7 // this.pictureBox7.Image = global::compabetov2.Properties.Resources.HomeroMenu; - this.pictureBox7.Location = new System.Drawing.Point(64, 34); - this.pictureBox7.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.pictureBox7.Location = new System.Drawing.Point(48, 28); + this.pictureBox7.Margin = new System.Windows.Forms.Padding(2); this.pictureBox7.Name = "pictureBox7"; this.pictureBox7.Size = new System.Drawing.Size(190, 197); this.pictureBox7.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; @@ -105,10 +65,10 @@ // this.panel2.BackColor = System.Drawing.Color.Transparent; this.panel2.Controls.Add(this.pictureBox7); - this.panel2.Location = new System.Drawing.Point(3, 2); - this.panel2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.panel2.Location = new System.Drawing.Point(2, 2); + this.panel2.Margin = new System.Windows.Forms.Padding(2); this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(312, 263); + this.panel2.Size = new System.Drawing.Size(234, 214); this.panel2.TabIndex = 8; // // button1 @@ -120,15 +80,14 @@ this.button1.ForeColor = System.Drawing.SystemColors.ButtonHighlight; this.button1.Image = global::compabetov2.Properties.Resources.Menui1; this.button1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.button1.Location = new System.Drawing.Point(3, 269); - this.button1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button1.Location = new System.Drawing.Point(2, 220); + this.button1.Margin = new System.Windows.Forms.Padding(2); this.button1.Name = "button1"; - this.button1.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0); - this.button1.Size = new System.Drawing.Size(312, 114); + this.button1.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0); + this.button1.Size = new System.Drawing.Size(234, 93); this.button1.TabIndex = 8; this.button1.Text = "Menú"; this.button1.UseVisualStyleBackColor = false; - this.button1.Click += new System.EventHandler(this.button1_Click); // // button2 // @@ -139,11 +98,11 @@ this.button2.ForeColor = System.Drawing.SystemColors.ButtonHighlight; this.button2.Image = global::compabetov2.Properties.Resources.estadisticasi; this.button2.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.button2.Location = new System.Drawing.Point(3, 387); - this.button2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button2.Location = new System.Drawing.Point(2, 317); + this.button2.Margin = new System.Windows.Forms.Padding(2); this.button2.Name = "button2"; - this.button2.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0); - this.button2.Size = new System.Drawing.Size(312, 114); + this.button2.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0); + this.button2.Size = new System.Drawing.Size(234, 93); this.button2.TabIndex = 9; this.button2.Text = "Estadisticas"; this.button2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -158,11 +117,11 @@ this.button3.ForeColor = System.Drawing.SystemColors.ButtonHighlight; this.button3.Image = global::compabetov2.Properties.Resources.productoi; this.button3.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.button3.Location = new System.Drawing.Point(3, 505); - this.button3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button3.Location = new System.Drawing.Point(2, 414); + this.button3.Margin = new System.Windows.Forms.Padding(2); this.button3.Name = "button3"; - this.button3.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0); - this.button3.Size = new System.Drawing.Size(312, 114); + this.button3.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0); + this.button3.Size = new System.Drawing.Size(234, 93); this.button3.TabIndex = 10; this.button3.Text = "Productos"; this.button3.UseVisualStyleBackColor = false; @@ -176,11 +135,11 @@ this.button4.ForeColor = System.Drawing.SystemColors.ButtonHighlight; this.button4.Image = global::compabetov2.Properties.Resources.reportesi; this.button4.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.button4.Location = new System.Drawing.Point(3, 623); - this.button4.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button4.Location = new System.Drawing.Point(2, 511); + this.button4.Margin = new System.Windows.Forms.Padding(2); this.button4.Name = "button4"; - this.button4.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0); - this.button4.Size = new System.Drawing.Size(312, 114); + this.button4.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0); + this.button4.Size = new System.Drawing.Size(234, 93); this.button4.TabIndex = 11; this.button4.Text = "Reportes"; this.button4.UseVisualStyleBackColor = false; @@ -194,11 +153,11 @@ this.button5.ForeColor = System.Drawing.SystemColors.ButtonHighlight; this.button5.Image = global::compabetov2.Properties.Resources.sesionc; this.button5.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.button5.Location = new System.Drawing.Point(3, 741); - this.button5.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button5.Location = new System.Drawing.Point(2, 608); + this.button5.Margin = new System.Windows.Forms.Padding(2); this.button5.Name = "button5"; - this.button5.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0); - this.button5.Size = new System.Drawing.Size(312, 114); + this.button5.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0); + this.button5.Size = new System.Drawing.Size(234, 93); this.button5.TabIndex = 12; this.button5.Text = "Salir"; this.button5.UseVisualStyleBackColor = false; @@ -212,443 +171,40 @@ this.flowLayoutPanel1.Controls.Add(this.button3); this.flowLayoutPanel1.Controls.Add(this.button4); this.flowLayoutPanel1.Controls.Add(this.button5); - this.flowLayoutPanel1.Location = new System.Drawing.Point(-3, -2); - this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.flowLayoutPanel1.Controls.Add(this.flowLayoutPanel2); + this.flowLayoutPanel1.Location = new System.Drawing.Point(-2, -2); + this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(2); this.flowLayoutPanel1.Name = "flowLayoutPanel1"; - this.flowLayoutPanel1.Size = new System.Drawing.Size(324, 1061); + this.flowLayoutPanel1.Size = new System.Drawing.Size(243, 862); this.flowLayoutPanel1.TabIndex = 8; // - // txtnombrepersonal - // - this.txtnombrepersonal.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F); - this.txtnombrepersonal.Location = new System.Drawing.Point(493, 347); - this.txtnombrepersonal.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.txtnombrepersonal.Name = "txtnombrepersonal"; - this.txtnombrepersonal.Size = new System.Drawing.Size(299, 55); - this.txtnombrepersonal.TabIndex = 13; - // - // txtapellidopersonal - // - this.txtapellidopersonal.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F); - this.txtapellidopersonal.Location = new System.Drawing.Point(819, 347); - this.txtapellidopersonal.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.txtapellidopersonal.Name = "txtapellidopersonal"; - this.txtapellidopersonal.Size = new System.Drawing.Size(299, 55); - this.txtapellidopersonal.TabIndex = 14; - // - // txtnointpersonal - // - this.txtnointpersonal.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F); - this.txtnointpersonal.Location = new System.Drawing.Point(493, 572); - this.txtnointpersonal.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.txtnointpersonal.Name = "txtnointpersonal"; - this.txtnointpersonal.Size = new System.Drawing.Size(299, 55); - this.txtnointpersonal.TabIndex = 20; - // - // txtnoextpersonal - // - this.txtnoextpersonal.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F); - this.txtnoextpersonal.Location = new System.Drawing.Point(1464, 452); - this.txtnoextpersonal.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.txtnoextpersonal.Name = "txtnoextpersonal"; - this.txtnoextpersonal.Size = new System.Drawing.Size(299, 55); - this.txtnoextpersonal.TabIndex = 19; - // - // txtcodigopersonal - // - this.txtcodigopersonal.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F); - this.txtcodigopersonal.Location = new System.Drawing.Point(1141, 452); - this.txtcodigopersonal.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.txtcodigopersonal.Name = "txtcodigopersonal"; - this.txtcodigopersonal.Size = new System.Drawing.Size(299, 55); - this.txtcodigopersonal.TabIndex = 18; - // - // txtcoloniapersonal - // - this.txtcoloniapersonal.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F); - this.txtcoloniapersonal.Location = new System.Drawing.Point(816, 452); - this.txtcoloniapersonal.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.txtcoloniapersonal.Name = "txtcoloniapersonal"; - this.txtcoloniapersonal.Size = new System.Drawing.Size(299, 55); - this.txtcoloniapersonal.TabIndex = 17; - // - // txtcallepersonal - // - this.txtcallepersonal.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F); - this.txtcallepersonal.Location = new System.Drawing.Point(1141, 347); - this.txtcallepersonal.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.txtcallepersonal.Name = "txtcallepersonal"; - this.txtcallepersonal.Size = new System.Drawing.Size(299, 55); - this.txtcallepersonal.TabIndex = 24; - // - // txttelefonopersonal - // - this.txttelefonopersonal.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F); - this.txttelefonopersonal.Location = new System.Drawing.Point(1464, 550); - this.txttelefonopersonal.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.txttelefonopersonal.Name = "txttelefonopersonal"; - this.txttelefonopersonal.Size = new System.Drawing.Size(299, 55); - this.txttelefonopersonal.TabIndex = 23; - // - // txtreferenciapersonal - // - this.txtreferenciapersonal.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F); - this.txtreferenciapersonal.Location = new System.Drawing.Point(816, 550); - this.txtreferenciapersonal.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.txtreferenciapersonal.Name = "txtreferenciapersonal"; - this.txtreferenciapersonal.Size = new System.Drawing.Size(299, 55); - this.txtreferenciapersonal.TabIndex = 21; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F); - this.label1.ForeColor = System.Drawing.Color.Navy; - this.label1.Location = new System.Drawing.Point(496, 302); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(138, 39); - this.label1.TabIndex = 25; - this.label1.Text = "Nombre"; - this.label1.TextAlign = System.Drawing.ContentAlignment.TopCenter; - this.label1.Click += new System.EventHandler(this.label1_Click); - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F); - this.label2.ForeColor = System.Drawing.Color.Navy; - this.label2.Location = new System.Drawing.Point(811, 306); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(140, 39); - this.label2.TabIndex = 26; - this.label2.Text = "Apellido"; - this.label2.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F); - this.label3.ForeColor = System.Drawing.Color.Navy; - this.label3.Location = new System.Drawing.Point(1460, 306); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(353, 39); - this.label3.TabIndex = 27; - this.label3.Text = "Fecha de contratación"; - this.label3.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // - // dtpfechapersonal - // - this.dtpfechapersonal.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F); - this.dtpfechapersonal.Location = new System.Drawing.Point(1467, 359); - this.dtpfechapersonal.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.dtpfechapersonal.Name = "dtpfechapersonal"; - this.dtpfechapersonal.Size = new System.Drawing.Size(296, 36); - this.dtpfechapersonal.TabIndex = 28; - // - // cbestadopersonal - // - this.cbestadopersonal.Font = new System.Drawing.Font("Microsoft Sans Serif", 26F); - this.cbestadopersonal.FormattingEnabled = true; - this.cbestadopersonal.Location = new System.Drawing.Point(493, 452); - this.cbestadopersonal.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.cbestadopersonal.Name = "cbestadopersonal"; - this.cbestadopersonal.Size = new System.Drawing.Size(160, 59); - this.cbestadopersonal.TabIndex = 29; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F); - this.label4.ForeColor = System.Drawing.Color.Navy; - this.label4.Location = new System.Drawing.Point(507, 407); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(123, 39); - this.label4.TabIndex = 30; - this.label4.Text = "Estado"; - this.label4.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F); - this.label5.ForeColor = System.Drawing.Color.Navy; - this.label5.Location = new System.Drawing.Point(819, 411); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(134, 39); - this.label5.TabIndex = 31; - this.label5.Text = "Colonia"; - this.label5.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F); - this.label6.ForeColor = System.Drawing.Color.Navy; - this.label6.Location = new System.Drawing.Point(1140, 411); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(230, 39); - this.label6.TabIndex = 32; - this.label6.Text = "Codigo Postal"; - this.label6.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F); - this.label7.ForeColor = System.Drawing.Color.Navy; - this.label7.Location = new System.Drawing.Point(1457, 406); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(128, 39); - this.label7.TabIndex = 33; - this.label7.Text = "No. Ext"; - this.label7.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // - // label8 - // - this.label8.AutoSize = true; - this.label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F); - this.label8.ForeColor = System.Drawing.Color.Navy; - this.label8.Location = new System.Drawing.Point(485, 526); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(117, 39); - this.label8.TabIndex = 34; - this.label8.Text = "No. Int"; - this.label8.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // - // label9 - // - this.label9.AutoSize = true; - this.label9.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F); - this.label9.ForeColor = System.Drawing.Color.Navy; - this.label9.Location = new System.Drawing.Point(819, 510); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(182, 39); - this.label9.TabIndex = 35; - this.label9.Text = "Referencia"; - this.label9.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // - // dtpnacimientopersonal - // - this.dtpnacimientopersonal.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F); - this.dtpnacimientopersonal.Location = new System.Drawing.Point(1141, 560); - this.dtpnacimientopersonal.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.dtpnacimientopersonal.Name = "dtpnacimientopersonal"; - this.dtpnacimientopersonal.Size = new System.Drawing.Size(296, 36); - this.dtpnacimientopersonal.TabIndex = 36; - // - // label10 - // - this.label10.AutoSize = true; - this.label10.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F); - this.label10.ForeColor = System.Drawing.Color.Navy; - this.label10.Location = new System.Drawing.Point(1133, 510); - this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(339, 39); - this.label10.TabIndex = 37; - this.label10.Text = "Fecha de Nacimiento"; - this.label10.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // - // label11 - // - this.label11.AutoSize = true; - this.label11.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F); - this.label11.ForeColor = System.Drawing.Color.Navy; - this.label11.Location = new System.Drawing.Point(1479, 510); - this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(150, 39); - this.label11.TabIndex = 38; - this.label11.Text = "Telefono"; - this.label11.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // - // btnEliminar - // - this.btnEliminar.Enabled = false; - this.btnEliminar.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnEliminar.Location = new System.Drawing.Point(1377, 698); - this.btnEliminar.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.btnEliminar.Name = "btnEliminar"; - this.btnEliminar.Size = new System.Drawing.Size(171, 70); - this.btnEliminar.TabIndex = 42; - this.btnEliminar.Text = "Eliminar"; - this.btnEliminar.UseVisualStyleBackColor = true; - // - // btnEditar - // - this.btnEditar.Enabled = false; - this.btnEditar.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnEditar.Location = new System.Drawing.Point(1177, 698); - this.btnEditar.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.btnEditar.Name = "btnEditar"; - this.btnEditar.Size = new System.Drawing.Size(171, 70); - this.btnEditar.TabIndex = 41; - this.btnEditar.Text = "Editar"; - this.btnEditar.UseVisualStyleBackColor = true; - this.btnEditar.Click += new System.EventHandler(this.button8_Click); - // - // btnModificar - // - this.btnModificar.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnModificar.Location = new System.Drawing.Point(775, 698); - this.btnModificar.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.btnModificar.Name = "btnModificar"; - this.btnModificar.Size = new System.Drawing.Size(171, 70); - this.btnModificar.TabIndex = 40; - this.btnModificar.Text = "Modificar"; - this.btnModificar.UseVisualStyleBackColor = true; - this.btnModificar.Click += new System.EventHandler(this.button7_Click); - // - // btnAgregar - // - this.btnAgregar.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnAgregar.Location = new System.Drawing.Point(973, 698); - this.btnAgregar.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.btnAgregar.Name = "btnAgregar"; - this.btnAgregar.Size = new System.Drawing.Size(171, 70); - this.btnAgregar.TabIndex = 39; - this.btnAgregar.Text = "Agregar"; - this.btnAgregar.UseVisualStyleBackColor = true; - this.btnAgregar.Click += new System.EventHandler(this.button6_Click); - // - // label12 - // - this.label12.AutoSize = true; - this.label12.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F); - this.label12.ForeColor = System.Drawing.Color.Navy; - this.label12.Location = new System.Drawing.Point(1133, 306); - this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size(96, 39); - this.label12.TabIndex = 43; - this.label12.Text = "Calle"; - this.label12.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // - // dataGridView1 - // - this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - 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(344, 92); - this.dataGridView1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.dataGridView1.Name = "dataGridView1"; - this.dataGridView1.RowHeadersWidth = 51; - this.dataGridView1.Size = new System.Drawing.Size(1467, 185); - this.dataGridView1.TabIndex = 44; - this.dataGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentClick); - this.dataGridView1.RowEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_RowEnter); - // - // Id - // - this.Id.HeaderText = "Id"; - this.Id.MinimumWidth = 6; - this.Id.Name = "Id"; - this.Id.Width = 125; - // - // Nombre - // - this.Nombre.HeaderText = "Nombre"; - this.Nombre.MinimumWidth = 6; - this.Nombre.Name = "Nombre"; - this.Nombre.Width = 125; - // - // Apellidos - // - this.Apellidos.HeaderText = "Apellidos"; - this.Apellidos.MinimumWidth = 6; - this.Apellidos.Name = "Apellidos"; - this.Apellidos.Width = 125; - // - // fecha_con - // - this.fecha_con.HeaderText = "Fecha contratacion"; - this.fecha_con.MinimumWidth = 6; - this.fecha_con.Name = "fecha_con"; - this.fecha_con.Width = 125; - // - // estado - // - this.estado.HeaderText = "Estado"; - this.estado.MinimumWidth = 6; - this.estado.Name = "estado"; - this.estado.Width = 125; - // - // calle - // - this.calle.HeaderText = "Calle"; - this.calle.MinimumWidth = 6; - this.calle.Name = "calle"; - this.calle.Width = 125; - // - // calonia - // - this.calonia.HeaderText = "Calonia"; - this.calonia.MinimumWidth = 6; - this.calonia.Name = "calonia"; - this.calonia.Width = 125; - // - // cp - // - this.cp.HeaderText = "Cp"; - this.cp.MinimumWidth = 6; - this.cp.Name = "cp"; - this.cp.Width = 125; - // - // no_ext - // - this.no_ext.HeaderText = "No. Exterior"; - this.no_ext.MinimumWidth = 6; - this.no_ext.Name = "no_ext"; - this.no_ext.Width = 125; - // - // no_int - // - this.no_int.HeaderText = "No. Interior"; - this.no_int.MinimumWidth = 6; - this.no_int.Name = "no_int"; - this.no_int.Width = 125; - // - // referencia - // - this.referencia.HeaderText = "Referencia"; - this.referencia.MinimumWidth = 6; - this.referencia.Name = "referencia"; - this.referencia.Width = 125; - // - // fecha_nac - // - this.fecha_nac.HeaderText = "Fecha nacimiento"; - this.fecha_nac.MinimumWidth = 6; - this.fecha_nac.Name = "fecha_nac"; - this.fecha_nac.Width = 125; - // - // telefono - // - this.telefono.HeaderText = "Telefono"; - this.telefono.MinimumWidth = 6; - this.telefono.Name = "telefono"; - this.telefono.Width = 125; - // - // btnNuevo - // - this.btnNuevo.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnNuevo.Location = new System.Drawing.Point(583, 698); - this.btnNuevo.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.btnNuevo.Name = "btnNuevo"; - this.btnNuevo.Size = new System.Drawing.Size(171, 70); - this.btnNuevo.TabIndex = 45; - this.btnNuevo.Text = "Nuevo"; - this.btnNuevo.UseVisualStyleBackColor = true; - this.btnNuevo.Click += new System.EventHandler(this.btnNuevo_Click); + // flowLayoutPanel2 + // + this.flowLayoutPanel2.Location = new System.Drawing.Point(3, 706); + this.flowLayoutPanel2.Name = "flowLayoutPanel2"; + this.flowLayoutPanel2.Size = new System.Drawing.Size(200, 100); + this.flowLayoutPanel2.TabIndex = 13; + // + // personalPanel + // + this.personalPanel.Location = new System.Drawing.Point(345, 250); + this.personalPanel.Name = "personalPanel"; + this.personalPanel.Size = new System.Drawing.Size(909, 449); + this.personalPanel.TabIndex = 9; + this.personalPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.flowLayoutPanel3_Paint); + // + // lblhora + // + this.lblhora.AutoSize = true; + this.lblhora.Font = new System.Drawing.Font("Microsoft Sans Serif", 60F); + this.lblhora.ForeColor = System.Drawing.Color.MediumBlue; + this.lblhora.Location = new System.Drawing.Point(651, 65); + this.lblhora.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.lblhora.Name = "lblhora"; + this.lblhora.Size = new System.Drawing.Size(352, 91); + this.lblhora.TabIndex = 11; + this.lblhora.Text = "Personal"; + this.lblhora.Click += new System.EventHandler(this.lblhora_Click); // // empleadoBindingSource // @@ -658,43 +214,25 @@ // this.conexionBindingSource.DataSource = typeof(compabetov2.database.Conexion); // + // btnAgregar + // + this.btnAgregar.Location = new System.Drawing.Point(738, 179); + this.btnAgregar.Name = "btnAgregar"; + this.btnAgregar.Size = new System.Drawing.Size(125, 35); + this.btnAgregar.TabIndex = 12; + this.btnAgregar.Text = "Agregar"; + this.btnAgregar.UseVisualStyleBackColor = true; + // // personal // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1827, 834); - this.Controls.Add(this.btnNuevo); - this.Controls.Add(this.dataGridView1); - this.Controls.Add(this.label12); - this.Controls.Add(this.btnEliminar); - this.Controls.Add(this.btnEditar); - this.Controls.Add(this.btnModificar); + this.ClientSize = new System.Drawing.Size(1370, 749); this.Controls.Add(this.btnAgregar); - this.Controls.Add(this.label11); - this.Controls.Add(this.label10); - this.Controls.Add(this.dtpnacimientopersonal); - this.Controls.Add(this.label9); - this.Controls.Add(this.label8); - this.Controls.Add(this.label7); - this.Controls.Add(this.label6); - this.Controls.Add(this.label5); - this.Controls.Add(this.label4); - this.Controls.Add(this.cbestadopersonal); - this.Controls.Add(this.dtpfechapersonal); - this.Controls.Add(this.label3); - this.Controls.Add(this.label2); - this.Controls.Add(this.label1); - this.Controls.Add(this.txtcallepersonal); - this.Controls.Add(this.txttelefonopersonal); - this.Controls.Add(this.txtreferenciapersonal); - this.Controls.Add(this.txtnointpersonal); - this.Controls.Add(this.txtnoextpersonal); - this.Controls.Add(this.txtcodigopersonal); - this.Controls.Add(this.txtcoloniapersonal); - this.Controls.Add(this.txtapellidopersonal); - this.Controls.Add(this.txtnombrepersonal); + this.Controls.Add(this.lblhora); + this.Controls.Add(this.personalPanel); this.Controls.Add(this.flowLayoutPanel1); - this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.Margin = new System.Windows.Forms.Padding(2); this.Name = "personal"; this.Text = "personal"; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; @@ -703,7 +241,6 @@ this.panel2.ResumeLayout(false); this.panel2.PerformLayout(); this.flowLayoutPanel1.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.empleadoBindingSource)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.conexionBindingSource)).EndInit(); this.ResumeLayout(false); @@ -721,50 +258,11 @@ private System.Windows.Forms.Button button4; private System.Windows.Forms.Button button5; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; - private System.Windows.Forms.TextBox txtnombrepersonal; - private System.Windows.Forms.TextBox txtapellidopersonal; - private System.Windows.Forms.TextBox txtnointpersonal; - private System.Windows.Forms.TextBox txtnoextpersonal; - private System.Windows.Forms.TextBox txtcodigopersonal; - private System.Windows.Forms.TextBox txtcoloniapersonal; - private System.Windows.Forms.TextBox txtcallepersonal; - private System.Windows.Forms.TextBox txttelefonopersonal; - private System.Windows.Forms.TextBox txtreferenciapersonal; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.DateTimePicker dtpfechapersonal; - private System.Windows.Forms.ComboBox cbestadopersonal; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.Label label8; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.DateTimePicker dtpnacimientopersonal; - private System.Windows.Forms.Label label10; - private System.Windows.Forms.Label label11; - private System.Windows.Forms.Button btnEliminar; - private System.Windows.Forms.Button btnEditar; - private System.Windows.Forms.Button btnModificar; - private System.Windows.Forms.Button btnAgregar; - private System.Windows.Forms.Label label12; - 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; - private System.Windows.Forms.Button btnNuevo; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2; + private System.Windows.Forms.FlowLayoutPanel personalPanel; + private System.Windows.Forms.Label lblhora; + private System.Windows.Forms.Button btnAgregar; } } \ No newline at end of file diff --git a/personal.cs b/personal.cs index dbc8493..59e4423 100644 --- a/personal.cs +++ b/personal.cs @@ -6,6 +6,7 @@ using System.ComponentModel; using System.Data; using System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder; using System.Drawing; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -15,13 +16,121 @@ namespace compabetov2 { public partial class personal : Form { + List empleados; public personal() { InitializeComponent(); - llenarGrid(); - limpiarCampos(); + llenarPanel(); } - + + private void llenarPanel() + { + personalPanel.Controls.Clear(); + empleados = service.conseguirEmpleados(); + + foreach(Empleado empleado in empleados) + { + TableLayoutPanel empleadoLayout = new TableLayoutPanel(); + empleadoLayout.RowCount = 1; + empleadoLayout.ColumnCount = 2; + empleadoLayout.Height = 100; + empleadoLayout.Width = 900; + empleadoLayout.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 60F)); + empleadoLayout.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 40F)); + empleadoLayout.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); + empleadoLayout.BorderStyle = BorderStyle.FixedSingle; + + TableLayoutPanel infoEmpleado = new TableLayoutPanel(); + infoEmpleado.RowCount = 1; + infoEmpleado.ColumnCount = 2; + infoEmpleado.Dock = DockStyle.Fill; + + Label idEmpleado = new Label(); + idEmpleado.Text = empleado.idempleado.ToString(); + idEmpleado.BackColor = Color.FromArgb(82, 82, 82); + idEmpleado.ForeColor = Color.White; + idEmpleado.AutoSize = true; + idEmpleado.Dock = DockStyle.Left; + + PictureBox imgEmpleado = new PictureBox(); + imgEmpleado.Dock = DockStyle.Fill; + string rutaImg = Path.Combine(Application.StartupPath, "Resources", "usuarios", "usuarioAnonimo.png"); + imgEmpleado.Image = Image.FromFile(rutaImg); + imgEmpleado.BackgroundImageLayout = ImageLayout.Stretch; + imgEmpleado.SizeMode = PictureBoxSizeMode.Zoom; + imgEmpleado.Controls.Add(idEmpleado); + + Label nombreEmpleado = new Label(); + nombreEmpleado.Dock = DockStyle.Fill; + nombreEmpleado.Text = empleado.nombre; + nombreEmpleado.Font = new Font(nombreEmpleado.Font.FontFamily, 16); + nombreEmpleado.TextAlign = ContentAlignment.MiddleLeft; + + TableLayoutPanel panelBotones = new TableLayoutPanel(); + panelBotones.RowCount = 1; + panelBotones.ColumnCount = 3; + panelBotones.Dock = DockStyle.Fill; + panelBotones.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F)); + panelBotones.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F)); + panelBotones.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F)); + + Button btnVer = new Button(); + btnVer.Text = "Ver"; + btnVer.Dock = DockStyle.Fill; + btnVer.FlatStyle = FlatStyle.Flat; + btnVer.FlatAppearance.BorderSize = 0; + btnVer.BackColor = Color.FromArgb(33, 90, 255); + btnVer.Font = new Font(btnVer.Font.FontFamily, 16); + btnVer.ForeColor = Color.White; + btnVer.Click += new EventHandler(delegate (object sender, EventArgs e) + { + string informacion = $"Nombre: {empleado.nombre} {empleado.apellidos}\nCalle: {empleado.calle}\nColonia: {empleado.colonia}\n" + + $"Codigo postal: {empleado.cp}\nNumero Exterior: {empleado.no_ext}\nNumero Interior: {empleado.no_int}\nReferencia: {empleado.referencia}" + + $"\nFecha de nacimiento: {empleado.fecha_nac}\nTelefono: {empleado.telefono}"; + MessageBox.Show(informacion,"Informacion"); + }); + + Button btnEditar = new Button(); + btnEditar.Text = "Editar"; + btnEditar.Dock = DockStyle.Fill; + btnEditar.FlatStyle = FlatStyle.Flat; + btnEditar.FlatAppearance.BorderSize = 0; + btnEditar.BackColor = Color.FromArgb(33, 90, 255); + btnEditar.Font = new Font(btnVer.Font.FontFamily, 16); + btnEditar.ForeColor = Color.White; + + Button btnEliminar = new Button(); + btnEliminar.Text = "Eliminar"; + btnEliminar.BackColor = Color.Red; + btnEliminar.Dock = DockStyle.Fill; + btnEliminar.FlatStyle = FlatStyle.Flat; + btnEliminar.FlatAppearance.BorderSize = 0; + btnEliminar.Font = new Font(btnVer.Font.FontFamily, 16); + btnEliminar.ForeColor = Color.White; + btnEliminar.Click += new EventHandler(delegate (object sender, EventArgs e) + { + DialogResult result = MessageBox.Show($"¿Está seguro de que desea eliminar a {empleado.nombre}?", + "Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (result == DialogResult.Yes) + { + // Código para continuar aquí + } + }); + + + infoEmpleado.Controls.Add(imgEmpleado,0,0); + infoEmpleado.Controls.Add(nombreEmpleado,1,0); + + panelBotones.Controls.Add(btnVer,0,0); + panelBotones.Controls.Add(btnEditar,1,0); + panelBotones.Controls.Add(btnEliminar,2,0); + + empleadoLayout.Controls.Add(infoEmpleado,0,0); + empleadoLayout.Controls.Add(panelBotones,1,0); + personalPanel.Controls.Add(empleadoLayout); + } + } + private void label1_Click(object sender, EventArgs e) { @@ -30,52 +139,14 @@ namespace compabetov2 private void button6_Click(object sender, EventArgs e) { - Empleado empleado = new Empleado( - -1, - txtnombrepersonal.Text, - txtapellidopersonal.Text, - txtcallepersonal.Text, - dtpfechapersonal.Text, - cbestadopersonal.Text, - txtcoloniapersonal.Text, - txtcodigopersonal.Text, - txtnoextpersonal.Text, - txtnointpersonal.Text, - txtreferenciapersonal.Text, - dtpnacimientopersonal.Text, - txttelefonopersonal.Text - ); - - service.insertarEmpleado( empleado ); + } private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { } - private void llenarGrid() - { - List empleados = service.conseguirEmpleados(); - 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); - } - dataGridView1.Enabled = false; - } + private void personal_Load(object sender, EventArgs e) { @@ -84,71 +155,27 @@ namespace compabetov2 private void button7_Click(object sender, EventArgs e) { - btnEditar.Enabled = true; - btnEliminar.Enabled = true; - dataGridView1.Enabled = true; - btnAgregar.Enabled = false; + } private void button8_Click(object sender, EventArgs e) { - int fila = dataGridView1.CurrentCell.RowIndex; - int idEmpleado = int.Parse(dataGridView1.Rows[fila].Cells[0].Value.ToString()); - Empleado empleado = new Empleado(); - } + - private void dataGridView1_RowEnter(object sender, DataGridViewCellEventArgs e) - { - DataGridViewRow row = dataGridView1.Rows[e.RowIndex] as DataGridViewRow; - if(row.Cells[1].Value != null && row.Cells[0].Value != null) - { - - txtnombrepersonal.Text = row.Cells[1].Value.ToString(); - txtapellidopersonal.Text = row.Cells[2].Value.ToString(); - dtpfechapersonal.Text = row.Cells[3].Value.ToString(); - cbestadopersonal.Text = row.Cells[4].Value.ToString(); - txtcallepersonal.Text = row.Cells[5].Value.ToString(); - txtcoloniapersonal.Text = row.Cells[6].Value.ToString(); - txtcodigopersonal.Text = row.Cells[7].Value.ToString(); - txtnoextpersonal.Text = row.Cells[8].Value.ToString(); - txtnointpersonal.Text = row.Cells[9].Value.ToString(); - txtreferenciapersonal.Text = row.Cells[10].Value.ToString(); - dtpnacimientopersonal.Text = row.Cells[11].Value.ToString(); - txttelefonopersonal.Text = row.Cells[12].Value.ToString(); - } } - private void btnNuevo_Click(object sender, EventArgs e) + + + + private void lblhora_Click(object sender, EventArgs e) { - btnEditar.Enabled = false; - btnEliminar.Enabled = false; - btnAgregar.Enabled = true; - dataGridView1.Enabled = false; - limpiarCampos(); + } - private void limpiarCampos() + private void flowLayoutPanel3_Paint(object sender, PaintEventArgs e) { - txtnombrepersonal.Text = ""; - txtapellidopersonal.Text = ""; - dtpfechapersonal.Text = ""; - cbestadopersonal.Text = ""; - txtcallepersonal.Text = ""; - txtcoloniapersonal.Text = ""; - txtcodigopersonal.Text = ""; - txtnoextpersonal.Text = ""; - txtnointpersonal.Text = ""; - txtreferenciapersonal.Text = ""; - dtpnacimientopersonal.Text = ""; - txttelefonopersonal.Text = ""; - } - private void button1_Click(object sender, EventArgs e) - { - MenuPrincipal menuPrincipal = new MenuPrincipal(); - menuPrincipal.Show(); - this.Dispose(true); } } } diff --git a/personal.resx b/personal.resx index ef1e081..ef7bb43 100644 --- a/personal.resx +++ b/personal.resx @@ -117,49 +117,13 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - 197, 17 17, 17 + + 75 + \ No newline at end of file