diff --git a/.vs/compabetoOG/v17/.wsuo b/.vs/compabetoOG/v17/.wsuo index 9dabd35..d358306 100644 Binary files a/.vs/compabetoOG/v17/.wsuo and b/.vs/compabetoOG/v17/.wsuo differ diff --git a/AgregarEmpleado.Designer.cs b/AgregarEmpleado.Designer.cs index ea60936..3486d15 100644 --- a/AgregarEmpleado.Designer.cs +++ b/AgregarEmpleado.Designer.cs @@ -34,41 +34,44 @@ this.lbNombre = new System.Windows.Forms.Label(); this.txtNombre = new System.Windows.Forms.TextBox(); this.flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel(); - this.flowLayoutPanel4 = new System.Windows.Forms.FlowLayoutPanel(); - this.flowLayoutPanel5 = new System.Windows.Forms.FlowLayoutPanel(); - this.flowLayoutPanel6 = new System.Windows.Forms.FlowLayoutPanel(); - this.flowLayoutPanel7 = new System.Windows.Forms.FlowLayoutPanel(); - this.flowLayoutPanel8 = new System.Windows.Forms.FlowLayoutPanel(); - this.flowLayoutPanel9 = new System.Windows.Forms.FlowLayoutPanel(); - this.flowLayoutPanel10 = new System.Windows.Forms.FlowLayoutPanel(); - this.flowLayoutPanel11 = new System.Windows.Forms.FlowLayoutPanel(); - this.flowLayoutPanel12 = new System.Windows.Forms.FlowLayoutPanel(); - this.flowLayoutPanel13 = new System.Windows.Forms.FlowLayoutPanel(); this.lbApellidos = new System.Windows.Forms.Label(); this.txtApellido = new System.Windows.Forms.TextBox(); + this.flowLayoutPanel4 = new System.Windows.Forms.FlowLayoutPanel(); this.lbCalle = new System.Windows.Forms.Label(); this.txtCalle = new System.Windows.Forms.TextBox(); + this.flowLayoutPanel5 = new System.Windows.Forms.FlowLayoutPanel(); + this.lbCp = new System.Windows.Forms.Label(); + this.txtCp = new System.Windows.Forms.TextBox(); + this.flowLayoutPanel6 = new System.Windows.Forms.FlowLayoutPanel(); + this.label3 = new System.Windows.Forms.Label(); + this.txtNoInt = new System.Windows.Forms.TextBox(); + this.flowLayoutPanel7 = new System.Windows.Forms.FlowLayoutPanel(); + this.label5 = new System.Windows.Forms.Label(); + this.dtFechaNac = new System.Windows.Forms.DateTimePicker(); + this.flowLayoutPanel8 = new System.Windows.Forms.FlowLayoutPanel(); + this.label7 = new System.Windows.Forms.Label(); + this.txtTelefono = new System.Windows.Forms.TextBox(); + this.flowLayoutPanel9 = new System.Windows.Forms.FlowLayoutPanel(); this.lbColonia = new System.Windows.Forms.Label(); this.txtColonia = new System.Windows.Forms.TextBox(); + this.flowLayoutPanel10 = new System.Windows.Forms.FlowLayoutPanel(); + this.label2 = new System.Windows.Forms.Label(); + this.txtNoExt = new System.Windows.Forms.TextBox(); + this.flowLayoutPanel11 = new System.Windows.Forms.FlowLayoutPanel(); + this.label4 = new System.Windows.Forms.Label(); + this.txtReferencia = new System.Windows.Forms.TextBox(); + this.flowLayoutPanel12 = new System.Windows.Forms.FlowLayoutPanel(); + this.label6 = new System.Windows.Forms.Label(); + this.dtFechaCon = new System.Windows.Forms.DateTimePicker(); + this.flowLayoutPanel13 = new System.Windows.Forms.FlowLayoutPanel(); + this.label8 = new System.Windows.Forms.Label(); + this.cbEstado = new System.Windows.Forms.ComboBox(); this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); this.btnAgregar = new System.Windows.Forms.Button(); this.btnCancelar = new System.Windows.Forms.Button(); - this.lbCp = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - 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.txtCp = new System.Windows.Forms.TextBox(); - this.txtNoExt = new System.Windows.Forms.TextBox(); - this.txtNoInt = new System.Windows.Forms.TextBox(); - this.txtReferencia = new System.Windows.Forms.TextBox(); - this.txtTelefono = new System.Windows.Forms.TextBox(); - this.dtFechaCon = new System.Windows.Forms.DateTimePicker(); - this.dtFechaNac = new System.Windows.Forms.DateTimePicker(); - this.cbEstado = new System.Windows.Forms.ComboBox(); + this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel(); + this.button1 = new System.Windows.Forms.Button(); + this.lbImg = new System.Windows.Forms.Label(); this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel2.SuspendLayout(); this.flowLayoutPanel1.SuspendLayout(); @@ -84,6 +87,7 @@ this.flowLayoutPanel12.SuspendLayout(); this.flowLayoutPanel13.SuspendLayout(); this.tableLayoutPanel3.SuspendLayout(); + this.flowLayoutPanel2.SuspendLayout(); this.SuspendLayout(); // // tableLayoutPanel1 @@ -91,15 +95,17 @@ 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.tableLayoutPanel3, 0, 2); this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel3, 3, 1); + this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel2, 0, 1); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 2; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 84F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 16F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(800, 450); + this.tableLayoutPanel1.RowCount = 3; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 91.73913F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 8.26087F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 66F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(800, 564); this.tableLayoutPanel1.TabIndex = 0; // // tableLayoutPanel2 @@ -133,7 +139,7 @@ this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 63F)); this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 60F)); this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 55F)); - this.tableLayoutPanel2.Size = new System.Drawing.Size(794, 372); + this.tableLayoutPanel2.Size = new System.Drawing.Size(794, 450); this.tableLayoutPanel2.TabIndex = 0; // // flowLayoutPanel1 @@ -144,7 +150,7 @@ 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(391, 52); + this.flowLayoutPanel1.Size = new System.Drawing.Size(391, 89); this.flowLayoutPanel1.TabIndex = 0; // // lbNombre @@ -173,119 +179,9 @@ this.flowLayoutPanel3.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; this.flowLayoutPanel3.Location = new System.Drawing.Point(400, 3); this.flowLayoutPanel3.Name = "flowLayoutPanel3"; - this.flowLayoutPanel3.Size = new System.Drawing.Size(391, 52); + this.flowLayoutPanel3.Size = new System.Drawing.Size(391, 89); this.flowLayoutPanel3.TabIndex = 1; // - // flowLayoutPanel4 - // - this.flowLayoutPanel4.Controls.Add(this.lbCalle); - this.flowLayoutPanel4.Controls.Add(this.txtCalle); - this.flowLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Fill; - this.flowLayoutPanel4.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; - this.flowLayoutPanel4.Location = new System.Drawing.Point(3, 61); - this.flowLayoutPanel4.Name = "flowLayoutPanel4"; - this.flowLayoutPanel4.Size = new System.Drawing.Size(391, 58); - this.flowLayoutPanel4.TabIndex = 2; - // - // flowLayoutPanel5 - // - this.flowLayoutPanel5.Controls.Add(this.lbCp); - this.flowLayoutPanel5.Controls.Add(this.txtCp); - this.flowLayoutPanel5.Dock = System.Windows.Forms.DockStyle.Fill; - this.flowLayoutPanel5.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; - this.flowLayoutPanel5.Location = new System.Drawing.Point(3, 125); - this.flowLayoutPanel5.Name = "flowLayoutPanel5"; - this.flowLayoutPanel5.Size = new System.Drawing.Size(391, 65); - this.flowLayoutPanel5.TabIndex = 3; - // - // flowLayoutPanel6 - // - this.flowLayoutPanel6.Controls.Add(this.label3); - this.flowLayoutPanel6.Controls.Add(this.txtNoInt); - this.flowLayoutPanel6.Dock = System.Windows.Forms.DockStyle.Fill; - this.flowLayoutPanel6.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; - this.flowLayoutPanel6.Location = new System.Drawing.Point(3, 196); - this.flowLayoutPanel6.Name = "flowLayoutPanel6"; - this.flowLayoutPanel6.Size = new System.Drawing.Size(391, 57); - this.flowLayoutPanel6.TabIndex = 4; - // - // flowLayoutPanel7 - // - this.flowLayoutPanel7.Controls.Add(this.label5); - this.flowLayoutPanel7.Controls.Add(this.dtFechaNac); - this.flowLayoutPanel7.Dock = System.Windows.Forms.DockStyle.Fill; - this.flowLayoutPanel7.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; - this.flowLayoutPanel7.Location = new System.Drawing.Point(3, 259); - this.flowLayoutPanel7.Name = "flowLayoutPanel7"; - this.flowLayoutPanel7.Size = new System.Drawing.Size(391, 54); - this.flowLayoutPanel7.TabIndex = 5; - // - // flowLayoutPanel8 - // - this.flowLayoutPanel8.Controls.Add(this.label7); - this.flowLayoutPanel8.Controls.Add(this.txtTelefono); - this.flowLayoutPanel8.Dock = System.Windows.Forms.DockStyle.Fill; - this.flowLayoutPanel8.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; - this.flowLayoutPanel8.Location = new System.Drawing.Point(3, 319); - this.flowLayoutPanel8.Name = "flowLayoutPanel8"; - this.flowLayoutPanel8.Size = new System.Drawing.Size(391, 50); - this.flowLayoutPanel8.TabIndex = 6; - // - // flowLayoutPanel9 - // - this.flowLayoutPanel9.Controls.Add(this.lbColonia); - this.flowLayoutPanel9.Controls.Add(this.txtColonia); - this.flowLayoutPanel9.Dock = System.Windows.Forms.DockStyle.Fill; - this.flowLayoutPanel9.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; - this.flowLayoutPanel9.Location = new System.Drawing.Point(400, 61); - this.flowLayoutPanel9.Name = "flowLayoutPanel9"; - this.flowLayoutPanel9.Size = new System.Drawing.Size(391, 58); - this.flowLayoutPanel9.TabIndex = 7; - // - // flowLayoutPanel10 - // - this.flowLayoutPanel10.Controls.Add(this.label2); - this.flowLayoutPanel10.Controls.Add(this.txtNoExt); - this.flowLayoutPanel10.Dock = System.Windows.Forms.DockStyle.Fill; - this.flowLayoutPanel10.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; - this.flowLayoutPanel10.Location = new System.Drawing.Point(400, 125); - this.flowLayoutPanel10.Name = "flowLayoutPanel10"; - this.flowLayoutPanel10.Size = new System.Drawing.Size(391, 65); - this.flowLayoutPanel10.TabIndex = 8; - // - // flowLayoutPanel11 - // - this.flowLayoutPanel11.Controls.Add(this.label4); - this.flowLayoutPanel11.Controls.Add(this.txtReferencia); - this.flowLayoutPanel11.Dock = System.Windows.Forms.DockStyle.Fill; - this.flowLayoutPanel11.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; - this.flowLayoutPanel11.Location = new System.Drawing.Point(400, 196); - this.flowLayoutPanel11.Name = "flowLayoutPanel11"; - this.flowLayoutPanel11.Size = new System.Drawing.Size(391, 57); - this.flowLayoutPanel11.TabIndex = 9; - // - // flowLayoutPanel12 - // - this.flowLayoutPanel12.Controls.Add(this.label6); - this.flowLayoutPanel12.Controls.Add(this.dtFechaCon); - this.flowLayoutPanel12.Dock = System.Windows.Forms.DockStyle.Fill; - this.flowLayoutPanel12.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; - this.flowLayoutPanel12.Location = new System.Drawing.Point(400, 259); - this.flowLayoutPanel12.Name = "flowLayoutPanel12"; - this.flowLayoutPanel12.Size = new System.Drawing.Size(391, 54); - this.flowLayoutPanel12.TabIndex = 10; - // - // flowLayoutPanel13 - // - this.flowLayoutPanel13.Controls.Add(this.label8); - this.flowLayoutPanel13.Controls.Add(this.cbEstado); - this.flowLayoutPanel13.Dock = System.Windows.Forms.DockStyle.Fill; - this.flowLayoutPanel13.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; - this.flowLayoutPanel13.Location = new System.Drawing.Point(400, 319); - this.flowLayoutPanel13.Name = "flowLayoutPanel13"; - this.flowLayoutPanel13.Size = new System.Drawing.Size(391, 50); - this.flowLayoutPanel13.TabIndex = 11; - // // lbApellidos // this.lbApellidos.AutoSize = true; @@ -306,6 +202,17 @@ this.txtApellido.Size = new System.Drawing.Size(388, 26); this.txtApellido.TabIndex = 1; // + // flowLayoutPanel4 + // + this.flowLayoutPanel4.Controls.Add(this.lbCalle); + this.flowLayoutPanel4.Controls.Add(this.txtCalle); + this.flowLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel4.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this.flowLayoutPanel4.Location = new System.Drawing.Point(3, 98); + this.flowLayoutPanel4.Name = "flowLayoutPanel4"; + this.flowLayoutPanel4.Size = new System.Drawing.Size(391, 99); + this.flowLayoutPanel4.TabIndex = 2; + // // lbCalle // this.lbCalle.AutoSize = true; @@ -325,6 +232,138 @@ this.txtCalle.Size = new System.Drawing.Size(388, 26); this.txtCalle.TabIndex = 1; // + // flowLayoutPanel5 + // + this.flowLayoutPanel5.Controls.Add(this.lbCp); + this.flowLayoutPanel5.Controls.Add(this.txtCp); + this.flowLayoutPanel5.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel5.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this.flowLayoutPanel5.Location = new System.Drawing.Point(3, 203); + this.flowLayoutPanel5.Name = "flowLayoutPanel5"; + this.flowLayoutPanel5.Size = new System.Drawing.Size(391, 65); + this.flowLayoutPanel5.TabIndex = 3; + // + // lbCp + // + this.lbCp.AutoSize = true; + this.lbCp.Dock = System.Windows.Forms.DockStyle.Top; + this.lbCp.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbCp.Location = new System.Drawing.Point(3, 0); + this.lbCp.Name = "lbCp"; + this.lbCp.Size = new System.Drawing.Size(388, 20); + this.lbCp.TabIndex = 0; + this.lbCp.Text = "Codigo postal:"; + // + // txtCp + // + this.txtCp.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.txtCp.Location = new System.Drawing.Point(3, 23); + this.txtCp.Name = "txtCp"; + this.txtCp.Size = new System.Drawing.Size(388, 26); + this.txtCp.TabIndex = 1; + // + // flowLayoutPanel6 + // + this.flowLayoutPanel6.Controls.Add(this.label3); + this.flowLayoutPanel6.Controls.Add(this.txtNoInt); + this.flowLayoutPanel6.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel6.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this.flowLayoutPanel6.Location = new System.Drawing.Point(3, 274); + this.flowLayoutPanel6.Name = "flowLayoutPanel6"; + this.flowLayoutPanel6.Size = new System.Drawing.Size(391, 57); + this.flowLayoutPanel6.TabIndex = 4; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Dock = System.Windows.Forms.DockStyle.Top; + this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label3.Location = new System.Drawing.Point(3, 0); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(388, 20); + this.label3.TabIndex = 0; + this.label3.Text = "Numero Interior:"; + // + // txtNoInt + // + this.txtNoInt.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.txtNoInt.Location = new System.Drawing.Point(3, 23); + this.txtNoInt.Name = "txtNoInt"; + this.txtNoInt.Size = new System.Drawing.Size(388, 26); + this.txtNoInt.TabIndex = 1; + // + // flowLayoutPanel7 + // + this.flowLayoutPanel7.Controls.Add(this.label5); + this.flowLayoutPanel7.Controls.Add(this.dtFechaNac); + this.flowLayoutPanel7.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel7.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this.flowLayoutPanel7.Location = new System.Drawing.Point(3, 337); + this.flowLayoutPanel7.Name = "flowLayoutPanel7"; + this.flowLayoutPanel7.Size = new System.Drawing.Size(391, 54); + this.flowLayoutPanel7.TabIndex = 5; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Dock = System.Windows.Forms.DockStyle.Top; + this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label5.Location = new System.Drawing.Point(3, 0); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(388, 20); + this.label5.TabIndex = 0; + this.label5.Text = "Fecha de nacimiento:"; + // + // dtFechaNac + // + this.dtFechaNac.CalendarFont = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.dtFechaNac.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.dtFechaNac.Location = new System.Drawing.Point(3, 23); + this.dtFechaNac.Name = "dtFechaNac"; + this.dtFechaNac.Size = new System.Drawing.Size(388, 26); + this.dtFechaNac.TabIndex = 1; + // + // flowLayoutPanel8 + // + this.flowLayoutPanel8.Controls.Add(this.label7); + this.flowLayoutPanel8.Controls.Add(this.txtTelefono); + this.flowLayoutPanel8.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel8.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this.flowLayoutPanel8.Location = new System.Drawing.Point(3, 397); + this.flowLayoutPanel8.Name = "flowLayoutPanel8"; + this.flowLayoutPanel8.Size = new System.Drawing.Size(391, 50); + this.flowLayoutPanel8.TabIndex = 6; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Dock = System.Windows.Forms.DockStyle.Top; + this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label7.Location = new System.Drawing.Point(3, 0); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(388, 20); + this.label7.TabIndex = 0; + this.label7.Text = "Telefono:"; + // + // txtTelefono + // + this.txtTelefono.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.txtTelefono.Location = new System.Drawing.Point(3, 23); + this.txtTelefono.Name = "txtTelefono"; + this.txtTelefono.Size = new System.Drawing.Size(388, 24); + this.txtTelefono.TabIndex = 1; + // + // flowLayoutPanel9 + // + this.flowLayoutPanel9.Controls.Add(this.lbColonia); + this.flowLayoutPanel9.Controls.Add(this.txtColonia); + this.flowLayoutPanel9.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel9.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this.flowLayoutPanel9.Location = new System.Drawing.Point(400, 98); + this.flowLayoutPanel9.Name = "flowLayoutPanel9"; + this.flowLayoutPanel9.Size = new System.Drawing.Size(391, 99); + this.flowLayoutPanel9.TabIndex = 7; + // // lbColonia // this.lbColonia.AutoSize = true; @@ -344,56 +383,16 @@ this.txtColonia.Size = new System.Drawing.Size(388, 26); this.txtColonia.TabIndex = 1; // - // tableLayoutPanel3 + // flowLayoutPanel10 // - this.tableLayoutPanel3.ColumnCount = 3; - this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 84.94152F)); - this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 15.05848F)); - this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 109F)); - this.tableLayoutPanel3.Controls.Add(this.btnAgregar, 1, 0); - this.tableLayoutPanel3.Controls.Add(this.btnCancelar, 2, 0); - this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel3.Location = new System.Drawing.Point(3, 381); - this.tableLayoutPanel3.Name = "tableLayoutPanel3"; - this.tableLayoutPanel3.RowCount = 1; - this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel3.Size = new System.Drawing.Size(794, 66); - this.tableLayoutPanel3.TabIndex = 1; - // - // btnAgregar - // - this.btnAgregar.Dock = System.Windows.Forms.DockStyle.Fill; - this.btnAgregar.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnAgregar.Location = new System.Drawing.Point(584, 3); - this.btnAgregar.Name = "btnAgregar"; - this.btnAgregar.Size = new System.Drawing.Size(97, 60); - this.btnAgregar.TabIndex = 0; - this.btnAgregar.Text = "Agregar"; - this.btnAgregar.UseVisualStyleBackColor = true; - this.btnAgregar.Click += new System.EventHandler(this.btnAgregar_Click); - // - // btnCancelar - // - this.btnCancelar.Dock = System.Windows.Forms.DockStyle.Fill; - this.btnCancelar.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnCancelar.Location = new System.Drawing.Point(687, 3); - this.btnCancelar.Name = "btnCancelar"; - this.btnCancelar.Size = new System.Drawing.Size(104, 60); - this.btnCancelar.TabIndex = 1; - this.btnCancelar.Text = "Cancelar"; - this.btnCancelar.UseVisualStyleBackColor = true; - // - // lbCp - // - this.lbCp.AutoSize = true; - this.lbCp.Dock = System.Windows.Forms.DockStyle.Top; - this.lbCp.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lbCp.Location = new System.Drawing.Point(3, 0); - this.lbCp.Name = "lbCp"; - this.lbCp.Size = new System.Drawing.Size(388, 20); - this.lbCp.TabIndex = 0; - this.lbCp.Text = "Codigo postal:"; + this.flowLayoutPanel10.Controls.Add(this.label2); + this.flowLayoutPanel10.Controls.Add(this.txtNoExt); + this.flowLayoutPanel10.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel10.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this.flowLayoutPanel10.Location = new System.Drawing.Point(400, 203); + this.flowLayoutPanel10.Name = "flowLayoutPanel10"; + this.flowLayoutPanel10.Size = new System.Drawing.Size(391, 65); + this.flowLayoutPanel10.TabIndex = 8; // // label2 // @@ -406,16 +405,24 @@ this.label2.TabIndex = 0; this.label2.Text = "Numero Exterior:"; // - // label3 + // txtNoExt // - this.label3.AutoSize = true; - this.label3.Dock = System.Windows.Forms.DockStyle.Top; - this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label3.Location = new System.Drawing.Point(3, 0); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(388, 20); - this.label3.TabIndex = 0; - this.label3.Text = "Numero Interior:"; + this.txtNoExt.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.txtNoExt.Location = new System.Drawing.Point(3, 23); + this.txtNoExt.Name = "txtNoExt"; + this.txtNoExt.Size = new System.Drawing.Size(388, 26); + this.txtNoExt.TabIndex = 1; + // + // flowLayoutPanel11 + // + this.flowLayoutPanel11.Controls.Add(this.label4); + this.flowLayoutPanel11.Controls.Add(this.txtReferencia); + this.flowLayoutPanel11.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel11.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this.flowLayoutPanel11.Location = new System.Drawing.Point(400, 274); + this.flowLayoutPanel11.Name = "flowLayoutPanel11"; + this.flowLayoutPanel11.Size = new System.Drawing.Size(391, 57); + this.flowLayoutPanel11.TabIndex = 9; // // label4 // @@ -428,16 +435,24 @@ this.label4.TabIndex = 0; this.label4.Text = "Referencia:"; // - // label5 + // txtReferencia // - this.label5.AutoSize = true; - this.label5.Dock = System.Windows.Forms.DockStyle.Top; - this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label5.Location = new System.Drawing.Point(3, 0); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(388, 20); - this.label5.TabIndex = 0; - this.label5.Text = "Fecha de nacimiento:"; + this.txtReferencia.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.txtReferencia.Location = new System.Drawing.Point(3, 23); + this.txtReferencia.Name = "txtReferencia"; + this.txtReferencia.Size = new System.Drawing.Size(388, 26); + this.txtReferencia.TabIndex = 1; + // + // flowLayoutPanel12 + // + this.flowLayoutPanel12.Controls.Add(this.label6); + this.flowLayoutPanel12.Controls.Add(this.dtFechaCon); + this.flowLayoutPanel12.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel12.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this.flowLayoutPanel12.Location = new System.Drawing.Point(400, 337); + this.flowLayoutPanel12.Name = "flowLayoutPanel12"; + this.flowLayoutPanel12.Size = new System.Drawing.Size(391, 54); + this.flowLayoutPanel12.TabIndex = 10; // // label6 // @@ -450,16 +465,24 @@ this.label6.TabIndex = 0; this.label6.Text = "Fecha de contratacion:"; // - // label7 + // dtFechaCon // - this.label7.AutoSize = true; - this.label7.Dock = System.Windows.Forms.DockStyle.Top; - this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label7.Location = new System.Drawing.Point(3, 0); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(388, 20); - this.label7.TabIndex = 0; - this.label7.Text = "Telefono:"; + this.dtFechaCon.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.dtFechaCon.Location = new System.Drawing.Point(3, 23); + this.dtFechaCon.Name = "dtFechaCon"; + this.dtFechaCon.Size = new System.Drawing.Size(388, 26); + this.dtFechaCon.TabIndex = 1; + // + // flowLayoutPanel13 + // + this.flowLayoutPanel13.Controls.Add(this.label8); + this.flowLayoutPanel13.Controls.Add(this.cbEstado); + this.flowLayoutPanel13.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel13.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this.flowLayoutPanel13.Location = new System.Drawing.Point(400, 397); + this.flowLayoutPanel13.Name = "flowLayoutPanel13"; + this.flowLayoutPanel13.Size = new System.Drawing.Size(391, 50); + this.flowLayoutPanel13.TabIndex = 11; // // label8 // @@ -472,63 +495,6 @@ this.label8.TabIndex = 0; this.label8.Text = "Estado:"; // - // txtCp - // - this.txtCp.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtCp.Location = new System.Drawing.Point(3, 23); - this.txtCp.Name = "txtCp"; - this.txtCp.Size = new System.Drawing.Size(388, 26); - this.txtCp.TabIndex = 1; - // - // txtNoExt - // - this.txtNoExt.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtNoExt.Location = new System.Drawing.Point(3, 23); - this.txtNoExt.Name = "txtNoExt"; - this.txtNoExt.Size = new System.Drawing.Size(388, 26); - this.txtNoExt.TabIndex = 1; - // - // txtNoInt - // - this.txtNoInt.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtNoInt.Location = new System.Drawing.Point(3, 23); - this.txtNoInt.Name = "txtNoInt"; - this.txtNoInt.Size = new System.Drawing.Size(388, 26); - this.txtNoInt.TabIndex = 1; - // - // txtReferencia - // - this.txtReferencia.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtReferencia.Location = new System.Drawing.Point(3, 23); - this.txtReferencia.Name = "txtReferencia"; - this.txtReferencia.Size = new System.Drawing.Size(388, 26); - this.txtReferencia.TabIndex = 1; - // - // txtTelefono - // - this.txtTelefono.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtTelefono.Location = new System.Drawing.Point(3, 23); - this.txtTelefono.Name = "txtTelefono"; - this.txtTelefono.Size = new System.Drawing.Size(388, 24); - this.txtTelefono.TabIndex = 1; - // - // dtFechaCon - // - this.dtFechaCon.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.dtFechaCon.Location = new System.Drawing.Point(3, 23); - this.dtFechaCon.Name = "dtFechaCon"; - this.dtFechaCon.Size = new System.Drawing.Size(388, 26); - this.dtFechaCon.TabIndex = 1; - // - // dtFechaNac - // - this.dtFechaNac.CalendarFont = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.dtFechaNac.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.dtFechaNac.Location = new System.Drawing.Point(3, 23); - this.dtFechaNac.Name = "dtFechaNac"; - this.dtFechaNac.Size = new System.Drawing.Size(388, 26); - this.dtFechaNac.TabIndex = 1; - // // cbEstado // this.cbEstado.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); @@ -542,16 +508,94 @@ this.cbEstado.TabIndex = 1; this.cbEstado.Text = "Activo"; // + // tableLayoutPanel3 + // + this.tableLayoutPanel3.ColumnCount = 3; + this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 84.94152F)); + this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 15.05848F)); + this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 109F)); + this.tableLayoutPanel3.Controls.Add(this.btnAgregar, 1, 0); + this.tableLayoutPanel3.Controls.Add(this.btnCancelar, 2, 0); + this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel3.Location = new System.Drawing.Point(3, 500); + this.tableLayoutPanel3.Name = "tableLayoutPanel3"; + this.tableLayoutPanel3.RowCount = 1; + this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel3.Size = new System.Drawing.Size(794, 61); + this.tableLayoutPanel3.TabIndex = 2; + // + // btnAgregar + // + this.btnAgregar.Dock = System.Windows.Forms.DockStyle.Fill; + this.btnAgregar.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnAgregar.Location = new System.Drawing.Point(584, 3); + this.btnAgregar.Name = "btnAgregar"; + this.btnAgregar.Size = new System.Drawing.Size(97, 55); + this.btnAgregar.TabIndex = 0; + this.btnAgregar.Text = "Agregar"; + this.btnAgregar.UseVisualStyleBackColor = true; + this.btnAgregar.Click += new System.EventHandler(this.btnAgregar_Click_1); + // + // btnCancelar + // + this.btnCancelar.Dock = System.Windows.Forms.DockStyle.Fill; + this.btnCancelar.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnCancelar.Location = new System.Drawing.Point(687, 3); + this.btnCancelar.Name = "btnCancelar"; + this.btnCancelar.Size = new System.Drawing.Size(104, 55); + this.btnCancelar.TabIndex = 1; + this.btnCancelar.Text = "Cancelar"; + this.btnCancelar.UseVisualStyleBackColor = true; + // + // flowLayoutPanel2 + // + this.flowLayoutPanel2.AutoSize = true; + this.flowLayoutPanel2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.flowLayoutPanel2.Controls.Add(this.button1); + this.flowLayoutPanel2.Controls.Add(this.lbImg); + this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel2.Location = new System.Drawing.Point(3, 459); + this.flowLayoutPanel2.Name = "flowLayoutPanel2"; + this.flowLayoutPanel2.Size = new System.Drawing.Size(794, 35); + this.flowLayoutPanel2.TabIndex = 3; + this.flowLayoutPanel2.Paint += new System.Windows.Forms.PaintEventHandler(this.flowLayoutPanel2_Paint_1); + // + // button1 + // + this.button1.Dock = System.Windows.Forms.DockStyle.Top; + this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.button1.Location = new System.Drawing.Point(3, 3); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(150, 32); + this.button1.TabIndex = 0; + this.button1.Text = "Seleccionar Imagen"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // lbImg + // + this.lbImg.AutoSize = true; + this.lbImg.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbImg.Location = new System.Drawing.Point(159, 0); + this.lbImg.Name = "lbImg"; + this.lbImg.Padding = new System.Windows.Forms.Padding(0, 10, 0, 0); + this.lbImg.Size = new System.Drawing.Size(55, 26); + this.lbImg.TabIndex = 1; + this.lbImg.Text = "Imagen:"; + this.lbImg.Click += new System.EventHandler(this.label1_Click_1); + // // AgregarEmpleado // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); + this.ClientSize = new System.Drawing.Size(800, 564); this.Controls.Add(this.tableLayoutPanel1); this.Name = "AgregarEmpleado"; this.Text = "Agregar Empleado"; this.Load += new System.EventHandler(this.AgregarEmpleado_Load); this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); this.tableLayoutPanel2.ResumeLayout(false); this.flowLayoutPanel1.ResumeLayout(false); this.flowLayoutPanel1.PerformLayout(); @@ -578,6 +622,8 @@ this.flowLayoutPanel13.ResumeLayout(false); this.flowLayoutPanel13.PerformLayout(); this.tableLayoutPanel3.ResumeLayout(false); + this.flowLayoutPanel2.ResumeLayout(false); + this.flowLayoutPanel2.PerformLayout(); this.ResumeLayout(false); } @@ -606,9 +652,6 @@ private System.Windows.Forms.TextBox txtCalle; private System.Windows.Forms.Label lbColonia; private System.Windows.Forms.TextBox txtColonia; - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3; - private System.Windows.Forms.Button btnAgregar; - private System.Windows.Forms.Button btnCancelar; private System.Windows.Forms.Label lbCp; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label5; @@ -625,5 +668,11 @@ private System.Windows.Forms.TextBox txtReferencia; private System.Windows.Forms.DateTimePicker dtFechaCon; private System.Windows.Forms.ComboBox cbEstado; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3; + private System.Windows.Forms.Button btnAgregar; + private System.Windows.Forms.Button btnCancelar; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Label lbImg; } } \ No newline at end of file diff --git a/AgregarEmpleado.cs b/AgregarEmpleado.cs index 32c9f06..7c05ad6 100644 --- a/AgregarEmpleado.cs +++ b/AgregarEmpleado.cs @@ -5,7 +5,9 @@ using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; +using System.IO; using System.Linq; +using System.Net.NetworkInformation; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; @@ -15,6 +17,7 @@ namespace compabetov2 public partial class AgregarEmpleado : Form { private personal ventanaPersonal; + private string imagenPath = ""; public AgregarEmpleado(personal ventanaPersonal) { InitializeComponent(); @@ -60,5 +63,68 @@ namespace compabetov2 { } + + private void flowLayoutPanel2_Paint_1(object sender, PaintEventArgs e) + { + + } + + private void openFileDialog1_FileOk(object sender, CancelEventArgs e) + { + + } + + private void button1_Click(object sender, EventArgs e) + { + OpenFileDialog openFileDialog1 = new OpenFileDialog(); + + openFileDialog1.Filter = "Archivos de imagen (*.jpg, *.jpeg, *.png, *.bmp)|*.jpg;*.jpeg;*.png;*.bmp"; + openFileDialog1.Title = "Seleccionar imagen"; + + if (openFileDialog1.ShowDialog() == DialogResult.OK) + { + imagenPath = openFileDialog1.FileName; + lbImg.Text = $"Imagen: {Path.GetFileName(imagenPath)}"; + string destinationFolder = Path.Combine(Application.StartupPath, "Resources", "usuarios"); + //string destinationFile = Path.Combine(destinationFolder, Path.GetFileName(sourceFile)); + //File.Copy(sourceFile, destinationFile, true); + } + } + + private void label1_Click_1(object sender, EventArgs e) + { + + } + + private void btnAgregar_Click_1(object sender, EventArgs e) + { + string nombre = txtNombre.Text; + string apellidos = txtApellido.Text; + string calle = txtCalle.Text; + string fechaCon = dtFechaCon.Text; + string estado = cbEstado.Text; + string colonia = txtColonia.Text; + string cp = txtCp.Text; + string noExt = txtNoExt.Text; + string noInt = txtNoInt.Text; + string referencia = txtReferencia.Text; + string fechaNac = dtFechaNac.Text; + string telefono = txtTelefono.Text; + + Empleado empleado = new Empleado(-1, nombre, apellidos, calle, fechaCon, estado, colonia + , cp, noExt, noInt, referencia, fechaNac, telefono, Path.GetFileName(imagenPath)); + + if (service.insertarEmpleado(empleado)) + { + if (!imagenPath.Equals("")) { + string destinationFolder = Path.Combine(Application.StartupPath, "Resources", "usuarios"); + string destinationFile = Path.Combine(destinationFolder, Path.GetFileName(imagenPath)); + File.Copy(imagenPath, destinationFile, true); + } + + ventanaPersonal.llenarPanel(); + Close(); + } + } } } diff --git a/AgregarLogin.cs b/AgregarLogin.cs index 9a15314..0e8a5ef 100644 --- a/AgregarLogin.cs +++ b/AgregarLogin.cs @@ -37,12 +37,19 @@ namespace compabetov2 string tipo = cbTipo.Text; string nombre = txtNombre.Text; LoginModel loginModel = new LoginModel(nombre,contra,tipo, idEmpleado); - if (service.crearLogin(loginModel)) + if (service.verificarExistenciaLogin(loginModel)) { - MessageBox.Show("Login creado"); - ventanaPadre.llenarPanel(); - Close(); + if (service.crearLogin(loginModel,idEmpleado)) + { + ventanaPadre.llenarPanel(); + Close(); + } } + else + { + MessageBox.Show("El nombre de usuario ya existe","Error", MessageBoxButtons.OK,MessageBoxIcon.Error); + } + } else diff --git a/EditarEmpleado.Designer.cs b/EditarEmpleado.Designer.cs index e132c68..b1f2fd1 100644 --- a/EditarEmpleado.Designer.cs +++ b/EditarEmpleado.Designer.cs @@ -72,6 +72,9 @@ namespace compabetov2 this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); this.button1 = new System.Windows.Forms.Button(); this.btnCancelar = new System.Windows.Forms.Button(); + this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel(); + this.btnImg = new System.Windows.Forms.Button(); + this.lbImg = new System.Windows.Forms.Label(); this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel2.SuspendLayout(); this.flowLayoutPanel1.SuspendLayout(); @@ -87,6 +90,7 @@ namespace compabetov2 this.flowLayoutPanel12.SuspendLayout(); this.flowLayoutPanel13.SuspendLayout(); this.tableLayoutPanel3.SuspendLayout(); + this.flowLayoutPanel2.SuspendLayout(); this.SuspendLayout(); // // tableLayoutPanel1 @@ -94,15 +98,17 @@ namespace compabetov2 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.tableLayoutPanel3, 0, 2); this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel3, 3, 1); + this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel2, 0, 1); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 2; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 85.11111F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 14.88889F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(800, 460); + this.tableLayoutPanel1.RowCount = 3; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 89.64646F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10.35354F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 70F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(800, 508); this.tableLayoutPanel1.TabIndex = 0; this.tableLayoutPanel1.Paint += new System.Windows.Forms.PaintEventHandler(this.tableLayoutPanel1_Paint); // @@ -137,7 +143,7 @@ namespace compabetov2 this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 63F)); this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 60F)); this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 55F)); - this.tableLayoutPanel2.Size = new System.Drawing.Size(794, 385); + this.tableLayoutPanel2.Size = new System.Drawing.Size(794, 386); this.tableLayoutPanel2.TabIndex = 1; // // flowLayoutPanel1 @@ -207,7 +213,7 @@ namespace compabetov2 this.flowLayoutPanel4.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; this.flowLayoutPanel4.Location = new System.Drawing.Point(3, 67); this.flowLayoutPanel4.Name = "flowLayoutPanel4"; - this.flowLayoutPanel4.Size = new System.Drawing.Size(391, 65); + this.flowLayoutPanel4.Size = new System.Drawing.Size(391, 66); this.flowLayoutPanel4.TabIndex = 2; // // lbCalle @@ -235,7 +241,7 @@ namespace compabetov2 this.flowLayoutPanel5.Controls.Add(this.txtCp); this.flowLayoutPanel5.Dock = System.Windows.Forms.DockStyle.Fill; this.flowLayoutPanel5.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; - this.flowLayoutPanel5.Location = new System.Drawing.Point(3, 138); + this.flowLayoutPanel5.Location = new System.Drawing.Point(3, 139); this.flowLayoutPanel5.Name = "flowLayoutPanel5"; this.flowLayoutPanel5.Size = new System.Drawing.Size(391, 65); this.flowLayoutPanel5.TabIndex = 3; @@ -265,7 +271,7 @@ namespace compabetov2 this.flowLayoutPanel6.Controls.Add(this.txtNoInt); this.flowLayoutPanel6.Dock = System.Windows.Forms.DockStyle.Fill; this.flowLayoutPanel6.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; - this.flowLayoutPanel6.Location = new System.Drawing.Point(3, 209); + this.flowLayoutPanel6.Location = new System.Drawing.Point(3, 210); this.flowLayoutPanel6.Name = "flowLayoutPanel6"; this.flowLayoutPanel6.Size = new System.Drawing.Size(391, 57); this.flowLayoutPanel6.TabIndex = 4; @@ -295,7 +301,7 @@ namespace compabetov2 this.flowLayoutPanel7.Controls.Add(this.dtFechaNac); this.flowLayoutPanel7.Dock = System.Windows.Forms.DockStyle.Fill; this.flowLayoutPanel7.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; - this.flowLayoutPanel7.Location = new System.Drawing.Point(3, 272); + this.flowLayoutPanel7.Location = new System.Drawing.Point(3, 273); this.flowLayoutPanel7.Name = "flowLayoutPanel7"; this.flowLayoutPanel7.Size = new System.Drawing.Size(391, 54); this.flowLayoutPanel7.TabIndex = 5; @@ -326,7 +332,7 @@ namespace compabetov2 this.flowLayoutPanel8.Controls.Add(this.txtTelefono); this.flowLayoutPanel8.Dock = System.Windows.Forms.DockStyle.Fill; this.flowLayoutPanel8.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; - this.flowLayoutPanel8.Location = new System.Drawing.Point(3, 332); + this.flowLayoutPanel8.Location = new System.Drawing.Point(3, 333); this.flowLayoutPanel8.Name = "flowLayoutPanel8"; this.flowLayoutPanel8.Size = new System.Drawing.Size(391, 50); this.flowLayoutPanel8.TabIndex = 6; @@ -358,7 +364,7 @@ namespace compabetov2 this.flowLayoutPanel9.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; this.flowLayoutPanel9.Location = new System.Drawing.Point(400, 67); this.flowLayoutPanel9.Name = "flowLayoutPanel9"; - this.flowLayoutPanel9.Size = new System.Drawing.Size(391, 65); + this.flowLayoutPanel9.Size = new System.Drawing.Size(391, 66); this.flowLayoutPanel9.TabIndex = 7; // // lbColonia @@ -386,7 +392,7 @@ namespace compabetov2 this.flowLayoutPanel10.Controls.Add(this.txtNoExt); this.flowLayoutPanel10.Dock = System.Windows.Forms.DockStyle.Fill; this.flowLayoutPanel10.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; - this.flowLayoutPanel10.Location = new System.Drawing.Point(400, 138); + this.flowLayoutPanel10.Location = new System.Drawing.Point(400, 139); this.flowLayoutPanel10.Name = "flowLayoutPanel10"; this.flowLayoutPanel10.Size = new System.Drawing.Size(391, 65); this.flowLayoutPanel10.TabIndex = 8; @@ -416,7 +422,7 @@ namespace compabetov2 this.flowLayoutPanel11.Controls.Add(this.txtReferencia); this.flowLayoutPanel11.Dock = System.Windows.Forms.DockStyle.Fill; this.flowLayoutPanel11.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; - this.flowLayoutPanel11.Location = new System.Drawing.Point(400, 209); + this.flowLayoutPanel11.Location = new System.Drawing.Point(400, 210); this.flowLayoutPanel11.Name = "flowLayoutPanel11"; this.flowLayoutPanel11.Size = new System.Drawing.Size(391, 57); this.flowLayoutPanel11.TabIndex = 9; @@ -446,7 +452,7 @@ namespace compabetov2 this.flowLayoutPanel12.Controls.Add(this.dtFechaCon); this.flowLayoutPanel12.Dock = System.Windows.Forms.DockStyle.Fill; this.flowLayoutPanel12.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; - this.flowLayoutPanel12.Location = new System.Drawing.Point(400, 272); + this.flowLayoutPanel12.Location = new System.Drawing.Point(400, 273); this.flowLayoutPanel12.Name = "flowLayoutPanel12"; this.flowLayoutPanel12.Size = new System.Drawing.Size(391, 54); this.flowLayoutPanel12.TabIndex = 10; @@ -476,7 +482,7 @@ namespace compabetov2 this.flowLayoutPanel13.Controls.Add(this.cbEstado); this.flowLayoutPanel13.Dock = System.Windows.Forms.DockStyle.Fill; this.flowLayoutPanel13.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; - this.flowLayoutPanel13.Location = new System.Drawing.Point(400, 332); + this.flowLayoutPanel13.Location = new System.Drawing.Point(400, 333); this.flowLayoutPanel13.Name = "flowLayoutPanel13"; this.flowLayoutPanel13.Size = new System.Drawing.Size(391, 50); this.flowLayoutPanel13.TabIndex = 11; @@ -514,13 +520,13 @@ namespace compabetov2 this.tableLayoutPanel3.Controls.Add(this.button1, 1, 0); this.tableLayoutPanel3.Controls.Add(this.btnCancelar, 2, 0); this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel3.Location = new System.Drawing.Point(3, 394); + this.tableLayoutPanel3.Location = new System.Drawing.Point(3, 440); this.tableLayoutPanel3.Name = "tableLayoutPanel3"; this.tableLayoutPanel3.RowCount = 1; this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel3.Size = new System.Drawing.Size(794, 63); - this.tableLayoutPanel3.TabIndex = 2; + this.tableLayoutPanel3.Size = new System.Drawing.Size(794, 65); + this.tableLayoutPanel3.TabIndex = 3; // // button1 // @@ -528,11 +534,11 @@ namespace compabetov2 this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.button1.Location = new System.Drawing.Point(576, 3); this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(104, 57); + this.button1.Size = new System.Drawing.Size(104, 59); this.button1.TabIndex = 0; this.button1.Text = "Editar"; this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); + this.button1.Click += new System.EventHandler(this.button1_Click_1); // // btnCancelar // @@ -540,17 +546,49 @@ namespace compabetov2 this.btnCancelar.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btnCancelar.Location = new System.Drawing.Point(686, 3); this.btnCancelar.Name = "btnCancelar"; - this.btnCancelar.Size = new System.Drawing.Size(105, 57); + this.btnCancelar.Size = new System.Drawing.Size(105, 59); this.btnCancelar.TabIndex = 1; this.btnCancelar.Text = "Cancelar"; this.btnCancelar.UseVisualStyleBackColor = true; - this.btnCancelar.Click += new System.EventHandler(this.btnCancelar_Click); + this.btnCancelar.Click += new System.EventHandler(this.btnCancelar_Click_1); + // + // flowLayoutPanel2 + // + this.flowLayoutPanel2.Controls.Add(this.btnImg); + this.flowLayoutPanel2.Controls.Add(this.lbImg); + this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel2.Location = new System.Drawing.Point(3, 395); + this.flowLayoutPanel2.Name = "flowLayoutPanel2"; + this.flowLayoutPanel2.Size = new System.Drawing.Size(794, 39); + this.flowLayoutPanel2.TabIndex = 4; + // + // btnImg + // + this.btnImg.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnImg.Location = new System.Drawing.Point(3, 3); + this.btnImg.Name = "btnImg"; + this.btnImg.Size = new System.Drawing.Size(148, 36); + this.btnImg.TabIndex = 0; + this.btnImg.Text = "Seleccionar imagen"; + this.btnImg.UseVisualStyleBackColor = true; + this.btnImg.Click += new System.EventHandler(this.btnImg_Click); + // + // lbImg + // + this.lbImg.AutoSize = true; + this.lbImg.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbImg.Location = new System.Drawing.Point(157, 0); + this.lbImg.Name = "lbImg"; + this.lbImg.Padding = new System.Windows.Forms.Padding(0, 10, 0, 0); + this.lbImg.Size = new System.Drawing.Size(55, 26); + this.lbImg.TabIndex = 1; + this.lbImg.Text = "Imagen:"; // // EditarEmpleado // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 460); + this.ClientSize = new System.Drawing.Size(800, 508); this.Controls.Add(this.tableLayoutPanel1); this.Name = "EditarEmpleado"; this.Text = "Editar empleado"; @@ -581,6 +619,8 @@ namespace compabetov2 this.flowLayoutPanel13.ResumeLayout(false); this.flowLayoutPanel13.PerformLayout(); this.tableLayoutPanel3.ResumeLayout(false); + this.flowLayoutPanel2.ResumeLayout(false); + this.flowLayoutPanel2.PerformLayout(); this.ResumeLayout(false); } @@ -628,5 +668,8 @@ namespace compabetov2 private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3; private System.Windows.Forms.Button button1; private System.Windows.Forms.Button btnCancelar; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2; + private System.Windows.Forms.Button btnImg; + private System.Windows.Forms.Label lbImg; } } \ No newline at end of file diff --git a/EditarEmpleado.cs b/EditarEmpleado.cs index 2a7b5ea..b954c13 100644 --- a/EditarEmpleado.cs +++ b/EditarEmpleado.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -15,12 +16,14 @@ namespace compabetov2 public partial class EditarEmpleado : Form { private Empleado empleado; - personal ventanaPadre; + private personal ventanaPadre; + private string imagePath; public EditarEmpleado(Empleado empleado, personal ventanaPadre) { InitializeComponent(); this.empleado = empleado; this.ventanaPadre = ventanaPadre; + imagePath = Path.Combine(Application.StartupPath, "Resources", "usuarios", empleado.img); llenarCampos(); } @@ -38,6 +41,7 @@ namespace compabetov2 dtFechaCon.Text = empleado.fecha_contratacion; dtFechaNac.Text = empleado.fecha_nac; cbEstado.Text = empleado.estado; + lbImg.Text = $"Imagen: {Path.GetFileName(imagePath)}"; } private void tableLayoutPanel1_Paint(object sender, PaintEventArgs e) @@ -47,6 +51,18 @@ namespace compabetov2 private void button1_Click(object sender, EventArgs e) + { + + + } + + private void btnCancelar_Click(object sender, EventArgs e) + { + + + } + + private void button1_Click_1(object sender, EventArgs e) { Empleado empleadoNuevo = new Empleado( empleado.idempleado, @@ -61,18 +77,38 @@ namespace compabetov2 txtNoInt.Text, txtReferencia.Text, dtFechaNac.Text, - txtTelefono.Text); + txtTelefono.Text, + Path.GetFileName(imagePath)); if (service.actualizarEmpleado(empleadoNuevo)) { + if (!empleado.img.Equals(empleadoNuevo.img)) + { + string destinationFolder = Path.Combine(Application.StartupPath, "Resources", "usuarios"); + string destinationFile = Path.Combine(destinationFolder, Path.GetFileName(imagePath)); + File.Copy(imagePath, destinationFile, true); + } ventanaPadre.llenarPanel(); + Close(); } - } - private void btnCancelar_Click(object sender, EventArgs e) + private void btnCancelar_Click_1(object sender, EventArgs e) { - this.Close(); + Close(); + } + private void btnImg_Click(object sender, EventArgs e) + { + OpenFileDialog openFileDialog1 = new OpenFileDialog(); + + openFileDialog1.Filter = "Archivos de imagen (*.jpg, *.jpeg, *.png, *.bmp)|*.jpg;*.jpeg;*.png;*.bmp"; + openFileDialog1.Title = "Seleccionar imagen"; + + if (openFileDialog1.ShowDialog() == DialogResult.OK) + { + imagePath = openFileDialog1.FileName; + lbImg.Text = $"Imagen: {Path.GetFileName(imagePath)}"; + } } } } diff --git a/ModificarContra.Designer.cs b/ModificarContra.Designer.cs new file mode 100644 index 0000000..b126c07 --- /dev/null +++ b/ModificarContra.Designer.cs @@ -0,0 +1,127 @@ +namespace compabetov2 +{ + partial class ModificarContra + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.txtContra = new System.Windows.Forms.TextBox(); + this.txtConfi = new System.Windows.Forms.TextBox(); + this.btnConfirmar = new System.Windows.Forms.Button(); + this.btnCancelar = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Location = new System.Drawing.Point(13, 13); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(96, 20); + this.label1.TabIndex = 0; + this.label1.Text = "Contraseña:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label2.Location = new System.Drawing.Point(8, 101); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(166, 20); + this.label2.TabIndex = 1; + this.label2.Text = "Confirmar contraseña:"; + // + // txtContra + // + this.txtContra.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.txtContra.Location = new System.Drawing.Point(12, 54); + this.txtContra.Name = "txtContra"; + this.txtContra.PasswordChar = '*'; + this.txtContra.Size = new System.Drawing.Size(233, 26); + this.txtContra.TabIndex = 2; + this.txtContra.TextChanged += new System.EventHandler(this.textBox1_TextChanged); + // + // txtConfi + // + this.txtConfi.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.txtConfi.Location = new System.Drawing.Point(12, 145); + this.txtConfi.Name = "txtConfi"; + this.txtConfi.PasswordChar = '*'; + this.txtConfi.Size = new System.Drawing.Size(238, 26); + this.txtConfi.TabIndex = 3; + // + // btnConfirmar + // + this.btnConfirmar.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnConfirmar.Location = new System.Drawing.Point(12, 210); + this.btnConfirmar.Name = "btnConfirmar"; + this.btnConfirmar.Size = new System.Drawing.Size(92, 32); + this.btnConfirmar.TabIndex = 4; + this.btnConfirmar.Text = "Confirmar"; + this.btnConfirmar.UseVisualStyleBackColor = true; + this.btnConfirmar.Click += new System.EventHandler(this.btnConfirmar_Click); + // + // btnCancelar + // + this.btnCancelar.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnCancelar.Location = new System.Drawing.Point(158, 210); + this.btnCancelar.Name = "btnCancelar"; + this.btnCancelar.Size = new System.Drawing.Size(92, 32); + this.btnCancelar.TabIndex = 5; + this.btnCancelar.Text = "Cancelar"; + this.btnCancelar.UseVisualStyleBackColor = true; + this.btnCancelar.Click += new System.EventHandler(this.btnCancelar_Click); + // + // ModificarContra + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(262, 254); + this.Controls.Add(this.btnCancelar); + this.Controls.Add(this.btnConfirmar); + this.Controls.Add(this.txtConfi); + this.Controls.Add(this.txtContra); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Name = "ModificarContra"; + this.Text = "ModificarContra"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox txtContra; + private System.Windows.Forms.TextBox txtConfi; + private System.Windows.Forms.Button btnConfirmar; + private System.Windows.Forms.Button btnCancelar; + } +} \ No newline at end of file diff --git a/ModificarContra.cs b/ModificarContra.cs new file mode 100644 index 0000000..9007bef --- /dev/null +++ b/ModificarContra.cs @@ -0,0 +1,52 @@ +using compabetov2.database; +using compabetov2.database.modelos; +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 ModificarContra : Form + { + private Empleado empleado; + public ModificarContra(Empleado empleado) + { + InitializeComponent(); + this.empleado = empleado; + } + + private void btnConfirmar_Click(object sender, EventArgs e) + { + string contra = txtContra.Text; + string contraConfi = txtConfi.Text; + if (contra.Equals(contraConfi)) + { + if (service.modificarContra(empleado, contra)) + { + + Close(); + } + } + else + { + MessageBox.Show("Las contraseña no son iguales", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void btnCancelar_Click(object sender, EventArgs e) + { + Close(); + } + + private void textBox1_TextChanged(object sender, EventArgs e) + { + + } + } +} diff --git a/ModificarContra.resx b/ModificarContra.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ModificarContra.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/bin/Debug/compabetov2.exe b/bin/Debug/compabetov2.exe index 07d70d9..1628112 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 5915ffe..85ba747 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 d6f9c65..3928388 100644 Binary files a/bin/Debug/data.db and b/bin/Debug/data.db differ diff --git a/compabetov2.csproj b/compabetov2.csproj index ae7cc34..474f028 100644 --- a/compabetov2.csproj +++ b/compabetov2.csproj @@ -166,6 +166,12 @@ mermas.cs + + Form + + + ModificarContra.cs + Form @@ -216,6 +222,9 @@ mermas.cs + + ModificarContra.cs + personal.cs diff --git a/database/DAO.cs b/database/DAO.cs index 93a1767..52e876d 100644 --- a/database/DAO.cs +++ b/database/DAO.cs @@ -76,7 +76,37 @@ namespace compabetov2.database } } - public static bool crearLoginDAO(LoginModel login) + public static bool verificarExistenciaLoginDAO(LoginModel loginModel) + { + SQLiteDataReader reader = null; + var db_conexion = new Conexion(); + try + { + SQLiteConnection conexion = db_conexion.get_connection(); + + conexion.Open(); + + string sql = "SELECT * FROM Login WHERE usuario = @usuario"; + SQLiteCommand command = new SQLiteCommand(sql, conexion); + command.Parameters.AddWithValue("@usuario", loginModel.usuario); + reader = command.ExecuteReader(); + + if(reader.Read()) + { + return false; + } + return true; + + } + catch (SQLiteException ex) + { + MessageBox.Show(ex.Message); + return false; + } + } + + + public static bool crearLoginDAO(LoginModel login, int idempleado) { var db_conexion = new Conexion(); try @@ -91,18 +121,30 @@ namespace compabetov2.database { string sqlLogin = "INSERT INTO Login (tipo, usuario, contra) VALUES(@tipo, @usuario, @contra);"; string sqlEmpleado = "UPDATE Empleado SET fk_idLogin = @fklogin WHERE idempleado = @idempleado"; + string sqlConsulta = "SELECT idlogin FROM Login ORDER BY idlogin DESC LIMIT 1"; SQLiteCommand commandLogin = new SQLiteCommand(sqlLogin, conexion); commandLogin.Parameters.AddWithValue("@tipo", login.tipo); commandLogin.Parameters.AddWithValue("@usuario", login.usuario); commandLogin.Parameters.AddWithValue("@contra", login.contra); + commandLogin.ExecuteNonQuery(); + + SQLiteCommand commandConsulta = new SQLiteCommand(sqlConsulta, conexion); + SQLiteDataReader reader = commandConsulta.ExecuteReader(); + + long fkLogin = -1; + while(reader.Read()) + { + fkLogin = reader.GetInt64(0); + } + SQLiteCommand commandEmpleado = new SQLiteCommand(sqlEmpleado, conexion); - commandEmpleado.Parameters.AddWithValue("@fklogin", login.fkEmpleado); - commandEmpleado.Parameters.AddWithValue("@idempleado", login.fkEmpleado); + commandEmpleado.Parameters.AddWithValue("@fklogin", fkLogin); + commandEmpleado.Parameters.AddWithValue("@idempleado", idempleado); - commandLogin.ExecuteNonQuery(); + commandEmpleado.ExecuteNonQuery(); transaccion.Commit(); @@ -124,6 +166,83 @@ namespace compabetov2.database } } + public static bool eliminarLoginDAO(Empleado empleado) + { + var db_conexion = new Conexion(); + + try + { + using (SQLiteConnection conexion = db_conexion.get_connection()) + { + conexion.Open(); + + using (var transaccion = conexion.BeginTransaction()) + { + try + { + string sql = "UPDATE Empleado SET fk_idLogin = -1 WHERE idempleado = @idempleado"; + string sqlLogin = "DELETE FROM Login WHERE idlogin = @idlogin"; + + SQLiteCommand command = new SQLiteCommand(sql, conexion); + command.Parameters.AddWithValue("@idempleado", empleado.idempleado); + + + SQLiteCommand commandLogin = new SQLiteCommand(sqlLogin, conexion); + commandLogin.Parameters.AddWithValue("@idlogin", empleado.fkIdLogin); + + command.ExecuteNonQuery(); + commandLogin.ExecuteNonQuery(); + transaccion.Commit(); + return true; + + } + catch (SQLiteException ex) + { + transaccion.Rollback(); + MessageBox.Show(ex.Message); + return false; + } + + + } + } + } + catch (SQLiteException ex) + { + MessageBox.Show(ex.Message); + return false; + } + } + + public static bool modificarContraDAO(Empleado empleado, string contra) + { + var db_conexion = new Conexion(); + try + { + using (SQLiteConnection conexion = db_conexion.get_connection()) + { + conexion.Open(); + + string sql = "UPDATE Login SET contra = @contra WHERE idlogin = @idlogin"; + + using (SQLiteCommand command = new SQLiteCommand(sql, conexion)) + { + command.Parameters.AddWithValue("@contra", contra); + command.Parameters.AddWithValue("@idlogin", empleado.fkIdLogin); + + command.ExecuteNonQuery(); + + return true; + } + } + } + catch (SQLiteException ex) + { + MessageBox.Show(ex.Message); + return false; + } + } + public static bool insertarEmpleadoDAO(Empleado empleado) { var db_conexion = new Conexion(); @@ -133,8 +252,8 @@ namespace compabetov2.database { conexion.Open(); - string sql = "INSERT INTO Empleado (nombre, apellidos, calle, fecha_contratacion, estado, colonia, cp, no_ext, no_int, referencia, fecha_nac, telefono) " + - "VALUES (@nombre, @apellidos, @calle, @fecha_contratacion, @estado, @colonia, @cp, @no_ext, @no_int, @referencia, @fecha_nac, @telefono)"; + string sql = "INSERT INTO Empleado (nombre, apellidos, calle, fecha_contratacion, estado, colonia, cp, no_ext, no_int, referencia, fecha_nac, telefono,img,fk_idLogin) " + + "VALUES (@nombre, @apellidos, @calle, @fecha_contratacion, @estado, @colonia, @cp, @no_ext, @no_int, @referencia, @fecha_nac, @telefono, @img, @fk_idLogin)"; @@ -152,6 +271,8 @@ namespace compabetov2.database command.Parameters.AddWithValue("@referencia", empleado.referencia); command.Parameters.AddWithValue("@fecha_nac", empleado.fecha_nac); command.Parameters.AddWithValue("@telefono", empleado.telefono); + command.Parameters.AddWithValue("@img", empleado.img); + command.Parameters.AddWithValue("@fk_idLogin", empleado.fkIdLogin); int filasAfectadas = command.ExecuteNonQuery(); @@ -234,23 +355,43 @@ namespace compabetov2.database } } - public static bool eliminarEmpleadoDAO(int idEmpleado) { + public static bool eliminarEmpleadoDAO(Empleado empleado) { var db_conexion = new Conexion(); + try { using (SQLiteConnection conexion = db_conexion.get_connection()) { conexion.Open(); - string sql = "DELETE FROM Empleado WHERE idempleado = @idempleado"; - - using (SQLiteCommand command = new SQLiteCommand(sql, conexion)) + using (var transaccion = conexion.BeginTransaction()) { - command.Parameters.AddWithValue("@idempleado", idEmpleado); - int filasAfectadas = command.ExecuteNonQuery(); + try + { + string sql = "DELETE FROM Empleado WHERE idempleado = @idempleado"; + string sqlLogin = "DELETE FROM Login WHERE idlogin = @idlogin"; + + SQLiteCommand command = new SQLiteCommand(sql, conexion); + command.Parameters.AddWithValue("@idempleado", empleado.idempleado); + + + SQLiteCommand commandLogin = new SQLiteCommand(sqlLogin, conexion); + commandLogin.Parameters.AddWithValue("@idlogin", empleado.fkIdLogin); + + command.ExecuteNonQuery(); + commandLogin.ExecuteNonQuery(); + transaccion.Commit(); + return true; + + } + catch (SQLiteException ex) + { + transaccion.Rollback(); + MessageBox.Show(ex.Message); + return false; + } + - if (filasAfectadas > 0) { return true; } - else { return false; } } } } diff --git a/database/modelos/Empleado.cs b/database/modelos/Empleado.cs index 544f750..2f7926c 100644 --- a/database/modelos/Empleado.cs +++ b/database/modelos/Empleado.cs @@ -21,9 +21,10 @@ namespace compabetov2.database.modelos public string referencia; public string fecha_nac; public string telefono; - public int? fkIdLogin; + public string img; + 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 ="",int? fkIdLogin = null) + 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 ="",string img = "",int fkIdLogin = -1) { this.idempleado = idempeado; this.nombre = nombre; @@ -38,6 +39,7 @@ namespace compabetov2.database.modelos this.referencia = referencia; this.fecha_nac=fecha_nac; this.telefono = telefono; + this.img = img; this.fkIdLogin = fkIdLogin; } diff --git a/database/service.cs b/database/service.cs index 2653aa7..c0c544a 100644 --- a/database/service.cs +++ b/database/service.cs @@ -17,9 +17,9 @@ namespace compabetov2.database return DAO.iniciarSesionDAO(usuario.nombreUsuario, usuario.contra); } - public static bool crearLogin(LoginModel loginModel) + public static bool crearLogin(LoginModel loginModel, int idEmpleado) { - return DAO.crearLoginDAO(loginModel); + return DAO.crearLoginDAO(loginModel, idEmpleado); } public static List conseguirProductos() @@ -110,12 +110,11 @@ namespace compabetov2.database while (reader.Read()) { - int? fkIdLogin = null; - try - { + int fkIdLogin = -1; + try { long fkIdLoginTemp = reader.GetInt64(13); - fkIdLogin = Convert.ToInt32(fkIdLoginTemp); ; - }catch (Exception ex){} + fkIdLogin = Convert.ToInt32(fkIdLoginTemp); + }catch (Exception ex) { } long id = reader.GetInt64(0); Empleado empleado = new Empleado( Convert.ToInt32(id), @@ -131,6 +130,7 @@ namespace compabetov2.database reader["referencia"].ToString(), reader["fecha_nac"].ToString(), reader["telefono"].ToString(), + reader["img"].ToString(), fkIdLogin ) ; empleados.Add(empleado); @@ -145,14 +145,29 @@ namespace compabetov2.database return DAO.aumentarStockDAO(stockNuevo); } - public static bool eliminarEmpleado(int idEmpleado) + public static bool eliminarEmpleado(Empleado empleado) { - return DAO.eliminarEmpleadoDAO(idEmpleado); + return DAO.eliminarEmpleadoDAO(empleado); } public static bool actualizarEmpleado(Empleado empleado) { return DAO.actualizarEmpleadoDAO(empleado); } + + public static bool verificarExistenciaLogin(LoginModel loginModel) + { + return DAO.verificarExistenciaLoginDAO(loginModel); + } + + public static bool eliminarLogin(Empleado empleado) + { + return DAO.eliminarLoginDAO(empleado); + } + + public static bool modificarContra(Empleado empleado, string contra) + { + return DAO.modificarContraDAO(empleado, contra); + } } } diff --git a/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/obj/Debug/DesignTimeResolveAssemblyReferences.cache index f71e02f..3b0ba31 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 248c243..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 ed74861..5b34f37 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.CoreCompileInputs.cache b/obj/Debug/compabetov2.csproj.CoreCompileInputs.cache index 3f5ed13..8a75a03 100644 --- a/obj/Debug/compabetov2.csproj.CoreCompileInputs.cache +++ b/obj/Debug/compabetov2.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -53d3357e91ba943207bdb342d3e86d03592902ff7e153756cf88b283a4af2498 +b60c4bccea7fa102c5702d841868eb254cf2d68402605cb55dccf5a699b75adb diff --git a/obj/Debug/compabetov2.csproj.FileListAbsolute.txt b/obj/Debug/compabetov2.csproj.FileListAbsolute.txt index 6a0f019..85143a7 100644 --- a/obj/Debug/compabetov2.csproj.FileListAbsolute.txt +++ b/obj/Debug/compabetov2.csproj.FileListAbsolute.txt @@ -99,3 +99,4 @@ C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.AgregarLogin.resource C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.EditarEmpleado.resources C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.Confirmacion.resources >>>>>>> c224b1f121cf870873d6bc2414ec92b69d8a3668 +C:\Users\carsu\source\repos\compabetoOG\obj\Debug\compabetov2.ModificarContra.resources diff --git a/obj/Debug/compabetov2.csproj.GenerateResource.cache b/obj/Debug/compabetov2.csproj.GenerateResource.cache index 6e045ac..8731949 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 07d70d9..1628112 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 5915ffe..85ba747 100644 Binary files a/obj/Debug/compabetov2.pdb and b/obj/Debug/compabetov2.pdb differ diff --git a/personal.cs b/personal.cs index 7f0183a..8fd84ce 100644 --- a/personal.cs +++ b/personal.cs @@ -54,7 +54,9 @@ namespace compabetov2 PictureBox imgEmpleado = new PictureBox(); imgEmpleado.Dock = DockStyle.Fill; - string rutaImg = Path.Combine(Application.StartupPath, "Resources", "usuarios", "usuarioAnonimo.png"); + string rutaImg = empleado.img.Equals("") ? + Path.Combine(Application.StartupPath, "Resources", "usuarios", "usuarioAnonimo.png") : + Path.Combine(Application.StartupPath, "Resources", "usuarios", empleado.img); imgEmpleado.Image = Image.FromFile(rutaImg); imgEmpleado.BackgroundImageLayout = ImageLayout.Stretch; imgEmpleado.SizeMode = PictureBoxSizeMode.Zoom; @@ -119,8 +121,10 @@ namespace compabetov2 "Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { - service.eliminarEmpleado(empleado.idempleado); - llenarPanel(); + if (service.eliminarEmpleado(empleado)) + { + llenarPanel(); + } } }); @@ -130,7 +134,7 @@ namespace compabetov2 btnLogin.FlatStyle = FlatStyle.Flat; btnLogin.FlatAppearance.BorderSize = 0; btnLogin.Font = new Font(btnVer.Font.FontFamily, 16); - if(empleado.fkIdLogin == null) { + if(empleado.fkIdLogin == -1) { btnLogin.Click += new EventHandler(delegate (object sender, EventArgs e) { @@ -143,7 +147,8 @@ namespace compabetov2 btnLogin.BackColor = Color.Yellow; btnLogin.Click += new EventHandler(delegate (object sender, EventArgs e) { - + Confirmacion pregunta = new Confirmacion(empleado,this); + pregunta.Show(); }); } diff --git a/preguntaLogin.Designer.cs b/preguntaLogin.Designer.cs index 85cbf15..bc85ee9 100644 --- a/preguntaLogin.Designer.cs +++ b/preguntaLogin.Designer.cs @@ -53,6 +53,7 @@ this.button1.TabIndex = 1; this.button1.Text = "Modificar contraseña"; this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); // // button2 // @@ -63,6 +64,7 @@ this.button2.TabIndex = 2; this.button2.Text = "Eliminar"; this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); // // Confirmacion // diff --git a/preguntaLogin.cs b/preguntaLogin.cs index a418e6a..dabee4c 100644 --- a/preguntaLogin.cs +++ b/preguntaLogin.cs @@ -1,4 +1,6 @@ -using System; +using compabetov2.database; +using compabetov2.database.modelos; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -12,9 +14,13 @@ namespace compabetov2 { public partial class Confirmacion : Form { - public Confirmacion() + private Empleado empleado; + private personal ventanaPadre; + public Confirmacion(Empleado empleado, personal ventanaPadre) { InitializeComponent(); + this.empleado = empleado; + this.ventanaPadre = ventanaPadre; } private void preguntaLogin_Load(object sender, EventArgs e) @@ -26,5 +32,21 @@ namespace compabetov2 { } + + private void button1_Click(object sender, EventArgs e) + { + ModificarContra modificarContra = new ModificarContra(empleado); + modificarContra.Show(); + Close(); + } + + private void button2_Click(object sender, EventArgs e) + { + if(service.eliminarLogin(empleado)) + { + ventanaPadre.llenarPanel(); + Close(); + } + } } }