Esempio n. 1
0
 public bool CoincideCon(Persona modelo)
 {
     if (modelo.DNI != 0 && modelo.DNI != DNI)
     {
         return(false);
     }
     if (!string.IsNullOrWhiteSpace(modelo.Apellido) && !Apellido.Equals(modelo.Apellido, StringComparison.CurrentCultureIgnoreCase))
     {
         return(false);
     }
     if (!string.IsNullOrWhiteSpace(modelo.Nombre) && !Nombre.Equals(modelo.Nombre, StringComparison.CurrentCultureIgnoreCase))
     {
         return(false);
     }
     if (!string.IsNullOrWhiteSpace(modelo.Direccion) && !Direccion.Equals(modelo.Direccion, StringComparison.CurrentCultureIgnoreCase))
     {
         return(false);
     }
     if (!string.IsNullOrWhiteSpace(modelo.Telefono) && !Telefono.Equals(modelo.Telefono, StringComparison.CurrentCultureIgnoreCase))
     {
         return(false);
     }
     if (modelo.FechaDeNacimiento != DateTime.MinValue && FechaDeNacimiento != modelo.FechaDeNacimiento)
     {
         return(false);
     }
     return(true);
 }
Esempio n. 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();
            }
        }
Esempio n. 3
0
        public bool Crear()
        {
            OdbcConnection  oConnection = this.OpenConnection();
            OdbcDataAdapter myConsulta;
            DataTable       dt = new DataTable();

            myConsulta = new OdbcDataAdapter("SELECT Nombre, Apellido FROM Personas WHERE dni = " + int.Parse(strDocumento), oConnection);
            myConsulta.Fill(dt);
            if (dt.Rows.Count > 0)
            {
                return(false);
            }

            String strSQL = "Insert into Personas (Nombre, Apellido, ";

            strSQL = strSQL + "EstadoCivil, Tipodni, DNI, Calle, Nro, Dpto, Piso, Barrio, CP, idLocalidad, idProvincia) ";
            strSQL = strSQL + " values ('" + Nombre + "','" + Apellido.Replace("'", "''") + "',";

            strSQL = strSQL + intEstadoCivil + "," + intTipoDocumento + ",'" + strDocumento;
            strSQL = strSQL + "','" + strCalle + "','" + strNro + "','" + strDpto + "','" + strPiso + "','" + strBarrio + "','" + strCP + "'," + intLocalidad.ToString() + "," + intProvincia.ToString() + ")";

            try
            {
                OdbcCommand myCommand = new OdbcCommand(strSQL, oConnection);
                myCommand.ExecuteNonQuery();

                oConnection.Close();
            }
            catch (Exception e)
            {
                string p = e.Message;
                return(false);
            }
            return(true);
        }
Esempio n. 4
0
        protected async override Task OnAppearingAnimationEnd()
        {
            var translateLength = 400u;

            await Task.WhenAll(
                Nombre.TranslateTo(0, 0, easing: Easing.SpringOut, length: translateLength),
                Apellido.FadeTo(1));

            await Task.WhenAll(
                UsernameEntry.TranslateTo(0, 0, easing: Easing.SpringOut, length: translateLength),
                UsernameEntry.FadeTo(1),
                Profesion.TranslateTo(0, 0, easing: Easing.SpringOut, length: translateLength),
                Profesion.FadeTo(1),

                (new Func <Task>(async() =>
            {
                await Task.Delay(200);
                await Task.WhenAll(
                    PasswordEntry.TranslateTo(0, 0, easing: Easing.SpringOut, length: translateLength),
                    PasswordEntry.FadeTo(1));
            }))());


            await Task.WhenAll(
                LoginButton.ScaleTo(1),
                LoginButton.FadeTo(1));
        }
