Beispiel #1
0
 private List <Error> ValidarDatos()
 {
     try
     {
         List <Error> ListaErrores = new List <Error>();
         int          Aux          = 0;
         if (string.IsNullOrEmpty(this.txtNombreCaja.Text.Trim()))
         {
             ListaErrores.Add(new Error {
                 Numero = (Aux += 1), Descripcion = "Debe ingresar el nombre de la caja.", ControlSender = this.txtNombreCaja
             });
         }
         else
         {
             if (!Validar.IsValidDescripcion(this.txtNombreCaja.Text.Trim()))
             {
                 ListaErrores.Add(new Error {
                     Numero = (Aux += 1), Descripcion = "Debe ingresar un nombre valido de caja.", ControlSender = this.txtNombreCaja
                 });
             }
         }
         return(ListaErrores);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #2
0
 private List <Error> ValidarDatos()
 {
     try
     {
         List <Error> Errores = new List <Error>();
         int          Aux     = 0;
         if (string.IsNullOrEmpty(this.txtNombreTema.Text.Trim()))
         {
             Errores.Add(new Error {
                 Numero = (Aux += 1), Descripcion = "Ingrese el Nombre del Tema.", ControlSender = this.txtNombreTema
             });
         }
         else
         {
             if (!Validar.IsValidDescripcion(this.txtNombreTema.Text.Trim()))
             {
                 Errores.Add(new Error {
                     Numero = (Aux += 1), Descripcion = "Ingrese el Nombre del Tema válida.", ControlSender = this.txtNombreTema
                 });
             }
         }
         if (this.dgvSubTemas.Rows.Count == 0)
         {
             Errores.Add(new Error {
                 Numero = (Aux += 1), Descripcion = "Debe de ingresar al menos un subtema para el tema", ControlSender = this.btnAgregarSubTema
             });
         }
         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 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
             });
         }
         return(Errores);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #4
0
 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 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 (this.ObtenerPuntosMinimos() < 0)
         {
             Errores.Add(new Error {
                 Numero = (aux += 1), Descripcion = "La cantidad de puntos mínimos no debe ser menor a 0.", ControlSender = this.txtPuntosMinimos
             });
         }
         return(Errores);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 private List <Error> ValidarDatos()
 {
     try
     {
         List <Error> ListaErrores = new List <Error>();
         int          Aux          = 0;
         if (string.IsNullOrEmpty(this.txtMontoRetiro.Text.Trim()))
         {
             ListaErrores.Add(new Error {
                 Numero = (Aux += 1), Descripcion = "Ingrese un monto", ControlSender = this.txtMontoRetiro
             });
         }
         if (string.IsNullOrEmpty(this.txtConcepto.Text.Trim()))
         {
             ListaErrores.Add(new Error {
                 Numero = (Aux += 1), Descripcion = "Debe ingresar el concepto del movimiento.", ControlSender = this.txtConcepto
             });
         }
         else
         {
             if (!Validar.IsValidDescripcion(this.txtConcepto.Text.Trim()))
             {
                 ListaErrores.Add(new Error {
                     Numero = (Aux += 1), Descripcion = "Debe ingresar un concepto de movimiento válido.", ControlSender = this.txtConcepto
                 });
             }
         }
         return(ListaErrores);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #6
0
        private List <Error> ValidarDatos()
        {
            try
            {
                List <Error> Errores = new List <Error>();
                int          Aux     = 0;
                if (string.IsNullOrEmpty(this.txtNombrePuesto.Text.Trim()))
                {
                    Errores.Add(new Error {
                        Numero = (Aux += 1), Descripcion = "Ingrese el Nombre del Tema.", ControlSender = this.txtNombrePuesto
                    });
                }
                else
                {
                    if (!Validar.IsValidDescripcion(this.txtNombrePuesto.Text.Trim()))
                    {
                        Errores.Add(new Error {
                            Numero = (Aux += 1), Descripcion = "Ingrese el Nombre del Tema válida.", ControlSender = this.txtNombrePuesto
                        });
                    }
                }
                if (this.dgvSubPuesto.Rows.Count == 0)
                {
                    Errores.Add(new Error {
                        Numero = (Aux += 1), Descripcion = "Al menos tiene que tener un subpuesto.", ControlSender = this.dgvSubPuesto
                    });
                }

                return(Errores);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #7
0
        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 void btnBuscar_Click(object sender, EventArgs e)
 {
     try
     {
         if (!string.IsNullOrEmpty(this.txtBusqueda.Text.Trim()))
         {
             if (Validar.IsValidDescripcion(txtBusqueda.Text.Trim()))
             {
                 this.BusquedaTarjeta(this.txtBusqueda.Text.Trim());
             }
             else
             {
                 this.txtBusqueda.Text = string.Empty;
             }
         }
         else
         {
             this.LlenarGridCatProductos(false);
         }
     }
     catch (Exception ex)
     {
         LogError.AddExcFileTxt(ex, "frmCatTarjetas ~ btnBuscar_Click");
         MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Beispiel #9
0
 private List <Error> ValidarDatos()
 {
     try
     {
         List <Error> Errores = new List <Error>();
         int          Aux     = 0;
         //Validar Razon Social del Proveedor
         if (string.IsNullOrEmpty(this.txtDescripcion.Text.Trim()))
         {
             Errores.Add(new Error {
                 Numero = (Aux += 1), Descripcion = "Ingrese un nombre válido.", ControlSender = this.txtDescripcion
             });
         }
         else
         {
             if (!Validar.IsValidDescripcion(this.txtDescripcion.Text.Trim()))
             {
                 Errores.Add(new Error {
                     Numero = (Aux += 1), Descripcion = "Ingrese un nombre válido", ControlSender = this.txtDescripcion
                 });
             }
         }
         if (this.dtpFecha.Value < DateTime.Today)
         {
             Errores.Add(new Error {
                 Numero = (Aux += 1), Descripcion = "La fecha no puede ser menor a la fecha actual.", ControlSender = this.dtpFecha
             });
         }
         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.cmbRubro.SelectedIndex == -1)
                {
                    Errores.Add(new Error {
                        Numero = (Aux += 1), Descripcion = "Seleccione una opción válida.", ControlSender = this.cmbRubro
                    });
                }
                else
                {
                    int IDTipoMonedero = 0;
                    int.TryParse(this.cmbRubro.SelectedValue.ToString().Trim(), out IDTipoMonedero);
                    if (IDTipoMonedero == 0)
                    {
                        Errores.Add(new Error {
                            Numero = (Aux += 1), Descripcion = "Seleccione una opción válida.", ControlSender = this.cmbRubro
                        });
                    }
                }
                if (string.IsNullOrEmpty(this.txtSubRubro.Text.Trim()))
                {
                    Errores.Add(new Error {
                        Numero = (Aux += 1), Descripcion = "Ingrese un SubRubro Valido.", ControlSender = this.txtSubRubro
                    });
                }
                else
                if (!Validar.IsValidDescripcion(this.txtSubRubro.Text))
                {
                    Errores.Add(new Error {
                        Numero = (Aux += 1), Descripcion = "Ingrese un SubRubro Valido.", ControlSender = this.txtSubRubro
                    });
                }

                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.txtClave.Text.Trim()))
         //    Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Ingrese una clave o código de barra", ControlSender = this.txtClave });
         if (this.cmbTipoMobiliario.SelectedIndex == 0 || this.cmbTipoMobiliario.SelectedIndex == -1)
         {
             Errores.Add(new Error {
                 Numero = (Aux += 1), Descripcion = "Selecciones un tipo de mobiliario", ControlSender = this.cmbTipoMobiliario
             });
         }
         if (string.IsNullOrEmpty(this.txtDescripcion.Text.Trim()))
         {
             Errores.Add(new Error {
                 Numero = (Aux += 1), Descripcion = "Ingrese una descripción", ControlSender = this.txtDescripcion
             });
         }
         else
         {
             if (!Validar.IsValidDescripcion(this.txtDescripcion.Text.Trim()))
             {
                 Errores.Add(new Error {
                     Numero = (Aux += 1), Descripcion = "Ingrese una descripción válida.", ControlSender = this.txtDescripcion
                 });
             }
         }
         if (this.dgvProveedor.Rows.Count == 0)
         {
             Errores.Add(new Error {
                 Numero = (Aux += 1), Descripcion = "Al menos se tiene que ingresar un proveedor.", ControlSender = this.dgvProveedor
             });
         }
         return(Errores);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #14
0
 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 = "Debe ingresar la razón social de la empresa.", ControlSender = this.txtRazonSocial
             });
         }
         else
         {
             if (!Validar.IsValidDescripcion(this.txtRazonSocial.Text.Trim()))
             {
                 Errores.Add(new Error {
                     Numero = (Aux += 1), Descripcion = "Debe ingresar una razón social válida.", ControlSender = this.txtRazonSocial
                 });
             }
         }
         if (string.IsNullOrEmpty(this.txtSucursal.Text.Trim()))
         {
             Errores.Add(new Error {
                 Numero = (Aux += 1), Descripcion = "Debe ingresar un nombre de sucursal.", ControlSender = this.txtSucursal
             });
         }
         else
         {
             if (!Validar.IsValidDescripcion(this.txtSucursal.Text.Trim()))
             {
                 Errores.Add(new Error {
                     Numero = (Aux += 1), Descripcion = "Debe ingresar una nombre de sucursal válido.", ControlSender = this.txtSucursal
                 });
             }
         }
         if (string.IsNullOrEmpty(this.txtUsuario.Text.Trim()))
         {
             Errores.Add(new Error {
                 Numero = (Aux += 1), Descripcion = "Debe ingresar un nombre de usuario.", ControlSender = this.txtUsuario
             });
         }
         else
         {
             if (!Validar.IsValidUserName(this.txtUsuario.Text.Trim()))
             {
                 Errores.Add(new Error {
                     Numero = (Aux += 1), Descripcion = "Debe ingresar un nombre deusuario válido.", ControlSender = this.txtUsuario
                 });
             }
         }
         if (string.IsNullOrEmpty(this.txtPassword.Text.Trim()))
         {
             Errores.Add(new Error {
                 Numero = (Aux += 1), Descripcion = "Debe ingresar una contraseña.", ControlSender = this.txtPassword
             });
         }
         else
         {
             if (!Validar.IsValidPassword(this.txtPassword.Text.Trim()))
             {
                 Errores.Add(new Error {
                     Numero = (Aux += 1), Descripcion = "Debe ingresar una contraseña válida: Debe contener al menos una letra mayúscula, una letra minúscula, un número o caracter especial, y mínimo 8 caracteres de longitud.", ControlSender = this.txtPassword
                 });
             }
         }
         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.txtTagImagen.Text))
         {
             Errores.Add(new Error {
                 Numero = (Aux += 1), Descripcion = "Ingrese el nombre de la imagen.", ControlSender = this.txtTagImagen
             });
         }
         else
         {
             if (!Validar.IsValidName(this.txtTagImagen.Text.Trim()))
             {
                 Errores.Add(new Error {
                     Numero = (Aux += 1), Descripcion = "Ingrese el nombre de la imagen válido.", ControlSender = this.txtTagImagen
                 });
             }
         }
         if (string.IsNullOrEmpty(this.txtAlt.Text))
         {
             Errores.Add(new Error {
                 Numero = (Aux += 1), Descripcion = "Ingrese la etiqueta Alt.", ControlSender = this.txtAlt
             });
         }
         else
         {
             if (!Validar.IsValidDescripcion(this.txtAlt.Text.Trim()))
             {
                 Errores.Add(new Error {
                     Numero = (Aux += 1), Descripcion = "Ingrese la etiqueta Alt válido.", ControlSender = this.txtAlt
                 });
             }
         }
         if (string.IsNullOrEmpty(this.txtTitle.Text))
         {
             Errores.Add(new Error {
                 Numero = (Aux += 1), Descripcion = "Ingrese la etiqueta Title.", ControlSender = this.txtTitle
             });
         }
         else
         {
             if (!Validar.IsValidDescripcion(this.txtTitle.Text.Trim()))
             {
                 Errores.Add(new Error {
                     Numero = (Aux += 1), Descripcion = "Ingrese la etiqueta Title válido.", ControlSender = this.txtTitle
                 });
             }
         }
         if (string.IsNullOrEmpty(this.txtNombreImagen.Text))
         {
             Errores.Add(new Error {
                 Numero = (Aux += 1), Descripcion = "Ingrese el nombre de la imagen web.", ControlSender = this.txtNombreImagen
             });
         }
         else
         {
             if (!Validar.IsValidDescripcion(this.txtNombreImagen.Text.Trim()))
             {
                 Errores.Add(new Error {
                     Numero = (Aux += 1), Descripcion = "Ingrese el nombre de la imagen web válido.", ControlSender = this.txtNombreImagen
                 });
             }
         }
         if (this.pbImagen.Image == null)
         {
             Errores.Add(new Error {
                 Numero = (Aux += 1), Descripcion = "Seleccione una imagen.", ControlSender = this.pbImagen
             });
         }
         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.txtLugarCurso.Text.Trim()))
                {
                    Errores.Add(new Error {
                        Numero = (Aux += 1), Descripcion = "Ingrese el lugar de la capacitación del curso.", ControlSender = this.txtLugarCurso
                    });
                }
                else
                {
                    if (!Validar.IsValidDescripcion(this.txtLugarCurso.Text.Trim()))
                    {
                        Errores.Add(new Error {
                            Numero = (Aux += 1), Descripcion = "Ingrese el lugar de la capacitación del curso válido.", ControlSender = this.txtLugarCurso
                        });
                    }
                }
                if (this.cmbCursos.SelectedIndex == -1)
                {
                    Errores.Add(new Error {
                        Numero = (Aux += 1), Descripcion = "Seleccione un curso", ControlSender = this.cmbCursos
                    });
                }
                else
                {
                    Curso CursoAux = (Curso)this.cmbCursos.SelectedItem;
                    if (string.IsNullOrEmpty(CursoAux.IDCurso))
                    {
                        Errores.Add(new Error {
                            Numero = (Aux += 1), Descripcion = "Seleccione un curso.", ControlSender = this.cmbCursos
                        });
                    }
                }
                if (this.cmbInstructor.SelectedIndex == -1)
                {
                    Errores.Add(new Error {
                        Numero = (Aux += 1), Descripcion = "Seleccione un instructor del curso", ControlSender = this.cmbInstructor
                    });
                }
                else
                {
                    Instructor IntructorAux = (Instructor)this.cmbInstructor.SelectedItem;
                    if (string.IsNullOrEmpty(IntructorAux.IDInstructor))
                    {
                        Errores.Add(new Error {
                            Numero = (Aux += 1), Descripcion = "Seleccione un instructor del curso.", ControlSender = this.cmbInstructor
                        });
                    }
                }
                if (this.dtpFechaInicioCurso.Value < DateTime.Today)
                {
                    Errores.Add(new Error {
                        Numero = (Aux += 1), Descripcion = "La fecha tiene que ser mayor o igual a la fecha actual", ControlSender = this.dtpFechaInicioCurso
                    });
                }
                if (this.dtpFechaInicioCurso.Value > this.dtpFechaFinCurso.Value)
                {
                    Errores.Add(new Error {
                        Numero = (Aux += 1), Descripcion = "La fecha tiene que ser mayor a la actual", ControlSender = this.dtpFechaFinCurso
                    });
                }

                return(Errores);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #18
