diff --git a/Empleados/EditarEmpleado1.cs b/Empleados/EditarEmpleado1.cs index bc63730..8f0b477 100644 --- a/Empleados/EditarEmpleado1.cs +++ b/Empleados/EditarEmpleado1.cs @@ -25,6 +25,20 @@ namespace compabetov2.Empleados this.ventanaPadre = ventanaPadre; imagePath = Path.Combine(Application.StartupPath, "Resources", "usuarios", empleado.img); llenarCampos(); + + txtCp.KeyPress += new KeyPressEventHandler(PermitirSoloNumeros); + + // Suscribir al evento KeyPress para el TextBox txtNoExt + txtNoExt.KeyPress += new KeyPressEventHandler(PermitirSoloNumeros); + + // Suscribir al evento KeyPress para el TextBox txtNoInt + txtNoInt.KeyPress += new KeyPressEventHandler(PermitirSoloNumeros); + + // Suscribir al evento KeyPress para el TextBox txtNombre + txtNombre.KeyPress += new KeyPressEventHandler(PermitirSoloLetras); + + // Suscribir al evento KeyPress para el TextBox txtApellido + txtApellido.KeyPress += new KeyPressEventHandler(PermitirSoloLetras); } private void llenarCampos() @@ -102,5 +116,28 @@ namespace compabetov2.Empleados this.Close(); } + private void PermitirSoloNumeros(object sender, KeyPressEventArgs e) + { + // Verificar si la tecla presionada no es un número o la tecla de retroceso + if (!char.IsDigit(e.KeyChar) && e.KeyChar != 8) + { + e.Handled = true; // Ignorar la tecla presionada + + // Mostrar un mensaje indicando que solo se permiten números + MessageBox.Show("Por favor, ingrese solo números.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void PermitirSoloLetras(object sender, KeyPressEventArgs e) + { + // Verificar si la tecla presionada no es una letra o la tecla de retroceso + if (!char.IsLetter(e.KeyChar) && e.KeyChar != 8 && e.KeyChar != 32) + { + e.Handled = true; // Ignorar la tecla presionada + + // Mostrar un mensaje indicando que solo se permiten letras + MessageBox.Show("Por favor, ingrese solo letras.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } } } diff --git a/Envios/envios.Designer.cs b/Envios/envios.Designer.cs index ea30beb..c37a1bf 100644 --- a/Envios/envios.Designer.cs +++ b/Envios/envios.Designer.cs @@ -241,6 +241,7 @@ this.txtTelefono.Name = "txtTelefono"; this.txtTelefono.Size = new System.Drawing.Size(365, 55); this.txtTelefono.TabIndex = 56; + this.txtTelefono.TextChanged += new System.EventHandler(this.txtTelefono_TextChanged); // // label1 // diff --git a/Envios/envios.cs b/Envios/envios.cs index b68084b..eab8111 100644 --- a/Envios/envios.cs +++ b/Envios/envios.cs @@ -26,6 +26,8 @@ namespace compabetov2 InitializeComponent(); llenarPanel(); this.loginPrincipal = loginPrincipal; + + txtTelefono.KeyPress += new KeyPressEventHandler(txtTelefono_KeyPress); } private void InitializePanelEnvio() @@ -417,5 +419,21 @@ namespace compabetov2 Estadiscticas verstats = new Estadiscticas(); verstats.Show(); } + + private void txtTelefono_TextChanged(object sender, EventArgs e) + { + + } + private void txtTelefono_KeyPress(object sender, KeyPressEventArgs e) + { + // Verificar si la tecla presionada no es un número o la tecla de retroceso + if (!char.IsDigit(e.KeyChar) && e.KeyChar != 8) + { + e.Handled = true; // Ignorar la tecla presionada + + // Mostrar un mensaje indicando que solo se permiten números + MessageBox.Show("Por favor, ingrese solo números en el teléfono.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } } } diff --git a/Estadiscticas.Designer.cs b/Estadiscticas.Designer.cs index 7935ac4..824184d 100644 --- a/Estadiscticas.Designer.cs +++ b/Estadiscticas.Designer.cs @@ -199,7 +199,7 @@ this.lbProductDia.BackColor = System.Drawing.Color.Transparent; this.lbProductDia.Font = new System.Drawing.Font("Poppins", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lbProductDia.ForeColor = System.Drawing.Color.Transparent; - this.lbProductDia.Location = new System.Drawing.Point(862, 245); + this.lbProductDia.Location = new System.Drawing.Point(781, 243); this.lbProductDia.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbProductDia.Name = "lbProductDia"; this.lbProductDia.Size = new System.Drawing.Size(210, 30); @@ -213,7 +213,7 @@ this.lbVendedorDia.BackColor = System.Drawing.Color.Transparent; this.lbVendedorDia.Font = new System.Drawing.Font("Poppins", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lbVendedorDia.ForeColor = System.Drawing.Color.Transparent; - this.lbVendedorDia.Location = new System.Drawing.Point(862, 318); + this.lbVendedorDia.Location = new System.Drawing.Point(781, 316); this.lbVendedorDia.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbVendedorDia.Name = "lbVendedorDia"; this.lbVendedorDia.Size = new System.Drawing.Size(154, 30); @@ -253,7 +253,7 @@ this.lbVendedorMes.BackColor = System.Drawing.Color.Transparent; this.lbVendedorMes.Font = new System.Drawing.Font("Poppins", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lbVendedorMes.ForeColor = System.Drawing.Color.Transparent; - this.lbVendedorMes.Location = new System.Drawing.Point(865, 561); + this.lbVendedorMes.Location = new System.Drawing.Point(784, 559); this.lbVendedorMes.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbVendedorMes.Name = "lbVendedorMes"; this.lbVendedorMes.Size = new System.Drawing.Size(151, 30); @@ -267,7 +267,7 @@ this.lbProductoMes.BackColor = System.Drawing.Color.Transparent; this.lbProductoMes.Font = new System.Drawing.Font("Poppins", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lbProductoMes.ForeColor = System.Drawing.Color.Transparent; - this.lbProductoMes.Location = new System.Drawing.Point(865, 489); + this.lbProductoMes.Location = new System.Drawing.Point(784, 487); this.lbProductoMes.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbProductoMes.Name = "lbProductoMes"; this.lbProductoMes.Size = new System.Drawing.Size(210, 30); diff --git a/Estadiscticas.resx b/Estadiscticas.resx index 3d753bc..61e5f8b 100644 --- a/Estadiscticas.resx +++ b/Estadiscticas.resx @@ -129,6 +129,30 @@ True + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + True diff --git a/Ventas/datosEnvio.Designer.cs b/Ventas/datosEnvio.Designer.cs index 8d06f48..e03e3eb 100644 --- a/Ventas/datosEnvio.Designer.cs +++ b/Ventas/datosEnvio.Designer.cs @@ -93,6 +93,7 @@ this.txtTelefono.Name = "txtTelefono"; this.txtTelefono.Size = new System.Drawing.Size(449, 30); this.txtTelefono.TabIndex = 5; + this.txtTelefono.TextChanged += new System.EventHandler(this.txtTelefono_TextChanged); // // label3 // diff --git a/Ventas/datosEnvio.cs b/Ventas/datosEnvio.cs index 7c4b475..1a6b758 100644 --- a/Ventas/datosEnvio.cs +++ b/Ventas/datosEnvio.cs @@ -28,6 +28,7 @@ namespace compabetov2.Ventas this.envio = envio; this.detallesEnvio = detallesEnvio; this.ventanaPadre = ventanaPadre; + txtTelefono.KeyPress += new KeyPressEventHandler(txtTelefono_KeyPress); } @@ -207,5 +208,25 @@ namespace compabetov2.Ventas this.Close(); } } + + private void txtTelefono_TextChanged(object sender, EventArgs e) + { + + } + + private void txtTelefono_KeyPress(object sender, KeyPressEventArgs e) + { + // Verificar si la tecla presionada no es un número o la tecla de retroceso + if (!char.IsDigit(e.KeyChar) && e.KeyChar != 8) + { + e.Handled = true; // Ignorar la tecla presionada + + // Mostrar un mensaje indicando que solo se permiten números + MessageBox.Show("Por favor, ingrese solo números en el teléfono.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + + } } diff --git a/Ventas/vender.cs b/Ventas/vender.cs index 10b13d6..e9ba3ef 100644 --- a/Ventas/vender.cs +++ b/Ventas/vender.cs @@ -715,6 +715,7 @@ namespace compabetov2 { List detallesCuenta = listaProductosCuenta(); + if (detallesCuenta.Count > 0) { Cuenta ventaModel = new Cuenta(total); diff --git a/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/obj/Debug/DesignTimeResolveAssemblyReferences.cache index 4382aa9..0527a59 100644 Binary files a/obj/Debug/DesignTimeResolveAssemblyReferences.cache and b/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ diff --git a/obj/Debug/compabetov2.csproj.AssemblyReference.cache b/obj/Debug/compabetov2.csproj.AssemblyReference.cache index e1562b1..a853f99 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 f3a1c49..f86fa1f 100644 --- a/obj/Debug/compabetov2.csproj.CoreCompileInputs.cache +++ b/obj/Debug/compabetov2.csproj.CoreCompileInputs.cache @@ -1 +1,5 @@ +<<<<<<< HEAD 3f62af869539c2801b7da3577ef2feb00e7c32f1cefc777b57202fa5ad70cc96 +======= +02f8dd8032cdd900c4c7a30e0d2445335e555a7c7084d974934c829cadebfeb5 +>>>>>>> 080e4640be9b07fc95a949fb1d8b60393000f770