Esempio n. 5
0
        protected async override Task OnDisappearingAnimationBegin()
        {
            var taskSource = new TaskCompletionSource <bool>();

            var currentHeight = FrameContainer.Height;

            await Task.WhenAll(
                UsernameEntry.FadeTo(0),
                PasswordEntry.FadeTo(0),
                LoginButton.FadeTo(0),
                Nombre.FadeTo(0),
                Apellido.FadeTo(0));

            OctocatImage.Source = "Verified.png";


            FrameContainer.Animate("HideAnimation", d =>
            {
                FrameContainer.HeightRequest = d;
            },
                                   start: currentHeight,
                                   end: 170,
                                   finished: async(d, b) =>
            {
                await Task.Delay(300);
                taskSource.TrySetResult(true);
            });


            await taskSource.Task;
        }
 public Socio(EntidadId id, NroSocio nroSocio, Nombre nombre, Apellido apellido, Estado activo) : base(id)
 {
     NroSocio = nroSocio;
     Nombre   = nombre;
     Apellido = apellido;
     Activo   = activo;
 }
Esempio n. 7
0
 public bool CoincideCon(Persona modelo)
 {
     // IF SON TODOS LOS CASOS QUE NO COINCIDEN EL ORIGINAL CON EL MODELO
     // si el dni el modelo de Persona  es diferente a 0 y es diferente al dni persona(original)
     if (modelo.DNI != 0 && modelo.DNI != DNI)
     {
         return(false);
     }
     if (!string.IsNullOrWhiteSpace(modelo.Apellido) && !Apellido.Equals(modelo.Apellido, StringComparison.CurrentCultureIgnoreCase))
     {
         return(false);
     }
     if (!string.IsNullOrWhiteSpace(modelo.Nombre) && !Nombre.Equals(modelo.Nombre, StringComparison.CurrentCultureIgnoreCase))
     {
         return(false);
     }
     if (!string.IsNullOrWhiteSpace(modelo.Direccion) && !Direccion.Equals(modelo.Direccion, StringComparison.CurrentCultureIgnoreCase))
     {
         return(false);
     }
     if (!string.IsNullOrWhiteSpace(modelo.Telefono) && !Telefono.Equals(modelo.Telefono, StringComparison.CurrentCultureIgnoreCase))
     {
         return(false);
     }
     if (modelo.FechaDeNacimiento != DateTime.MinValue && FechaDeNacimiento != modelo.FechaDeNacimiento)
     {
         return(false);
     }
     return(true);
 }
 public void Guardar()
 {
     try
     {
         if (!_vista.DatosAutorControl.Valido)
         {
             throw new DatosAutorInvalidosException(_vista.DatosAutorControl);
         }
         var nro      = _vista.Nro;
         var nombre   = _vista.Nombre;
         var apellido = _vista.Apellido;
         var autor    = new Autor(
             numero: NroAutor.Of(nro),
             nombre: Nombre.Of(nombre),
             apellido: Apellido.Of(apellido)
             );
         if (_servicio.VerificarDuplicados(autor))
         {
             throw new AutorDuplicadoException(autor);
         }
         _servicio.Guardar(autor);
         MostrarAutores();
     }
     catch (Exception e)
     {
         MostrarMensaje(e.Message);
     }
 }
Esempio n. 9
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());
            }
        }
Esempio n. 10
0
        public void Guardar()
        {
            try
            {
                if (!_vista.DatosSocioControl.Valido)
                {
                    throw new DatosSocioInvalidosException(_vista.DatosSocioControl);
                }

                var nro      = NroSocio.Of(_vista.NroSocio);
                var nombre   = Nombre.Of(_vista.Nombre);
                var apellido = Apellido.Of(_vista.Apellido);
                var activo   = Estado.Of(_vista.Activo);
                var socio    = new Socio(
                    nroSocio: nro,
                    nombre: nombre,
                    apellido: apellido,
                    activo: activo
                    );
                if (_servicio.VerificarDuplicados(socio))
                {
                    throw new SocioDuplicadoException(socio);
                }

                _servicio.Guardar(socio);
                MostrarSocios();
            }
            catch (Exception e)
            {
                MostrarMensaje(e);
            }
        }
