public bool Insertar()
        {
            bool success = false;

            try
            {
                conexion.abrir();
                string sql = "INSERT INTO Empleado VALUES ('" + NombreEm + "','";
                sql += ApellidoPE + "','" + ApellidoME + "','" + Sexo + "'," + Edad.ToString();
                sql += Direccion.ToString() + ")";

                var cmd       = new SqlCommand(sql, conexion.Conectar);
                var resultado = cmd.ExecuteNonQuery();

                if (resultado == 1)
                {
                    success = true;
                }

                conexion.cerrar();
            }
            catch (Exception)
            {
                throw;
            }
            return(success);
        }
示例#2
0
 public override string ToString()
 {
     return("Un mamifero de la especie " + Especie
            + ", que pesa " + Peso.ToString() + " Kg."
            + " y tiene " + Edad.ToString()
            + " años de edad");
 }
示例#3
0
        public override string ToString()
        {
            string Contacto = "Nombre: " + Nombre.ToString() + Environment.NewLine + "Apellido paterno: " + ApellidoPaterno.ToString() + Environment.NewLine + "Apellido materno: " + ApellidoMaterno.ToString() + Environment.NewLine +
                              "Edad: " + Edad.ToString() + Environment.NewLine + "Email: " + Email.ToString() + Environment.NewLine + "Teléfono: " + Telefono.ToString() + Environment.NewLine + "Código " + Codigo.ToString() + Environment.NewLine;



            return(Contacto);
        }
示例#4
0
        public override string ToString()
        {
            string Contacto = "Nombre: " + Nombre.ToString() + Environment.NewLine +
                              "Teléfono: " + Telefono.ToString() + Environment.NewLine +
                              "Email: " + Email.ToString() + Environment.NewLine +
                              "Edad: " + Edad.ToString() + Environment.NewLine +
                              "Codigo: " + Codigo.ToString() + Environment.NewLine;

            return(Contacto);
        }
示例#5
0
        public override string ToString()
        {
            string texto = null;

            texto += "DNI: " + Dni;
            texto += "Nombre: " + Nombre;
            texto += "Apellido: " + Apellido;
            texto += "Password: "******"Edad: " + Edad.ToString();
            texto += "Saldo: " + Saldo.ToString();
            return(texto);
        }
 public string this[int i]
 {
     get
     {
         if (i == 1)
         {
             return((Sexo == 1) ? ("Hombre") : ("Mujer"));
         }
         else
         if (i == 2)
         {
             return(DNI.ToString());
         }
         else
         if (i == 3)
         {
             return(FechaNacimiento.ToShortTimeString());
         }
         else
         if (i == 4)
         {
             return(Edad.ToString());
         }
         return("Indice invalido");
     }
     set
     {
         if (i == 1)
         {
             Sexo = ((Sexo == 1) ? (1) : (2));
         }
         else
         if (i == 2)
         {
             DNI = (Convert.ToInt32(value));
         }
         else
         if (i == 3)
         {
             FechaNacimiento = Convert.ToDateTime(value);
         }
         // no se puede asignar edad. se calcula.
     }
 }
示例#7
0
        private void CMDCAPTURA_Click(object sender, EventArgs e)
        {
            //Programa que captura edades y imprime si es mayor o menor
            //Silva Reyes Luis Adrian 19210549
            //Tarea#31

            //Declaracion de variables
            int C = 0;
            int Edad;



            //Segunda forma
            FRMSEGUNDA Formacaptura = new FRMSEGUNDA();

            //Desactivar boton de captura
            CMDCAPTURA.Enabled = false;

            //Ciclo do while
            do
            {
                if (Formacaptura.ShowDialog() == DialogResult.OK)
                {
                    C = C + 1;

                    Edad = Convert.ToInt32(Formacaptura.TXTEDAD2.Text);
                    Formacaptura.TXTEDAD2.Text = Edad.ToString();


                    if (Edad <= 18)
                    {
                        TXTEDAD.Text = TXTEDAD.Text + " El numero es menor " + Edad + "\r\n";
                    }

                    else
                    {
                        TXTEDAD.Text = TXTEDAD.Text + " El numero es mayor " + Edad + "\r\n";
                    }
                }
            } while (C <= 10);
        }