0
        private List <Error> ValidarDatos()
        {
            try
            {
                List <Error> Errores = new List <Error>();
                int          Aux     = 0;
                if (string.IsNullOrEmpty(this.txtNombreSucursal.Text.Trim()))
                {
                    Errores.Add(new Error {
                        Numero = (Aux += 1), Descripcion = "Ingrese el nombre de la sucursal.", ControlSender = this.txtNombreSucursal
                    });
                }
                else
                {
                    if (!Validar.IsValidDescripcion(this.txtNombreSucursal.Text.Trim()))
                    {
                        Errores.Add(new Error {
                            Numero = (Aux += 1), Descripcion = "Ingrese un nombre de sucursal válido.", ControlSender = this.txtNombreSucursal
                        });
                    }
                }
                if (this.cmbEmpresa.SelectedIndex == -1)
                {
                    Errores.Add(new Error {
                        Numero = (Aux += 1), Descripcion = "Debe seleccionar la empresa de la lista.", ControlSender = this.cmbEmpresa
                    });
                }
                else
                {
                    int IDEmpresa = 0;
                    int.TryParse(this.cmbEmpresa.SelectedValue.ToString(), out IDEmpresa);
                    if (IDEmpresa == 0)
                    {
                        Errores.Add(new Error {
                            Numero = (Aux += 1), Descripcion = "Debe seleccionar la empresa de la lista.", ControlSender = this.cmbEmpresa
                        });
                    }
                }
                if (this.cmbTipoSucursal.SelectedIndex == -1)
                {
                    Errores.Add(new Error {
                        Numero = (Aux += 1), Descripcion = "Debe seleccionar el tipo de sucursal de la lista.", ControlSender = this.cmbTipoSucursal
                    });
                }
                else
                {
                    int IDTipoSucursal = 0;
                    int.TryParse(this.cmbTipoSucursal.SelectedValue.ToString(), out IDTipoSucursal);
                    if (IDTipoSucursal == 0)
                    {
                        Errores.Add(new Error {
                            Numero = (Aux += 1), Descripcion = "Debe seleccionar el tipo de sucursal de la lista.", ControlSender = this.cmbTipoSucursal
                        });
                    }
                }
                if (this.cmbPais.SelectedIndex == -1)
                {
                    Errores.Add(new Error {
                        Numero = (Aux += 1), Descripcion = "Debe seleccionar un país 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 un país de la lista.", ControlSender = this.cmbPais
                        });
                    }
                }
                if (this.cmbEstado.SelectedIndex == -1)
                {
                    Errores.Add(new Error {
                        Numero = (Aux += 1), Descripcion = "Debe seleccionar un 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 un estado de la lista.", ControlSender = this.cmbEstado
                        });
                    }
                }
                if (this.cmbMunicipio.SelectedIndex == -1)
                {
                    Errores.Add(new Error {
                        Numero = (Aux += 1), Descripcion = "Debe seleccionar un 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 un municipio de la lista.", ControlSender = this.cmbMunicipio
                        });
                    }
                }
                if (!string.IsNullOrEmpty(this.txtCodigoPostal.Text.Trim()))
                {
                    if (!Validar.IsValidZipCode(this.txtCodigoPostal.Text.Trim()))
                    {
                        Errores.Add(new Error {
                            Numero = (Aux += 1), Descripcion = "Ingrese un código postal válido.", ControlSender = this.txtCodigoPostal
                        });
                    }
                }

                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
                        });
                    }
                }
                if (!string.IsNullOrEmpty(this.txtDireccion.Text.Trim()))
                {
                    if (!Validar.IsValidDescripcion(this.txtDireccion.Text.Trim()))
                    {
                        Errores.Add(new Error {
                            Numero = (Aux += 1), Descripcion = "Ingrese una dirección válida.", ControlSender = this.txtDireccion
                        });
                    }
                }

                if (!ValidarHorario())
                {
                    Errores.Add(new Error {
                        Numero = (Aux += 1), Descripcion = "Seleccione al menos un horario.", ControlSender = this.txtDireccion
                    });
                }


                if (string.IsNullOrEmpty(this.txtRFC.Text.Trim()))
                {
                    Errores.Add(new Error {
                        Numero = (Aux += 1), Descripcion = "Ingrese el RFC.", 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 representante.", ControlSender = this.txtRepresentante
                    });
                }
                else
                {
                    if (!Validar.IsValidName(this.txtRepresentante.Text.Trim()))
                    {
                        Errores.Add(new Error {
                            Numero = (Aux += 1), Descripcion = "Ingrese un nombre de representate válido.", ControlSender = this.txtRepresentante
                        });
                    }
                }

                if (string.IsNullOrEmpty(this.txtRegimenFiscal.Text.Trim()))
                {
                    Errores.Add(new Error {
                        Numero = (Aux += 1), Descripcion = "Ingrese el régimen fiscal.", ControlSender = this.txtRegimenFiscal
                    });
                }
                else
                {
                    if (!Validar.IsValidName(this.txtRegimenFiscal.Text.Trim()))
                    {
                        Errores.Add(new Error {
                            Numero = (Aux += 1), Descripcion = "Ingrese un régimen fiscal válido.", ControlSender = this.txtRegimenFiscal
                        });
                    }
                }

                return(Errores);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #19