Esempio n. 11
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (Nombre.Text == "")
            {
                Nombre.Focus();
                MessageBox.Show("este campo esta vacio");
            }
            else if (Apellido.Text == "")

            {
                Apellido.Focus();
                MessageBox.Show("este campo esta vacio");
            }
            else if (Documento.Text == "")
            {
                Documento.Focus();
                MessageBox.Show("este campo esta vacio");
            }
            else if (Fecha_nacimiento.Text == "")
            {
                Fecha_nacimiento.Focus();
                MessageBox.Show("este campo esta vacio");
            }

            else
            {
            }
        }
        public void crearSocio()
        {
            var socio = new Socio(new NroSocio(1), new Nombre("Lisandro"), new Apellido("Martinez"));

            socio.NroSocio.Should().Be(NroSocio.Of(1));
            socio.Nombre.Should().Be(Nombre.Of("Lisandro"));
            socio.Apellido.Should().Be(Apellido.Of("Martinez"));
        }
Esempio n. 13
0
        public virtual string Listar()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(" " + Apellido.ToString());
            sb.AppendLine(", " + Nombre.ToString());

            //  sb.AppendLine(Responsable.ToString());
            return(sb.ToString());
        }
Esempio n. 14
0
        public virtual string MostrarPersona()
        {
            StringBuilder mensaje = new StringBuilder();

            mensaje.Append(" " + Apellido.ToString());
            mensaje.AppendLine(", " + Nombre.ToString());
            mensaje.AppendLine(", " + Dni.ToString());

            return(mensaje.ToString());
        }
Esempio n. 15
0
 private void button1_Click(object sender, EventArgs e)
 {
     cadena("Insert into usuarios(cedula,nombre,apellido,direccion,telefono,fecha) values('" + Cedula.Text + "','" + Nombre.Text + "','" + Apellido.Text + "','" + Direccion.Text + "','" + Telefono.Text + "','" + fecha.Text + "')");
     MessageBox.Show("Guardado");
     Nombre.Clear();
     Apellido.Clear();
     Cedula.Clear();
     Direccion.Clear();
     Telefono.Clear();
     cargar_datos();
 }
 private void Cancel_Click(object sender, RoutedEventArgs e)
 {
     Nombre.Clear();
     Apellido.Clear();
     Masculino.IsChecked          = false;
     Femenino.IsChecked           = false;
     FechaNacimiento.SelectedDate = null;
     Telefono.Clear();
     Email.Clear();
     Posicion.SelectedIndex = -1;
     Dorsal.Clear();
 }
        public RegisterView()
        {
            InitializeComponent();
            NavigationPage.SetHasBackButton(this, false);
            CC.ReturnCommand       = new Command(() => Nombre.Focus());
            Nombre.ReturnCommand   = new Command(() => Apellido.Focus());
            Apellido.ReturnCommand = new Command(() => typeUser.Focus());

            btnLogin.Clicked += (sender, e) => {
                ((NavigationPage)this.Parent).PushAsync(new LoginView());
            };
        }
        private Autor CrearAutorDesdeFila(DataRow fila)
        {
            var id       = fila["autor_id"] as int? ?? 0;
            var numero   = fila["nro_autor"] as int? ?? 0;
            var nombre   = fila["nombre"] as string;
            var apellido = fila["apellido"] as string;

            return(new Autor(
                       id: EntidadId.Of(id),
                       numero: NroAutor.Of(numero),
                       nombre: Nombre.Of(nombre),
                       apellido: Apellido.Of(apellido)
                       ));
        }