示例#8
0
 public override string ToString()
 {
     return(Guid.ToString() + "," + Id.ToString() + "," + Nombre + "," + Apellido + "," + Dni + "," + FechaNacimiento.ToString() + "," + Edad.ToString() + "," + FechaRegistro.ToString());
 }
        async void Guardar()
        {
            #region Eleazar

            /*
             * var ssasasa = NivelEscolar;
             * if (string.IsNullOrEmpty(Nombre) || string.IsNullOrEmpty(LeerEscribir) || string.IsNullOrEmpty(RelacionPersona) ||
             *  string.IsNullOrEmpty(Edad) || string.IsNullOrEmpty(Ocupacion) || string.IsNullOrEmpty(CondicionLaboral) ||
             *  string.IsNullOrEmpty(IndiceSeguridad) || string.IsNullOrEmpty(SituacionAutoempleo) || string.IsNullOrEmpty(IndiceInsercionLaboral) ||
             *  string.IsNullOrEmpty(IndiceNivelEducativo) || string.IsNullOrEmpty(NivelEscolar) || string.IsNullOrEmpty(Aseguramiento) ||
             *  string.IsNullOrEmpty(IndiceCiudadaniaSocial) || string.IsNullOrEmpty(ProyectoComunitario) || string.IsNullOrEmpty(Especificar) ||
             *  string.IsNullOrEmpty(IndiceSocialPersona))
             * {
             *  await Application.Current.MainPage.DisplayAlert(
             *      "Error",
             *      "Llene los campos obligatorios",
             *      "aceptar");
             *  return;
             * }
             *
             * if (AllDayChecked == false && CotizaChecked == false && DerechosLaboralesChecked == false && ComoSeguroChecked == false)
             * {
             *  await Application.Current.MainPage.DisplayAlert("Error", "Llene los campos obligatorios", "aceptar");
             *  return;
             * }
             *
             * await Application.Current.MainPage.DisplayAlert(
             *  "Hola",
             *  this.Nombre + " " + this.Edad + " " + this.IndiceCiudadaniaSocial + " " + this.IndiceInsercionLaboral + " "
             + this.IndiceSeguridad + " " + this.IndiceSocialPersona + " " + this.IsToggledDiscapacidad.ToString() + " "
             + this.IsToggledSexo.ToString() + " " + this.ComoSeguroChecked.ToString() + " " +
             +  this.AllDayChecked.ToString() + " " + this.CotizaChecked.ToString() + " " + this.CuarentaHorasChecked.ToString()
             + " " + this._derechosLaboralesChecked.ToString() + " " + RelacionPersona + " " + CondicionLaboral + " " +
             +  SituacionAutoempleo + " " + LeerEscribir + " " + NivelEscolar + " " + ProyectoComunitario,
             +  "Aceptar");
             */
            #endregion

            #region Miranda: Guardar Tabla

            #region Ciclo para Guardar en Persistencia
            if (Application.Current.Properties.ContainsKey("ContadorMiembros"))//verifico cuantos elementos tiene mi lista para saber cual es la psocion del nuevo elemento a agregar
            {
                Elementos = (int.Parse((Application.Current.Properties["ContadorMiembros"]) as string));
            }
            else
            {
                Elementos = 0;
            }

            if (IsToggledDiscapacidad)
            {
                discapacidad = "No";
            }
            else
            {
                discapacidad = "Si";
            }

            Application.Current.Properties["NombreMiembro" + Elementos]    = Nombre.ToString();
            Application.Current.Properties["Parentesco" + Elementos]       = RelacionPersona.ToString();
            Application.Current.Properties["EdadMiembro" + Elementos]      = Edad.ToString();
            Application.Current.Properties["Discapacidad" + Elementos]     = discapacidad.ToString();
            Application.Current.Properties["CondicionLaboral" + Elementos] = CondicionLaboral.ToString();
            Application.Current.Properties["Escolaridad" + Elementos]      = NivelEscolar.ToString();
            Application.Current.Properties["ContadorMiembros"]             = (Elementos + 1).ToString();
            await Application.Current.SavePropertiesAsync();

            #endregion


            int filas;
            filas         = Elementos + 1;
            HeighListView = 44 * filas;//actalizo mi heigh
            await Application.Current.MainPage.DisplayAlert("Notificación", "Usted Tiene hasta Ahora: " + filas + " Parientes Registrados", "Excelente");

            IsEnabled = true;
            Miembros.Add(new Miembro()
            {
                CondicionLaboral    = CondicionLaboral.ToString(),
                DiscapacidadMiembro = discapacidad.ToString(),
                EdadMiembro         = int.Parse(Edad.ToString()),
                Escolaridad         = NivelEscolar.ToString(),
                NombreMiembro       = Nombre.ToString(),
                ParentescoMiembro   = RelacionPersona.ToString(),
            });
            BienestarSocialViewModel.GetInstance().MiembrosBienestar = this.Miembros;      //asigno los datos de mi lista
            BienestarSocialViewModel.GetInstance().HeighListViewB    = this.HeighListView; //actualizo el heigh de mi vista anterior

            await Application.Current.MainPage.Navigation.PopAsync();

            #endregion
        }
示例#10
0
 public string ToFixedSizeString()
 {
     return($"{string.Format("{0,-20}", Nombre)},{string.Format("{0,-20}", Apellido)},{Edad.ToString("000;-000")},{string.Format("{0,-20}", Username)},{string.Format("{0,-20}", Password)}");
 }
示例#11
0
 override public string ToString()
 {
     return(Nombre + " " + Apellidos + " " + Sexo + " " + Edad.ToString() + " " + Carrera);
 }