예제 #1
0
        public virtual void Validar()
        {
            StringBuilder errores = new StringBuilder();

            if (Apellido.Trim().Length == 0)
            {
                errores.AppendLine("Debe ingresar apellido" + Constantes.SaldoLinea);
            }
            if (Nombre.Trim().Length == 0)
            {
                errores.AppendLine("Debe ingresar nombre" + Constantes.SaldoLinea);
            }
            if (LoginUsuario.Trim().Length == 0)
            {
                errores.AppendLine("Debe ingresar login" + Constantes.SaldoLinea);
            }
            if (TipoUsuario == null)
            {
                errores.AppendLine("Debe seleccionar tipo de usuario" + Constantes.SaldoLinea);
            }

            if (errores.Length != 0)
            {
                throw new ApplicationException(errores.ToString());
            }
        }
예제 #2
0
        public void ValidarDatos()
        {
            if (tipoPersona == ' ' ||
                Telefono == 0 ||
                Nombre.Trim() == "" ||
                Apellido.Trim() == "" ||
                dni == "" ||
                Email.Trim() == "" ||
                Password.Trim() == "" ||
                FechaNacimiento == DateTime.MinValue ||
                Sexo == ' '
                )


            {
                throw new DatosObligatoriosExcepcion();
            }
            if (Password.Trim().Equals(Password2.Trim()) == false)
            {
                throw new ExceptionMuestraMensaje("Las contraseñas no coinciden");
            }

            if (!Util.EsEmail(Email))
            {
                throw new EmailExcepcion();
            }

            if (FechaNacimiento > DateTime.Today)
            {
                throw new FechaNacimientoExcepcion();
            }
        }
예제 #3
0
        public void ValidarDatos()
        {
            if (Nombre.Trim() == "" ||
                Apellido.Trim() == "" ||
                Email.Trim() == "" ||
                Password.Trim() == "" ||
                FechaNacimiento == DateTime.MinValue ||
                Sexo == ' ')
            {
                throw new DatosObligatoriosExcepcion();
            }

            if (!Util.EsEmail(Email))
            {
                throw new EmailExcepcion();
            }

            if (FechaNacimiento > DateTime.Today)
            {
                throw new FechaNacimientoExcepcion();
            }
        }
예제 #4
0
        public void Guardar()
        {
            if (AutoGrupo.Trim() == "")
            {
                Helpers.Msg.Error("Campo [ Grupo ] No Puede Estar Vacio");
                return;
            }
            if (Codigo.Trim() == "")
            {
                Helpers.Msg.Error("Campo [ Codigo ] No Puede Estar Vacio");
                return;
            }
            if (Nombre.Trim() == "")
            {
                Helpers.Msg.Error("Campo [ Nombre ] No Puede Estar Vacio");
                return;
            }
            if (Apellido.Trim() == "")
            {
                Helpers.Msg.Error("Campo [ Apellido ] No Puede Estar Vacio");
                return;
            }

            if (Modo == enumModo.Agregar)
            {
                var msg = MessageBox.Show("Guardar Data ?", "*** ALERTA ***", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                if (msg == DialogResult.Yes)
                {
                    var ficha = new OOB.LibSistema.Usuario.Agregar()
                    {
                        autoGrupo = AutoGrupo,
                        codigo    = Codigo,
                        nombre    = Nombre,
                        apellido  = Apellido,
                        clave     = Clave,
                        estatus   = "Activo",
                    };
                    var r01 = Sistema.MyData.Usuario_Agregar(ficha);
                    if (r01.Result == OOB.Enumerados.EnumResult.isError)
                    {
                        Helpers.Msg.Error(r01.Mensaje);
                        return;
                    }
                    _autoItemAgregado = r01.Auto;
                    IsAgregarEditarOk = true;
                }
            }
            if (Modo == enumModo.Editar)
            {
                var msg = MessageBox.Show("Cambiar/Actualizar Data ?", "*** ALERTA ***", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                if (msg == DialogResult.Yes)
                {
                    var ficha = new OOB.LibSistema.Usuario.Editar()
                    {
                        auto      = _ficha.auto,
                        nombre    = Nombre,
                        autoGrupo = AutoGrupo,
                        codigo    = Codigo,
                        apellido  = Apellido,
                        clave     = Clave,
                    };
                    var r01 = Sistema.MyData.Usuario_Editar(ficha);
                    if (r01.Result == OOB.Enumerados.EnumResult.isError)
                    {
                        Helpers.Msg.Error(r01.Mensaje);
                        return;
                    }
                    IsAgregarEditarOk = true;
                }
            }
        }
예제 #5
0
 public override string ToString()
 {
     return(Apellido.Trim() + "," + "DNI:" + DNI.ToString());
 }