Esempio n. 19
0
 //Vacía los valores ingresados en los textBox y setea en "Vacío" los comboBox
 private void btnLimpiar_Click(object sender, EventArgs e)
 {
     Nombre.ResetText();
     Apellido.ResetText();
     TipoId.SelectedItem = "Vacío";
     nroId.ResetText();
     Mail.ResetText();
     Telefono.ResetText();
     Calle.ResetText();
     NroCalle.ResetText();
     cbPaises.SelectedItem = "Vacío";
     Localidad.ResetText();
     Nacionalidad.ResetText();
     FechaNacimiento.ResetText();
 }
        private Socio SocioDesdeFila(DataRow fila)
        {
            int    id       = fila["socio_id"] as int? ?? 0;
            int    nroSocio = fila["nro_socio"] as int? ?? 0;
            string nombre   = fila["nombre"] as string;
            string apellido = fila["apellido"] as string;
            bool   activo   = fila["activo"] as bool? ?? true;

            return(new Socio(
                       id: EntidadId.Of(id),
                       nroSocio: NroSocio.Of(nroSocio),
                       nombre: Nombre.Of(nombre),
                       apellido: Apellido.Of(apellido),
                       activo: Estado.Of(activo)
                       ));
        }
        public void cargarDatos()
        {
            Random aleatorio = new Random();

            nombre   = (Nombre)aleatorio.Next(0, 4);
            apellido = (Apellido)aleatorio.Next(0, 4);
            DateTime start = new DateTime(1995, 1, 1);
            int      range = ((TimeSpan)(DateTime.Today - start)).Days;

            fechNac     = start.AddDays(aleatorio.Next(range));
            civil       = (Estado)aleatorio.Next(0, 2);
            sexo        = (Genero)aleatorio.Next(0, 2);
            fechIngreso = start.AddDays(aleatorio.Next(range));
            sueldoB     = aleatorio.Next(0, 5000);
            cargo       = (Trabajo)aleatorio.Next(0, 5);
            antiguedad  = DateTime.Today.AddTicks(-fechIngreso.Ticks).Year;
            edad        = DateTime.Today.AddTicks(-fechNac.Ticks).Year - 1;
            switch (sexo)
            {
            case 0: jub = DateTime.Today.AddTicks(-fechNac.Ticks).Year - 60; break;

            case (Genero)1:  jub = DateTime.Today.AddTicks(-fechNac.Ticks).Year - 65; break;
            }
            //CALCULO EL SALARIO
            double adicional;

            if (antiguedad < 21)
            {
                adicional = ((sueldoB * 0.02) * (antiguedad));
                switch (cargo)
                {
                case (Trabajo)2:
                case (Trabajo)3: adicional = +(adicional * 0.5); break;
                    //default:;break;
                }
                switch (civil)
                {
                case (Estado)0: adicional = +50000; break;
                }
                salario = sueldoB + adicional;
            }
            else
            {
                adicional = (sueldoB * 0.25);
                salario   = adicional + sueldoB;
            }
        }
Esempio n. 22
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (Apellido.Length != 0)
            {
                hash ^= Apellido.GetHashCode();
            }
            if (Edad.Length != 0)
            {
                hash ^= Edad.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Esempio n. 23
0
        // GotFocus y LostFocus para los WaterMakers de los TextBox

        private void comprobarFocus()
        {
            if (!string.IsNullOrEmpty(Nombre.Text))
            {
                NombreWM.Visibility = System.Windows.Visibility.Collapsed;
                Nombre.Visibility   = System.Windows.Visibility.Visible;
                Nombre.Focus();
            }
            if (!string.IsNullOrEmpty(Apellido.Text))
            {
                ApellidoWM.Visibility = System.Windows.Visibility.Collapsed;
                Apellido.Visibility   = System.Windows.Visibility.Visible;
                Apellido.Focus();
            }
            if (!string.IsNullOrEmpty(Telefono1.Text))
            {
                Telefono1WM.Visibility = System.Windows.Visibility.Collapsed;
                Telefono1.Visibility   = System.Windows.Visibility.Visible;
                Telefono1.Focus();
            }
            if (!string.IsNullOrEmpty(Telefono2.Text))
            {
                Telefono2WM.Visibility = System.Windows.Visibility.Collapsed;
                Telefono2.Visibility   = System.Windows.Visibility.Visible;
                Telefono2.Focus();
            }
            if (!string.IsNullOrEmpty(Direccion.Text))
            {
                DireccionWM.Visibility = System.Windows.Visibility.Collapsed;
                Direccion.Visibility   = System.Windows.Visibility.Visible;
                Direccion.Focus();
            }
            if (!string.IsNullOrEmpty(email.Text))
            {
                emailWM.Visibility = System.Windows.Visibility.Collapsed;
                email.Visibility   = System.Windows.Visibility.Visible;
                email.Focus();
            }
        }
Esempio n. 24
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();
            }
        }
Esempio n. 25
0
        public void ListarEstudiantes(int line)
        {
            int posX = 0;

            Console.SetCursorPosition(posX, line);
            Console.Write(ID);
            int idL = (12 - ID.ToString().Length);

            posX += (idL + ID.ToString().Length);
            Console.SetCursorPosition(posX, line);
            Console.Write("|" + Nombre + " " + Apellido);
            int nL = (35 - (Nombre.ToString().Length + Apellido.ToString().Length));

            posX += (nL + Nombre.Length + Apellido.Length);
            Console.SetCursorPosition(posX, line);
            Console.Write("|" + Estatus);
            int esL = (22 - Estatus.Length);

            posX += esL + Estatus.Length;
            Console.SetCursorPosition(posX, line);
            Console.Write("|" + Carrera);
            int cLL = 30 - Carrera.Length;

            posX += cLL + Carrera.Length;
            Console.SetCursorPosition(posX, line);
            Console.Write("|" + Cedula);
            int cL = 36 - Cedula.Length;

            posX += cL + Cedula.Length;
            Console.SetCursorPosition(posX, line);
            Console.Write("|" + Nacionalidad);
            int naL = 25 - Nacionalidad.Length;

            posX += naL + Nacionalidad.Length - 1;

            Console.SetCursorPosition(posX, line);
            Console.Write("|{0}/{1}/{2}", Nacimiento.Day, Nacimiento.Month, Nacimiento.Year);
        }
Esempio n. 26
0
 // public string DocumentoInstructor,Nombre1,Apellido1,Direccion1,Telefono1,Celular1,Profesion1,Estado1;
 public void  MetodoInstructor(string DocumentoInstructor)
 {
     try
     {
         ConnectionBD  Puente;
         SqlCommand    Comando;
         SqlDataReader Lector;
         Puente  = new ConnectionBD();
         Comando = new SqlCommand("select * from Instructor where DocumentoInstructor='" + DocumentoInstructor + "'", Puente.RetornarConnexion());
         Lector  = Comando.ExecuteReader();
         while (Lector.Read())
         {
             Nombre    = Lector.GetString(1);
             Apellido  = Lector.GetString(2);
             Direccion = Lector.GetString(3);
             Telefono  = Lector.GetString(4);
             Celular   = Lector.GetString(5);
             Profesion = Lector.GetString(6);
             Estado    = Lector.GetString(7);
         }
         Nombre.ToString();
         Apellido.ToString();
         Direccion.ToString();
         Telefono.ToString();
         Celular.ToString();
         Profesion.ToString();
         Estado.ToString();
         Lector.Close();
         Comando.Dispose();
         Puente.CerrarConnexion();
     }
     catch (Exception ex)
     {
         MessageBox.Show("El Instructor no existe");
     }
 }
Esempio n. 27
0
 public override string ToString()
 {
     return(Apellido.ToString() + ", " + Nombre.ToString());
 }
Esempio n. 28
0
 private void ApellidoWM_GotFocus(object sender, RoutedEventArgs e)
 {
     ApellidoWM.Visibility = System.Windows.Visibility.Collapsed;
     Apellido.Visibility   = System.Windows.Visibility.Visible;
     Apellido.Focus();
 }
Esempio n. 29
0
 public string Descripcion()
 {
     return($"DNI: {DNI} - {Apellido.ToCamelCase()}, {Nombre.ToCamelCase()} - Categoría: {Categoria()}");
 }
Esempio n. 30
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;
                }
            }
        }