private List <Error> ValidarDatos() { try { List <Error> Errores = new List <Error>(); int Aux = 0, ID = 0; if (string.IsNullOrEmpty(this.txtOrden.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese un orden de actividad", ControlSender = this.txtDescripcion }); } else { if (!Validar.IsValidOnlyNumber(this.txtOrden.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese un orden de actividad válido.", ControlSender = this.txtDescripcion }); } } if (string.IsNullOrEmpty(this.txtDescripcion.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese la descripción de actividad", ControlSender = this.txtDescripcion }); } else { if (!Validar.IsValidDescripcion(this.txtDescripcion.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese la descripción de actividad válido.", ControlSender = this.txtDescripcion }); } } if (this.cmbCategoriaCheck.SelectedIndex == -1) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Seleccione una categoria", ControlSender = this.cmbCategoriaCheck }); } else { int.TryParse(this.cmbCategoriaCheck.SelectedValue.ToString(), out ID); if (ID == 0) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Seleccione una categoria.", ControlSender = this.cmbCategoriaCheck }); } } return(Errores); } catch (Exception ex) { throw ex; } }
private List <Error> ValidarDatos() { try { List <Error> Errores = new List <Error>(); int Aux = 0; if (string.IsNullOrEmpty(this.txtDescripcion.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese una opción", ControlSender = this.txtDescripcion }); } if (string.IsNullOrEmpty(this.txtValor.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese un valor", ControlSender = this.txtValor }); } else { if (!Validar.IsValidOnlyNumber(this.txtValor.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese un número de valor válido.", ControlSender = this.txtValor }); } } return(Errores); } catch (Exception ex) { throw ex; } }
private List <Error> ValidarDatos() { try { List <Error> Errores = new List <Error>(); int Aux = 0; if (string.IsNullOrEmpty(this.txtDescripcion.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese la categoria de la actividad", ControlSender = this.txtDescripcion }); } if (string.IsNullOrEmpty(this.txtOrden.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese un ordern de categoria", ControlSender = this.txtOrden }); } else { if (!Validar.IsValidOnlyNumber(this.txtOrden.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese un número de orden válido.", ControlSender = this.txtOrden }); } } return(Errores); } catch (Exception ex) { throw ex; } }
private List <Error> ValidarDatos() { try { List <Error> Errores = new List <Error>(); int Aux = 0; if (string.IsNullOrEmpty(this.txtNombreTurno.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese el turnos correcto.", ControlSender = this.txtNombreTurno }); } else { if (!Validar.IsValidDescripcion(this.txtNombreTurno.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese un turno válida.", ControlSender = this.txtNombreTurno }); } } if (string.IsNullOrEmpty(this.txtToleraciaLlegadaTarde.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese Tolerancia llegar tarde.", ControlSender = this.txtToleraciaLlegadaTarde }); } else { if (!Validar.IsValidOnlyNumber(this.txtToleraciaLlegadaTarde.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese toleracia llegar tarde válida.", ControlSender = this.txtToleraciaLlegadaTarde }); } } if (string.IsNullOrEmpty(this.txtToleranciaLlegadaTemprano.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese Tolerancia llegar temprano.", ControlSender = this.txtToleranciaLlegadaTemprano }); } else { if (!Validar.IsValidOnlyNumber(this.txtToleranciaLlegadaTemprano.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese toleracia llegar temprano válida.", ControlSender = this.txtToleranciaLlegadaTemprano }); } } return(Errores); } catch (Exception ex) { throw ex; } }
private List <Error> ValidarDatos() { try { List <Error> Errores = new List <Error>(); int aux = 0; if (Convert.ToInt32(this.cmbServicio.SelectedIndex.ToString()) == 0 || Convert.ToInt32(this.cmbServicio.SelectedIndex.ToString()) == -1) { Errores.Add(new Error { Numero = (aux += 1), Descripcion = "Seleccionar un Servicio.", ControlSender = this.cmbServicio }); } if (string.IsNullOrEmpty(this.txtDescripcion.Text.Trim())) { Errores.Add(new Error { Numero = (aux += 1), Descripcion = "Ingrese una descripción válida.", ControlSender = this.txtDescripcion }); } else if (!Validar.IsValidDescripcion(this.txtDescripcion.Text)) { Errores.Add(new Error { Numero = (aux += 1), Descripcion = "Ingrese una descripción válida.", ControlSender = this.txtDescripcion }); } if (string.IsNullOrEmpty(this.txtPracticasSugerida.Text.Trim())) { Errores.Add(new Error { Numero = (aux += 1), Descripcion = "Ingrese un numero de practicas", ControlSender = this.txtPracticasSugerida }); } else { if (!Validar.IsValidOnlyNumber(this.txtPracticasSugerida.Text)) { Errores.Add(new Error { Numero = (aux += 1), Descripcion = "Ingrese un numero de practicas válida.", ControlSender = this.txtPracticasSugerida }); } } return(Errores); } catch (Exception ex) { throw ex; } }
private List <Error> ValidarDatos() { try { List <Error> Errores = new List <Error>(); int Aux = 0; if (this.cmbTipoMonedero.SelectedIndex == -1) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Seleccione una opción válida.", ControlSender = this.cmbTipoMonedero }); } else { int IDTipoMonedero = 0; int.TryParse(this.cmbTipoMonedero.SelectedValue.ToString().Trim(), out IDTipoMonedero); if (IDTipoMonedero == 0) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Seleccione una opción válida.", ControlSender = this.cmbTipoMonedero }); } } if (string.IsNullOrEmpty(this.txtFolio.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese un folio válido.", ControlSender = this.txtFolio }); } else if (!Validar.IsValidOnlyNumber(this.txtFolio.Text)) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese un folio válido.", ControlSender = this.txtFolio }); } return(Errores); } catch (Exception ex) { throw ex; } }
private List <Error> ValidarDatos() { try { List <Error> Errores = new List <Error>(); int Aux = 0; CategoriaCheckList TPAux = this.ObtenerItemSeleccionado(); if (TPAux.IDCategoriaChe <= 0) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Seleccione una categoria", ControlSender = this.cmbCategoria }); } if (string.IsNullOrEmpty(this.txtTitulo.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese un título.", ControlSender = this.txtTitulo }); } if (string.IsNullOrEmpty(this.txtOrden.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese un orden.", ControlSender = this.txtTitulo }); } else { if (!Validar.IsValidOnlyNumber(this.txtOrden.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe ingresar numero de orden válido.", ControlSender = this.txtOrden }); } } return(Errores); } catch (Exception ex) { throw ex; } }
private List <Error> ValidarDatos() { try { List <Error> Errores = new List <Error>(); int Aux = 0; //Validar TextBox Cantidad Limite if (string.IsNullOrEmpty(this.txtCantidadLimite.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese la Cantidad Limite.", ControlSender = this.txtCantidadLimite }); } else { if (!Validar.IsValidOnlyNumber(this.txtCantidadLimite.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe ingresar el Cantidad Limite válido.", ControlSender = this.txtCantidadLimite }); } } if (this._DatosVale.RequierePeriodo) { if (this.dtpFechaInicio.Value > this.dtpFechaFin.Value) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "La fecha de inicio no puede ser mayor a la fecha final.", ControlSender = this.dtpFechaInicio }); } } return(Errores); } catch (Exception ex) { throw ex; } }
private List <Error> ValidarDatos() { try { List <Error> Errores = new List <Error>(); int Aux = 0; //Validar Razon Social del Proveedor if (string.IsNullOrEmpty(this.txtRazonSocial.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese la razón social del proveedor.", ControlSender = this.txtRazonSocial }); } else { if (!Validar.IsValidDescripcion(this.txtRazonSocial.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese una razón social válida.", ControlSender = this.txtRazonSocial }); } } //Validar Nombre Comercial del Proveedor if (string.IsNullOrEmpty(this.txtNombreComercial.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese el nombre comercial del proveedor.", ControlSender = this.txtNombreComercial }); } else { if (!Validar.IsValidDescripcion(this.txtNombreComercial.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese un nombre comercial válido.", ControlSender = this.txtNombreComercial }); } } //Validar Regimen Fiscal del Proveedor if (string.IsNullOrEmpty(this.txtRegimenFiscal.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese el regimen fiscal del proveedor.", ControlSender = this.txtRegimenFiscal }); } else { if (!Validar.IsValidDescripcion(this.txtRegimenFiscal.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese un regimen fiscal válido.", ControlSender = this.txtRegimenFiscal }); } } //Validar RFC del Proveedor if (string.IsNullOrEmpty(this.txtRFC.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese el RFC del proveedor.", ControlSender = this.txtRFC }); } else { if (!Validar.IsValidRFC(this.txtRFC.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese un RFC válido.", ControlSender = this.txtRFC }); } } //if (string.IsNullOrEmpty(this.txtRepresentante.Text.Trim())) // Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese el nombre del agente de ventas.", ControlSender = this.txtRepresentante }); //Validar Representante del Proveedor if (!string.IsNullOrEmpty(this.txtRepresentante.Text.Trim())) { if (!Validar.IsValidName(this.txtRepresentante.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese un nombre válido.", ControlSender = this.txtRepresentante }); } } //Validar Correo del Proveedor if (!string.IsNullOrEmpty(this.txtCorreo.Text.Trim())) { if (!Validar.IsValidMail(this.txtCorreo.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese un correo válido.", ControlSender = this.txtCorreo }); } } //Validar Numero Telefono del Proveedor if (!string.IsNullOrEmpty(this.txtTelefono.Text.Trim())) { if (!Validar.IsValidPhoneNumber(this.txtTelefono.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese un número telefónico válido.", ControlSender = this.txtTelefono }); } } //Validar Calle del Proveedor if (!string.IsNullOrEmpty(this.txtCalle.Text.Trim())) { if (!Validar.IsValidDescripcion(this.txtCalle.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese la calle válida.", ControlSender = this.txtCalle }); } } //Validar Colonia del Proveedor if (!string.IsNullOrEmpty(this.txtColonia.Text.Trim())) { if (!Validar.IsValidDescripcion(this.txtColonia.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese la Colonia válida.", ControlSender = this.txtColonia }); } } //Validar Numero de Casa del Proveedor if (!string.IsNullOrEmpty(this.txtNumeroCasa.Text.Trim())) { if (!Validar.IsValidOnlyNumber(this.txtNumeroCasa.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese la Colonia válida.", ControlSender = this.txtNumeroCasa }); } } //Validar Codigo Postal del Proveedor if (!string.IsNullOrEmpty(this.txtCodigoPostal.Text.Trim())) { if (!Validar.IsValidZipCode(this.txtCodigoPostal.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese el código postal válida.", ControlSender = this.txtCodigoPostal }); } } //Validar Combo Pais del Proveedor if (this.cmbPais.SelectedIndex == -1) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe seleccionar el Pais de la lista.", ControlSender = this.cmbPais }); } else { int IDPais = 0; int.TryParse(this.cmbPais.SelectedValue.ToString(), out IDPais); if (IDPais == 0) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe seleccionar el Pais de la lista.", ControlSender = this.cmbPais }); } } //Validar Combo Estados del Proveedor if (this.cmbEstado.SelectedIndex == -1) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe seleccionar el Estado de la lista.", ControlSender = this.cmbEstado }); } else { int IDEstado = 0; int.TryParse(this.cmbEstado.SelectedValue.ToString(), out IDEstado); if (IDEstado == 0) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe seleccionar el Estado de la lista.", ControlSender = this.cmbEstado }); } } //Validar Combo Municipio del Proveedor if (this.cmbMunicipio.SelectedIndex == -1) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe seleccionar el Municipio de la lista.", ControlSender = this.cmbMunicipio }); } else { int IDMunicipio = 0; int.TryParse(this.cmbMunicipio.SelectedValue.ToString(), out IDMunicipio); if (IDMunicipio == 0) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe seleccionar el Municipio de la lista.", ControlSender = this.cmbMunicipio }); } } return(Errores); } catch (Exception ex) { throw ex; } }
private List <Error> ValidarDatos() { try { List <Error> Errores = new List <Error>(); int Aux = 0; if (string.IsNullOrEmpty(this.txtNombreCurso.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe ingresar un nombre del curso.", ControlSender = this.txtNombreCurso }); } if (string.IsNullOrEmpty(this.txtDescripcion.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe ingresar la descripción del curso.", ControlSender = this.txtDescripcion }); } if (string.IsNullOrEmpty(this.txtObejetivoGeneral.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe ingresar el Objetivo General.", ControlSender = this.txtObejetivoGeneral }); } if (string.IsNullOrEmpty(this.txtCalicacionMinAprovatoria.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe ingresar un dato válido para <<Calificación Aprobatoria>>.", ControlSender = this.txtCalicacionMinAprovatoria }); } else { if (!Validar.IsValidDecimal(this.txtCalicacionMinAprovatoria.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe ingresar un dato válido para <<Calificación Aprobatoria>>.", ControlSender = this.txtCalicacionMinAprovatoria }); } } if (string.IsNullOrEmpty(this.txtHoras.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe ingresar un dato válido para <<Hora>>.", ControlSender = this.txtHoras }); } else { if (!Validar.IsValidOnlyNumber(this.txtHoras.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe ingresar un dato válido para <<Hora>>.", ControlSender = this.txtHoras }); } } if (this.dgvTemasCursos.Rows.Count == 0) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe de seleccionar al menos un tema del curso", ControlSender = this.btnAgregarTemaCurso }); } return(Errores); } catch (Exception ex) { throw ex; } }
private List <Error> ValidarDatos() { try { List <Error> Errores = new List <Error>(); int Aux = 0; //Validar TextBox Nombre del Vale if (string.IsNullOrEmpty(this.txtNombreVale.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese el Nombre del Vale.", ControlSender = this.txtNombreVale }); } if (this.cmbTipoVale.SelectedIndex == -1) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Seleccione una opción en Tipo de Vales.", ControlSender = this.cmbTipoVale }); } else { TipoVales TVale = (TipoVales)this.cmbTipoVale.SelectedItem; if (TVale.IDTipoVale != 0) { //Validar Datos del PanelPorcentajePorDia if (TVale.Porcentaje) { if (string.IsNullOrEmpty(this.txtPrcentajeDia.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese el Porcentaje de descuento.", ControlSender = this.txtPrcentajeDia }); } else { decimal Porcentaje = this.ObtenerPorcentaje(); if (Porcentaje <= 0) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "El porcentaje de descuento debe ser mayor a 0%.", ControlSender = this.txtPrcentajeDia }); } else if (Porcentaje > 100) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "El porcentaje de descuento no puede ser mayor a 100%.", ControlSender = this.txtPrcentajeDia }); } } if (this.dgvProductosXVale.Rows.Count == 0) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe de ingresar al menos un producto al vale.", ControlSender = this.dgvProductosXVale }); } } //Validar Datos del PanelMontoEfectivo if (TVale.Monto) { if (string.IsNullOrEmpty(this.txtMontoEfectivo.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese el Monto en Efectivo.", ControlSender = this.txtMontoEfectivo }); } else { decimal Monto = this.ObtenerMontoDescuento(); if (Monto <= 0) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "El monto de descuento debe ser mayor a $ 0.00.", ControlSender = this.txtMontoEfectivo }); } } if (this.dgvProductosXVale.Rows.Count == 0) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe de ingresar al menos un producto al vale.", ControlSender = this.dgvProductosXVale }); } } //Validar Datos del PanelNxN if (TVale.NxN) { if (string.IsNullOrEmpty(ProductoN.IDProducto)) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Seleccione el producto requerido para la promoción.", ControlSender = this.btnElegirProdServNXN }); } if (string.IsNullOrEmpty(this.txtCantidadRequeridadNxN.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese la Cantidad Requerida en N x N.", ControlSender = this.PanelNxN }); } if (string.IsNullOrEmpty(this.txtCantidadGratisNxN.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese la Cantidad Gratis en N x N.", ControlSender = this.PanelNxN }); } if (!string.IsNullOrEmpty(this.txtCantidadRequeridadNxN.Text.Trim()) && !string.IsNullOrEmpty(this.txtCantidadGratisNxN.Text.Trim())) { int CantidadReq = 0, CantidadGratis = 0; CantidadReq = this.ObtenerCantidad(this.txtCantidadRequeridadNxN); CantidadGratis = this.ObtenerCantidad(this.txtCantidadGratisNxN); if (CantidadReq <= 0) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Cantidad Requerida debe ser mayor a 0", ControlSender = this.txtCantidadRequeridadNxN }); } if (CantidadGratis <= 0) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Cantidad Gratis debe ser mayor a 0.", ControlSender = this.txtCantidadGratisNxN }); } if (CantidadReq > 0 && CantidadGratis > 0) { if (CantidadGratis >= CantidadReq) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Cantidad Gratis debe ser menor a la cantidad requerida.", ControlSender = this.txtCantidadGratisNxN }); } } } } //Validar Datos del PanelMxN if (TVale.NxM) { if (string.IsNullOrEmpty(ProductoM.IDProducto)) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Seleccione el producto requerido para la promoción.", ControlSender = this.btnElegirProdServM }); } if (string.IsNullOrEmpty(ProductoN.IDProducto)) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Seleccione el producto gratis para la promoción.", ControlSender = this.btnElegirProdServN }); } if (string.IsNullOrEmpty(this.txtCantidadRequeridadMxN.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese la Cantidad Requerida en M x N.", ControlSender = this.PanelMxN }); } if (string.IsNullOrEmpty(this.txtCantidadGratisMxN.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese la Cantidad Gratis en M x N.", ControlSender = this.PanelMxN }); } if (!string.IsNullOrEmpty(this.txtCantidadRequeridadMxN.Text.Trim()) && !string.IsNullOrEmpty(this.txtCantidadGratisMxN.Text.Trim())) { int CantidadReq2 = 0, CantidadGratis2 = 0; CantidadReq2 = this.ObtenerCantidad(this.txtCantidadRequeridadMxN); CantidadGratis2 = this.ObtenerCantidad(this.txtCantidadGratisMxN); if (CantidadReq2 <= 0) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Cantidad Requerida debe ser mayor a 0", ControlSender = this.txtCantidadRequeridadMxN }); } if (CantidadGratis2 <= 0) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Cantidad Gratis debe ser mayor a 0.", ControlSender = this.txtCantidadGratisMxN }); } if (CantidadReq2 > 0 && CantidadGratis2 > 0) { if (CantidadGratis2 >= CantidadReq2) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Cantidad Gratis debe ser menor a la cantidad requerida.", ControlSender = this.txtCantidadGratisMxN }); } } } } } else { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Seleccione una opción en Tipo Vale.", ControlSender = this.cmbTipoVale }); } } //Validar TextBox Cantidad Limite if (string.IsNullOrEmpty(this.txtCantidadLimite.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese la Cantidad Limite.", ControlSender = this.txtCantidadLimite }); } else { if (!Validar.IsValidOnlyNumber(this.txtCantidadLimite.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe ingresar el Cantidad Limite válido.", ControlSender = this.txtCantidadLimite }); } } //Validar RadioButton Para Seleccionar if (!this.radioBntRangoFechas.Checked && !this.radioBtnDiasSemanas.Checked) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe seleccionar Rango de Fecha ó Dias de la Semana", ControlSender = this.PanelDiasSemanas }); } //Validar RadioButton Fecha Inicio y Fecha Fin if (this.radioBntRangoFechas.Checked) { if (this.dtpFechaInicio.Value > this.dtpFechaFin.Value) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "La Fecha Final debe ser mayor a la Fecha Inicial", ControlSender = this.PanelRangoFechas }); } if (this.dtpFechaInicio.Value < DateTime.Today) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "La Fechas deben ser mayores a la Fecha Actual.", ControlSender = this.PanelRangoFechas }); } } //Validar RadioButton Para Seleccionar Dias de las Semana if (this.radioBtnDiasSemanas.Checked) { if (!this.chkAplicaLunes.Checked && !this.chkAplicaMartes.Checked && !this.chkAplicaMiercoles.Checked && !this.chkAplicaJueves.Checked && !this.chkAplicaViernes.Checked && !this.chkAplicaSabado.Checked && !this.chkAplicaDomingo.Checked) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe seleccionar al menos un Día de la Semana", ControlSender = this.PanelDiasSemanas }); } } return(Errores); } catch (Exception ex) { throw ex; } }
private List <Error> ValidarDatos() { try { List <Error> Errores = new List <Error>(); int Aux = 0, ID = 0; if (string.IsNullOrEmpty(this.txtNombre.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe ingresar un nombre del usuario.", ControlSender = this.txtNombre }); } else { if (!Validar.IsValidName(this.txtNombre.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe ingresar un nombre del usuario válido.", ControlSender = this.txtNombre }); } } if (string.IsNullOrEmpty(this.txtApellidoPat.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe ingresar el apellido paterno del usuario.", ControlSender = this.txtApellidoPat }); } else { if (!Validar.IsValidName(this.txtApellidoPat.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe ingresar un apellido paterno del usuario válido.", ControlSender = this.txtApellidoPat }); } } if (string.IsNullOrEmpty(this.txtApellidoMat.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe ingresar el apellido materno del usuario.", ControlSender = this.txtApellidoMat }); } else { if (!Validar.IsValidName(this.txtApellidoMat.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe ingresar un apellido materno del usuario válido.", ControlSender = this.txtApellidoMat }); } } //Validar Combo Tipo Usuario if (this.cmbTipoUsuario.SelectedIndex == -1) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Seleccione una opción en Tipo de Usuario", ControlSender = this.cmbTipoUsuario }); } else { int.TryParse(this.cmbTipoUsuario.SelectedValue.ToString(), out ID); if (ID == 0) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Seleccione una opción en Tipo de Usuario.", ControlSender = this.cmbTipoUsuario }); } } //Validar Combo Puestos if (this.cmbCatPuesto.SelectedIndex == -1) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Seleccione una opción en Puesto", ControlSender = this.cmbCatPuesto }); } else { int.TryParse(this.cmbCatPuesto.SelectedValue.ToString(), out ID); if (ID == 0) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Seleccione una opción en Puesto.", ControlSender = this.cmbCatPuesto }); } } //Validar Combo Categorias if (this.cmbCategoriaPuesto.SelectedIndex == -1) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Seleccione una opción en Categoría del puesto", ControlSender = this.cmbCategoriaPuesto }); } else { CategoriasPuesto AuxCat = (CategoriasPuesto)this.cmbCategoriaPuesto.SelectedItem; if (string.IsNullOrEmpty(AuxCat.IDCategoria.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Seleccione una opción en Categoría del puesto", ControlSender = this.cmbCategoriaPuesto }); } } if (!string.IsNullOrEmpty(this.txtCalle.Text.Trim())) { if (!Validar.IsValidDescripcion(this.txtCalle.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe ingresar un dato válido para <<Calle>>.", ControlSender = this.txtCalle }); } } if (!string.IsNullOrEmpty(this.txtColonia.Text.Trim())) { if (!Validar.IsValidDescripcion(this.txtColonia.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe ingresar un dato válido para <<Colonia>>.", ControlSender = this.txtColonia }); } } if (!string.IsNullOrEmpty(this.txtNumero.Text.Trim())) { if (!Validar.IsValidOnlyNumber(this.txtNumero.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe ingresar un dato válido para <<Número>>.", ControlSender = this.txtNumero }); } } if (this.dgvSucursal.SelectedRows.Count != 1) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Seleccione la sucursal actual del usuario.", ControlSender = this.txtNumero }); } return(Errores); } catch (Exception ex) { throw ex; } }
private List <Error> ValidarDatos() { try { List <Error> Errores = new List <Error>(); int Aux = 0; if (string.IsNullOrEmpty(this.txtRazonSocial.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese la razón social.", ControlSender = this.txtRazonSocial }); } if (string.IsNullOrEmpty(txtNombreComercial.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese el nombre comercial.", ControlSender = this.txtNombreComercial }); } if (string.IsNullOrEmpty(txtRFC.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese el RFC.", ControlSender = this.txtRFC }); } else { if (!Validar.IsValidRFC(this.txtRFC.Text)) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese un RFC válido.", ControlSender = this.txtRFC }); } } if (string.IsNullOrEmpty(this.txtPorcentajeIva.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese el porcentaje de IVA.", ControlSender = this.txtPorcentajeIva }); } if (string.IsNullOrEmpty(this.txtPagoDiasFestivos.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese el porcentaje de pagos dias festivos.", ControlSender = this.txtPagoDiasFestivos }); } if (string.IsNullOrEmpty(this.txtPagoDiasVaciones.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese el porcentaje de pagos dias vacaciones.", ControlSender = this.txtPagoDiasVaciones }); } if (string.IsNullOrEmpty(this.txtPagosDiaDomingo.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese el porcentaje de pago dias domingo.", ControlSender = this.txtPagosDiaDomingo }); } if (string.IsNullOrEmpty(txtFaltasRetrasos.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese un numero dia válido", ControlSender = this.txtFaltasRetrasos }); } else { if (!Validar.IsValidOnlyNumber(this.txtFaltasRetrasos.Text)) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese un numero dia válido.", ControlSender = this.txtFaltasRetrasos }); } } if (string.IsNullOrEmpty(this.txtPorcDesc.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese el porcentaje de descuento por cumpleaños.", ControlSender = this.txtPorcDesc }); } else { decimal Porc = 0; if (!decimal.TryParse(this.txtPorcDesc.Text.Trim(), out Porc)) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese un dato válido para porcentaje de descuento por cumpleaños.", ControlSender = this.txtPorcDesc }); } } return(Errores); } catch (Exception ex) { throw ex; } }