0
 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;
     }
 }
Beispiel #20
0
        private List <Error> ValidarDatos()
        {
            try
            {
                List <Error> Errores = new List <Error>();
                int          Aux = 0, ID = 0;
                //Validar Razon Social del Proveedor
                if (string.IsNullOrEmpty(this.txtNombre.Text.Trim()))
                {
                    Errores.Add(new Error {
                        Numero = (Aux += 1), Descripcion = "Ingrese el nombre del instructor.", ControlSender = this.txtNombre
                    });
                }
                else
                {
                    if (!Validar.IsValidDescripcion(this.txtNombre.Text.Trim()))
                    {
                        Errores.Add(new Error {
                            Numero = (Aux += 1), Descripcion = "Ingrese un nombre del instructor válido.", ControlSender = this.txtNombre
                        });
                    }
                }
                //Validar Nombre Comercial del Proveedor
                if (string.IsNullOrEmpty(this.txtApellidoPat.Text.Trim()))
                {
                    Errores.Add(new Error {
                        Numero = (Aux += 1), Descripcion = "Ingrese el apellido paterno.", ControlSender = this.txtApellidoPat
                    });
                }
                else
                {
                    if (!Validar.IsValidDescripcion(this.txtApellidoPat.Text.Trim()))
                    {
                        Errores.Add(new Error {
                            Numero = (Aux += 1), Descripcion = "Ingrese el apellido paterno válido.", ControlSender = this.txtApellidoPat
                        });
                    }
                }
                //Validar Regimen Fiscal del Proveedor
                if (string.IsNullOrEmpty(this.txtApellidoMat.Text.Trim()))
                {
                    Errores.Add(new Error {
                        Numero = (Aux += 1), Descripcion = "Ingrese el apellido materno.", ControlSender = this.txtApellidoMat
                    });
                }
                else
                {
                    if (!Validar.IsValidDescripcion(this.txtApellidoMat.Text.Trim()))
                    {
                        Errores.Add(new Error {
                            Numero = (Aux += 1), Descripcion = "Ingrese el apellido materno válido.", ControlSender = this.txtApellidoMat
                        });
                    }
                }

                //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
                        });
                    }
                }
                if (this.cmbGenero.SelectedIndex == -1)
                {
                    Errores.Add(new Error {
                        Numero = (Aux += 1), Descripcion = "Seleccione una opción del genero", ControlSender = this.cmbGenero
                    });
                }
                else
                {
                    int.TryParse(this.cmbGenero.SelectedValue.ToString(), out ID);
                    if (ID == 0)
                    {
                        Errores.Add(new Error {
                            Numero = (Aux += 1), Descripcion = "Seleccione una opción de genero.", ControlSender = this.cmbGenero
                        });
                    }
                }
                if (this.dtpFechaNac.Value > DateTime.Today.AddYears(-15))
                {
                    Errores.Add(new Error {
                        Numero = (Aux += 1), Descripcion = "Ingrese una fecha de nacimiento válida.", ControlSender = this.dtpFechaNac
                    });
                }
                return(Errores);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }