private bool LosDatosIngresadosSonCorrectos() { LimpiarEP(); if (Controles.IsNullOEmptyElControl(txtCodigo)) { EP.SetError(txtCodigo, "Este campo no puede quedar vacío"); txtCodigo.Focus(); return(false); } if (Controles.IsNullOEmptyElControl(txtContenedor)) { EP.SetError(txtContenedor, "Este campo no puede quedar vacío"); txtContenedor.Focus(); return(false); } if (Controles.IsNullOEmptyElControl(cmbSeccion)) { EP.SetError(cmbSeccion, "Se debe seleccionar una sección"); cmbSeccion.Focus(); return(false); } return(true); }
private void btnEditarDatos_Click(object sender, EventArgs e) { if (txtNombreAnterior.Text == string.Empty) { EP.SetError(txtNombreAnterior, "Campo requerido"); } if (txtNuevoNombre.Text == string.Empty) { EP.SetError(txtNuevoNombre, "Campo requerido"); } if (txtPassAdmin.Text == string.Empty) { EP.SetError(txtPassAdmin, "Campo requerido"); } DialogResult OK; OK = MessageBox.Show("Seguro que deceas modificar la contraseña?", "Advertencia", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation); if (DialogResult.OK == OK) { if (crd.editarAdmin(txtNombreAnterior.Text, txtNuevoNombre.Text, txtPassAdmin.Text) == 1) { MessageBox.Show("Modificacion realizada con exito", "Correcto", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Algo ocurrio mal durante el proceso", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } txtNombreAnterior.Text = string.Empty; txtNombreAnterior.Text = string.Empty; txtPassAdmin.Text = string.Empty; } }
private bool LosDatosIngresadosSonCorrectos() { LimpiarEP(); if (Controles.IsNullOEmptyElControl(txtDescGrupoDeCuentas)) { EP.SetError(txtDescGrupoDeCuentas, "Este campo no puede quedar vacío"); txtDescGrupoDeCuentas.Focus(); return(false); } if (Controles.IsNullOEmptyElControl(cmbCredito)) { EP.SetError(cmbCredito, "Se debe seleccionar un valor"); cmbCredito.Focus(); return(false); } if (Controles.IsNullOEmptyElControl(cmbDebito)) { EP.SetError(cmbCredito, "Se debe seleccionar un valor"); cmbCredito.Focus(); return(false); } return(true); }
private void LimCombo_Leave(object sender, EventArgs e) { try { Common.FormatCombo(LimCombo); if (LimCombo.Text.Length <= 0) { EP.SetError(LimCombo, "Type the File Name First..."); LimCombo.Focus(); return; } else if (LimCombo.Text.Length <= 5) { EP.SetError(LimCombo, "The name should be More than 5 Letters..."); LimCombo.Focus(); } else if (((LimCombo.Text.Substring(0, 4)) == "Lim_") || ((LimCombo.Text.Substring(0, 4)) == "LIM_") || ((LimCombo.Text.Substring(0, 4)) == "lim_")) { LimCombo.Text = "lim_" + (LimCombo.Text.Substring(4)).ToLower(); EP.Clear(); } else { LimCombo.Text = "lim_" + LimCombo.Text.ToLower(); EP.Clear(); } } catch (Exception ex) { MessageBox.Show(" LimCombo_Leave @ Error Code:-7013 " + ex.Message); } }
private void btnAgregarUsuario_Click(object sender, EventArgs e) { if (txtNombreUsuario.Text == string.Empty) { EP.SetError(txtNombreUsuario, "Campo requerido"); } if (txtPassUsuario.Text == string.Empty) { EP.SetError(txtPassUsuario, "Campo requerido"); } DialogResult OK; OK = MessageBox.Show("Seguro que deceas agregar ujn nuevo usuario?", "Advertencia", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation); if (DialogResult.OK == OK) { if (crd.Create(txtNombreUsuario.Text, txtPassUsuario.Text) == 1) { MessageBox.Show("Usuario agregado de manera exitosa.", "Correcto", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Ocurrio un error durante el proceso", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private Boolean LosDatosIngresadosSonCorrectos() { decimal Cantidad; decimal.TryParse(txtCantidad.Text, out Cantidad); if (Cantidad == 0) { EP.SetError(txtCantidad, "El valor no puede ser cero"); txtCantidad.Focus(); return(false); } DateTime FechaActual = System.DateTime.Now; if (dtpkFechaVencimiento.Checked == false) { EP.SetError(dtpkFechaVencimiento, "No se ha seleccionado una fecha de vencimiento del lote del producto"); dtpkFechaVencimiento.Focus(); return(false); } if (dtpkFechaVencimiento.Value.CompareTo(FechaActual) < 0) { EP.SetError(dtpkFechaVencimiento, "La fecha Ingresada de inicio de la promoción no puede ser menor que la fecha actual del SO"); dtpkFechaVencimiento.Focus(); return(false); } return(true); }
private void Test() { label16.Text = Environment.OSVersion.ToString(); { Label la = label2; EP.SetError(la, null); try { la.Text = new UseIsWow64Process().Is64BitOS() ? "64" : "32"; } catch (Exception err) { EP.SetError(la, "失敗: " + err); } } { Label la = label4; EP.SetError(la, null); try { la.Text = new UsePROCESSOR_ARCHITECTURE().IsOS64() ? "64" : "32"; } catch (Exception err) { EP.SetError(la, "失敗: " + err); } } { Label la = label6; EP.SetError(la, null); try { la.Text = new UseWMI().GetOSBits(); } catch (Exception err) { EP.SetError(la, "失敗: " + err); } } { Label la = label9; EP.SetError(la, null); try { la.Text = new UseGetSystemWow64Directory().Is64OS() ? "64" : "32"; } catch (Exception err) { EP.SetError(la, "失敗: " + err); } } { Label la = label11; EP.SetError(la, null); try { la.Text = new UseGetNativeSystemInfo().GetOSBits(); } catch (Exception err) { EP.SetError(la, "失敗: " + err); } } { Label la = label13; EP.SetError(la, null); try { la.Text = new UseIntPtr().GetOSBits(); } catch (Exception err) { EP.SetError(la, "失敗: " + err); } } }
private void AplicarCierreDelPeriodo() { try { if (LosDatosIngresadosSonCorrectos()) { LimpiarEP(); if (string.IsNullOrEmpty(txtDescripcion.Text) || txtDescripcion.Text.Trim().Length == 0) { EP.SetError(txtDescripcion, "El valor del campo no puede quedar vacío"); txtDescripcion.Focus(); return; } if (EvaluarSiHayRegistrosEnLaTablaTMP()) { return; } //realiaremos un backup dela base de datos... if (RespaldarBaseDeDatos()) { this.Cursor = Cursors.WaitCursor; CierreDePeriodoEN oRegistroEN = InformacionSobreELCierreDePeriodo(); CierreDePeriodoLN oRegistroLN = new CierreDePeriodoLN(); System.Threading.Thread.Sleep(10000); timer1.Interval = 5000; timer1.Start(); if (oRegistroLN.AgregarUtilizandoLaMismaConexion(oRegistroEN, Program.oDatosDeConexion)) { EvaluarErrorParaMensajeAPantalla(oRegistroLN.Error, "CERRAR"); if (CerrarVentana == true) { this.Close(); } } else { throw new ArgumentException(oRegistroLN.Error); } } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Aplicar cierre de periodo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } finally { this.Cursor = Cursors.Default; } }
private void TextBox4_Leave(object sender, EventArgs e) { if (TextBox4.Text == "") { EP.SetError(TextBox4, "Fill the Max RPM first"); TextBox4.Focus(); } else { EP.Clear(); } }
private void TextBox2_Leave(object sender, EventArgs e) { if (TextBox2.Text == "") { EP.SetError(TextBox2, "Fill the Department first"); TextBox2.Focus(); } else { EP.Clear(); } }
private void TextBox1_TextChanged(object sender, EventArgs e) { if (TextBox1.Text == "") { EP.SetError(TextBox1, "Fill the Company name first"); TextBox1.Focus(); } else { EP.Clear(); } }
private void TextBox9_Leave(object sender, EventArgs e) { if (TextBox9.Text == "") { EP.SetError(TextBox9, "Fill the first start time first"); TextBox9.Focus(); } else { EP.Clear(); } }
private void TextBox8_Leave(object sender, EventArgs e) { if (TextBox8.Text == "") { EP.SetError(TextBox8, "Fill the Test Cell no. first"); TextBox8.Focus(); } else { EP.Clear(); } }
private void TextBox6_Leave(object sender, EventArgs e) { if (TextBox6.Text == "") { EP.SetError(TextBox6, "Fill the Blank Text first"); TextBox6.Focus(); } else { EP.Clear(); } }
private void TextBox3_Leave(object sender, EventArgs e) { if (TextBox3.Text == "") { EP.SetError(TextBox3, "Fill the Max Torque first"); TextBox3.Focus(); } else { EP.Clear(); } }
private bool LosDatosIngresadosSonCorrectos() { LimpiarEP(); if (Controles.IsNullOEmptyElControl(txtNombre)) { EP.SetError(txtNombre, "Este campo no puede quedar vacío"); txtNombre.Focus(); return(false); } return(true); }
private bool LosDatosIngresadosSonCorrectos() { EP.Clear(); if (Controles.IsNullOEmptyElControl(txtNombre)) { EP.SetError(txtNombre, "Este valor no puede quedar vacio"); txtNombre.Focus(); return(false); } return(true); }
private void LoginUsuario() { EP.Clear(); if (string.IsNullOrEmpty(txtUsuario.Text) || txtUsuario.Text.Trim().Length == 0) { EP.SetError(txtUsuario, "Este campo no puede quedar vacio"); txtUsuario.Focus(); return; } if (string.IsNullOrEmpty(txtContraseña.Text) || txtContraseña.Text.Trim().Length == 0) { EP.SetError(txtContraseña, "Este campo no puede quedar vacio"); txtContraseña.Focus(); return; } this.Cursor = Cursors.WaitCursor; Program.oLoginEN.contraseña = CifrarCadenas.EncriptarCadena(txtContraseña.Text); Program.oLoginEN.Login = txtUsuario.Text.Trim(); LoginLN oLoginLN = new LoginLN(); if (oLoginLN.IniciarLaSesionDelUsuario(Program.oLoginEN, Program.oDatosDeConexion)) { if (oLoginLN.TraerDatos().Rows.Count > 0) { Program.Iniciar = true; this.Cursor = Cursors.Default; CargarInformacionDeLaConfiguracion(); this.Close(); } else { this.Cursor = Cursors.Default; Program.Iniciar = false; MessageBox.Show("Usuario o contraseña inválidos: " + oLoginLN.Error, "Inicio de sesión", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtUsuario.Focus(); } } else { this.Cursor = Cursors.Default; Program.Iniciar = false; MessageBox.Show("Usuario o contraseña inválidos: " + oLoginLN.Error, "Inicio de sesión", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtUsuario.Focus(); } }
private void btnEliminarUsuario_Click(object sender, EventArgs e) { if (txtNombreUsuario.Text == string.Empty) { EP.SetError(txtNombreUsuario, "Se requiere minimo el nombre del Uusuario"); } DialogResult OK; OK = MessageBox.Show("¿Seguro que quieres eliminar el Usuario?", "Advertencia", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation); if (DialogResult.OK == OK) { MessageBox.Show(crd.Delete(txtNombreUsuario.Text)); } txtNombreUsuario.Clear(); txtPassUsuario.Clear(); }
private void Baceptar_Click(object sender, EventArgs e) { if (TBMatricula.Text == "") { EP.SetError(TBMatricula, "No ingreso matricula"); } if (TBNombre.Text == "") { EP.SetError(TBNombre, "No ingreso nombre"); } if (TBCarrera.Text == "") { EP.SetError(TBCarrera, "No ingreso carrera"); } if (TBSemestre.Text == "") { EP.SetError(TBSemestre, "No ingreso semestre"); } if (TBTelefono.Text == "") { EP.SetError(TBTelefono, "No ingreso telefono"); } try { Alumno alumno = new Alumno(); alumno.Matricula = Convert.ToInt32(TBMatricula.Text); alumno.Nombre = TBNombre.Text; alumno.Semestre = Convert.ToInt32(TBSemestre.Text); alumno.Carrera = TBCarrera.Text; alumno.Telefono = Convert.ToInt32(TBTelefono.Text); alumnos.Add(alumno); throw new Specialexception("Su alumno se creo exitosamente"); } catch (FormatException r) { MessageBox.Show("Error en registracion " + r.Message); } catch (Specialexception espr) { MessageBox.Show(espr.Message); } finally { EP.Clear(); } }
private void Button2_Click(object sender, EventArgs e) { if (ComboBox7.Text == "") { EP.SetError(ComboBox7, "Select the Comport first"); GroupBox3.BringToFront(); GroupBox2.SendToBack(); Button3.Enabled = false; return; } if (ComboBox18.Text == "") { EP.SetError(ComboBox18, "Select the Comport first"); GroupBox3.BringToFront(); GroupBox2.SendToBack(); Button3.Enabled = false; return; } if (ComboBox19.Text == "") { EP.SetError(ComboBox19, "Select the Comport first"); GroupBox3.BringToFront(); GroupBox2.SendToBack(); Button3.Enabled = false; return; } if (ComboBox21.Text == "") { EP.SetError(ComboBox21, "Select the Comport first"); GroupBox3.BringToFront(); GroupBox2.SendToBack(); Button3.Enabled = false; return; } Button3.Enabled = true; EP.Clear(); Save_File(); }
private Boolean LosDatosIngresadosSonCorrectos() { decimal PrecioDePromocion; decimal.TryParse(txtPrecioPromocional.Text, out PrecioDePromocion); if (PrecioDePromocion == 0) { EP.SetError(txtPrecioPromocional, "Este valor no puede ser cero o menor que cero"); txtPrecioPromocional.Focus(); return(false); } DateTime FechaActual = System.DateTime.Now; if (FechaActual.CompareTo(dtpkDesdePromocion.Value) < 0) { EP.SetError(dtpkDesdePromocion, "La fecha Ingresada de inicio de la promoción no puede ser menor que la fecha actual del SO"); dtpkDesdePromocion.Focus(); return(false); } if (dtpkHastaPromocional.Value.CompareTo(dtpkDesdePromocion.Value) < 0) { EP.SetError(dtpkHastaPromocional, string.Format("La fecha Ingresada de finalización de la promoción no puede ser {0} menor que la fecha de inicio de la promocion", Environment.NewLine)); dtpkHastaPromocional.Focus(); return(false); } if (Controles.IsNullOEmptyElControl(txtDescripcionDeLaPromocion)) { EP.SetError(txtDescripcionDeLaPromocion, "Agrege una descripcíon de la promoción que se le va aplicar al producto"); txtDescripcionDeLaPromocion.Focus(); return(false); } return(true); }
private bool LosDatosIngresadosSonCorrectos() { LimpiarEP(); if (txtNombre.Text.Length == 0 || string.IsNullOrEmpty(txtNombre.Text)) { EP.SetError(txtNombre, "Este campo no puede estar vacío."); txtNombre.Focus(); return(false); } if (cmbEstado.SelectedIndex == -1) { EP.SetError(cmbEstado, "Se debe de seleccionar un valor"); cmbEstado.Focus(); return(false); } DateTime Fecha1 = dtpDesde.Value; DateTime Fecha2 = dtpHasta.Value; if (Fecha1 > Fecha2) { EP.SetError(dtpHasta, "La fecha inicial del periodo no puede ser mayor que la final"); dtpHasta.Focus(); return(false); } if (Fecha2 < Fecha1) { EP.SetError(dtpDesde, "La fecha de fin de periodo no puede ser menor que la inicial"); dtpDesde.Focus(); return(false); } if (cmbEstado.Text.Trim().ToUpper() == "CERRADO".ToUpper()) { DateTime FechaCierre = dtpFechaDeCierre.Value; if (FechaCierre <= Fecha2) { EP.SetError(dtpFechaDeCierre, "La fecha de del cierre del perio no pude ser menos que la fecha de finalización del Periodo"); dtpFechaDeCierre.Focus(); return(false); } if (txtDescripcion.Text.Length == 0 || string.IsNullOrEmpty(txtDescripcion.Text)) { EP.SetError(txtDescripcion, "Este campo no puede estar vacío."); txtDescripcion.Focus(); return(false); } if (txtCambioOficial.Text.Length == 0 || string.IsNullOrEmpty(txtCambioOficial.Text)) { EP.SetError(txtCambioOficial, "Este campo no puede estar vacío."); txtCambioOficial.Focus(); return(false); } if (Convert.ToDecimal(txtCambioOficial.Text) <= 0) { EP.SetError(txtCambioOficial, "El valor ingresado no es válido"); txtCambioOficial.Focus(); return(false); } tabControl1.SelectedIndex = tabControl1.TabPages.Count - 1; } return(true); }
private void button1_Click(object sender, EventArgs e) { if (txt_pasta.Text == string.Empty) { EP.SetError(txt_pasta, "Campo requerido"); } if (txt_hambur.Text == string.Empty) { EP.SetError(txt_hambur, "Campo requerido"); } if (txt_cCompleta.Text == string.Empty) { EP.SetError(txt_cCompleta, "Campo requerido"); } if (txt_Jugo.Text == string.Empty) { EP.SetError(txt_Jugo, "Campo requerido"); } if (txt_cocaC.Text == string.Empty) { EP.SetError(txt_cocaC, "Campo requerido"); } if (txt_agua.Text == string.Empty) { EP.SetError(txt_agua, "Campo requerido"); } if (txt_choco.Text == string.Empty) { EP.SetError(txt_choco, "Campo requerido"); } if (txt_pay.Text == string.Empty) { EP.SetError(txt_pay, "Campo requerido"); } if (txt_galletas.Text == string.Empty) { EP.SetError(txt_galletas, "Campo requerido"); } if (btn_precios.Text == "Editar") { txt_pasta.ReadOnly = false; txt_hambur.ReadOnly = false; txt_cCompleta.ReadOnly = false; txt_Jugo.ReadOnly = false; txt_cocaC.ReadOnly = false; txt_agua.ReadOnly = false; txt_choco.ReadOnly = false; txt_pay.ReadOnly = false; txt_galletas.ReadOnly = false; btn_precios.Text = "Guardar"; } else { if (crd.modPrecios(txt_pasta.Text, txt_hambur.Text, txt_cCompleta.Text, txt_Jugo.Text, txt_cocaC.Text, txt_agua.Text, txt_choco.Text, txt_pay.Text, txt_galletas.Text) == 9) { txt_pasta.ReadOnly = true; txt_hambur.ReadOnly = true; txt_cCompleta.ReadOnly = true; txt_Jugo.ReadOnly = true; txt_cocaC.ReadOnly = true; txt_agua.ReadOnly = true; txt_choco.ReadOnly = true; txt_pay.ReadOnly = true; txt_galletas.ReadOnly = true; MessageBox.Show("Modificacion realizada con exito"); } btn_precios.Text = "Editar"; } }
private void BtnAgregar_Click(object sender, EventArgs e) { //Se usa la condicion para cuando las cajas de texto esten vacias este le diga al usuario //Que no se han llenado. if (txtMatricula.Text == "") { //El Ep.setError cabe destacar que sirve para que marque la caja de texto donde //No se ingreso el valor EP.SetError(txtMatricula, "No ha ingresado matricula"); } if (txtNombre.Text == "") { EP.SetError(txtNombre, "No ha ingresado Nombre"); } if (txtSemestre.Text == "") { EP.SetError(txtSemestre, "No ha ingresado semestre"); } if (txtSemestre.Text == "") { EP.SetError(txtCarrera, "No ha ingresado Carrera"); } if (txtCalificacion.Text == "") { EP.SetError(txtCalificacion, "No ha ingresado Calificacion"); } //Se usa un try para capturar los errores que se puedan presentar como //no llenar las cajas texto try { //Se asignan las cajas de texto a los atributos Alumno alumno = new Alumno(); alumno.Matricula = txtMatricula.Text; alumno.Nombre = txtNombre.Text; alumno.Semestre = Convert.ToInt32(txtSemestre.Text); alumno.Carrera = txtCarrera.Text; alumno.Calificacion = Convert.ToInt32(txtCalificacion.Text); //confirmacion de que el usuario se ah creado throw new ExeptionEspecial("su alumno se creo exitosamente"); } //FormatException es para cuando se ingresa un formato que no se espera catch (FormatException exception) { //mensaje de error al ingresar un dato no adecuado MessageBox.Show("Error en registrar alumno:" + " " + exception.Message); } catch (ExeptionEspecial specialexception) { MessageBox.Show(specialexception.Message); } }
private void btn_modInven_Click(object sender, EventArgs e) { if (mp1.Text == string.Empty) { EP.SetError(mp1, "Campo requerido"); } if (mp2.Text == string.Empty) { EP.SetError(mp2, "Campo requerido"); } if (mp3.Text == string.Empty) { EP.SetError(mp3, "Campo requerido"); } if (mp4.Text == string.Empty) { EP.SetError(mp4, "Campo requerido"); } if (mp5.Text == string.Empty) { EP.SetError(mp5, "Campo requerido"); } if (mp6.Text == string.Empty) { EP.SetError(mp6, "Campo requerido"); } if (mp7.Text == string.Empty) { EP.SetError(mp7, "Campo requerido"); } if (mp8.Text == string.Empty) { EP.SetError(mp8, "Campo requerido"); } if (mp9.Text == string.Empty) { EP.SetError(mp9, "Campo requerido"); } if (btn_modInven.Text == "Editar") { mp1.ReadOnly = false; mp2.ReadOnly = false; mp3.ReadOnly = false; mp4.ReadOnly = false; mp5.ReadOnly = false; mp6.ReadOnly = false; mp7.ReadOnly = false; mp8.ReadOnly = false; mp9.ReadOnly = false; btn_modInven.Text = "Guardar"; } else { if (crd.modInventario(mp1.Text, mp2.Text, mp3.Text, mp4.Text, mp5.Text, mp6.Text, mp7.Text, mp8.Text, mp9.Text) == 9) { mp1.ReadOnly = true; mp2.ReadOnly = true; mp3.ReadOnly = true; mp4.ReadOnly = true; mp5.ReadOnly = true; mp6.ReadOnly = true; mp7.ReadOnly = true; mp8.ReadOnly = true; mp9.ReadOnly = true; MessageBox.Show("Modificacion realizada con exito"); } btn_modInven.Text = "Editar"; } }