public void MostrarDatos() { Console.WriteLine($"Nombre: {Nombre}"); Console.WriteLine($"Telefono: {Numero}"); Console.WriteLine($"Fecha Nacimiento: {FechaNacimiento.ToString("dd/MM/yyyy")}"); Console.WriteLine($"Tipo: {Tipo}"); }
async void FechaNacimiento_Tapped(object sender, System.EventArgs e) { #if __IOS__ DependencyService.Get <IForceKeyboardDismissalService>().DismissKeyboard(); #endif var result = await UserDialogs.Instance.DatePromptAsync(new DatePromptConfig { IsCancellable = true, CancelText = "CANCELAR", }); if (result.Ok) { FechaNacimiento.Text = String.Format("{0:dd/MM/yyyy}", result.SelectedDate); FechaNacimiento.Unfocus(); DependencyService.Get <IForceKeyboardDismissalService>().DismissKeyboard(); } else { FechaNacimiento.Unfocus(); DependencyService.Get <IForceKeyboardDismissalService>().DismissKeyboard(); } }
public int InsertarAsegurado() { int result = 0; List <string> valores = new List <string>(); valores.Add(NumeroIdentificacion); valores.Add("'" + Apellidos + "'"); valores.Add("'" + Nombres + "'"); valores.Add("'" + Sexo + "'"); // En la tabla la posición para EstadoCivil permite null valores.Add("''"); valores.Add("'" + FechaNacimiento.ToString() + "'"); valores.Add(Ocupacion.ToString()); valores.Add(Departamento.ToString()); valores.Add(Ciudad.ToString()); valores.Add("'" + Direccion + "'"); valores.Add("'" + Telefono1 + "'"); valores.Add("'" + Telefono2 + "'"); valores.Add("'" + Celular + "'"); valores.Add("'" + CorreoElectronico + "'"); // En la tabla la posición para Usuario, Password, Habeas Data (solo numericos) permiten null valores.Add("''"); valores.Add("''"); valores.Add("1"); result = entidades.Insertar("Tercero", valores); return(result); }
public override string ToString() { return(Cedula.ToString() + "\t" + Nombre + "\t" + FechaNacimiento.ToShortDateString() + "\t" + Sexo.ToString() + "\t" + Telefono.ToString() + "\t" + Correo + "\t" + Direccion + "\t" + EstadoCivil.ToString() + "\t" + IdVendedor.ToString() + "\t" + FechaIngreso.ToShortDateString() + "\t" + Salario.ToString() + "\t" + Profesion + "\t" + Calificacion.ToString()); }
//public string List() //{ // string todos = ""; // foreach (Vendedor vendedor in ListaVendedor) // { // todos += vendedor.ToString(); // } // return todos; //} /// <summary> /// Muestra los datos de un vendedor /// </summary> public void Show() { Console.WriteLine(Cedula.ToString().PadRight(12) + Nombre.PadRight(35) + FechaNacimiento.ToShortDateString().PadLeft(12) + Sexo.ToString().PadRight(12).PadLeft(15) + Telefono.ToString().PadLeft(12).PadRight(15) + Correo.PadRight(40) + Direccion.PadRight(40) + EstadoCivil.ToString().PadRight(12) + IdVendedor.ToString().PadLeft(5) + FechaIngreso.ToShortDateString().PadLeft(12) + Salario.ToString().PadLeft(10) + Profesion.PadLeft(20).PadRight(17) + Calificacion.ToString().PadLeft(5)); }
public void Ejercicio1() { Nombre = "Juan"; Apellido = "Perez"; Apodo = "Pepito"; FechaNacimiento = Convert.ToDateTime("01/01/2000"); Telefono = "809-555-5555"; Movil = "829-444-4444"; Pais = "República Dominicana"; Ciudad = "Santo Domingo"; Direccion = "Mirador Sur"; LugarTrabajo = "Junta Central Electoral"; Sueldo = 80000.00; Console.WriteLine("===============>> INFORMACIÓN PERSONAL <<==============="); Console.WriteLine("NOMBRE: " + Nombre); Console.WriteLine("APELLIDO: " + Apellido); Console.WriteLine("APODO: " + Apodo); Console.WriteLine("FECHA DE NACIMIENTO: " + FechaNacimiento.ToString("dd/MM/yyyy")); Console.WriteLine("TELEFONO: " + Telefono); Console.WriteLine("MOVIL: " + Movil); Console.WriteLine("PAIS: " + Pais); Console.WriteLine("CIUDAD: " + Ciudad); Console.WriteLine("DIRECCION: " + Direccion); Console.WriteLine("LUGAR DE TRABAJO: " + LugarTrabajo); Console.WriteLine("SUELDO: " + Sueldo); }
public override string ToString() { return("Datos profesor:\n" + "Nombre: " + Nombre + "\n" + "Apellidos: " + Apellidos + "\n" + "Fecha nacimiento: " + FechaNacimiento.ToString() + "\n" + "Referencia: " + Referencia + "\n" + "Asignatura: " + Asignatura + "\n"); }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { if (FechaNacimiento.AddYears(18) > DateTime.Now) { yield return(new ValidationResult( $"La persona debe ser mayor a 18 años.", new[] { "FechaNacimiento" })); } }
public override string ToString() { string sep = " ; "; return(Codigo.ToString().PadLeft(15) + sep + Nombre.PadLeft(15) + sep + Apellidos.PadLeft(15) + sep + FechaNacimiento.ToShortDateString().PadLeft(15) + sep + SueldoAnual.ToString().PadLeft(10)); }
private void Save() { System.IO.StreamWriter writer = new System.IO.StreamWriter("Files/Cliente.txt", true); writer.WriteLine(Cedula.ToString() + "," + Nombre + "," + FechaNacimiento.ToShortDateString() + "," + Sexo.ToString() + "," + Telefono.ToString() + "," + Correo + "," + Direccion + "," + EstadoCivil.ToString() + "," + IdCliente.ToString()); writer.Close(); }
public override string ToString() { return("Datos alumno:\n" + "Nombre: " + Nombre + "\n" + "Apellidos: " + Apellidos + "\n" + "Fecha nacimiento: " + FechaNacimiento.ToString() + "\n" + "Referencia: " + Referencia + "\n" + "Lista asignaturas:\n" + string.Join("\n", ListaAsignaturas.Select((asig) => "- " + asig)) + "\n" + "Aula: " + Aula + "\n"); }
private void Save() { System.IO.StreamWriter writer = new System.IO.StreamWriter("Files/Vendedor.txt", true); writer.WriteLine(Cedula.ToString() + "," + Nombre + "," + FechaNacimiento.ToShortDateString() + "," + Sexo.ToString() + "," + Telefono.ToString() + "," + Correo + "," + Direccion + "," + EstadoCivil.ToString() + "," + IdVendedor.ToString() + "," + FechaIngreso.ToShortDateString() + "," + Salario.ToString() + "," + Profesion + "," + Calificacion.ToString()); writer.Close(); }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { if (DateTime.Now < FechaNacimiento.AddYears(16).Date) { yield return (new ValidationResult(errorMessage: "La persona debe tener más de 16 años", memberNames: new[] { "FechaNacimiento" })); } if (IdTipoIdentificacion == 1) { var cad = Identificacion.ToString(); var total = 0; var longitud = cad.Length; var longcheck = longitud - 1; if (cad != "" && longitud == 10) { for (int i = 0; i < longcheck; i++) { if (i % 2 == 0) { var aux = int.Parse(cad.Substring(i, 1)) * 2; if (aux > 9) { aux -= 9; } total += aux; } else { total += int.Parse(cad.Substring(i, 1)); // parseInt o concatenará en lugar de sumar } } total = total % 10; total = 10 - total; if (int.Parse(cad.Substring(longitud - 1, 1)) != total) { yield return (new ValidationResult(errorMessage: "La cédula no es válida", memberNames: new[] { "Identificacion" })); } } else { yield return (new ValidationResult(errorMessage: "La cédula no es válida", memberNames: new[] { "Identificacion" })); } } }
public int CalcularEdad() { int edad = 0; edad = (DateTime.Now.Year - FechaNacimiento.Year); if (DateTime.Today < FechaNacimiento.AddYears(edad)) { edad--; } return(edad); }
public StringBuilder MostrarDatos() { StringBuilder datos = new StringBuilder(); datos.AppendLine(string.Format("Rut funcionario: {0}", Rut)); datos.AppendLine(string.Format("Edad funcionario: {0}", Edad)); datos.AppendLine(string.Format("Genero funcionario: {0}", Enum_Genero)); datos.AppendLine(string.Format("Nacimiento funcionario: {0}", FechaNacimiento.ToString("dd/MM/yyyy"))); datos.AppendLine(string.Format("Rut funcionario: {0}", Enum_Tipo_Funcionario)); datos.AppendLine(string.Format("Nombre Jefe: {0}", Jefatura.NombreJefe)); return(datos); }
//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(); }
public override bool Equals(object obj) { //Log.Debug("Entra Equals"); var persona = obj as Persona; //Log.Debug("Sale Equals"); return(persona != null && Id == persona.Id && Nombre == persona.Nombre && Apellidos == persona.Apellidos && Dni == persona.Dni && FechaNacimiento.ToString() == persona.FechaNacimiento.ToString() && Edad == persona.Edad && FechaHora.ToString() == persona.FechaHora.ToString() && Guid == persona.Guid); }
public override int GetHashCode() { var hashCode = 292974432; hashCode = hashCode * -1521134295 + Id.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Nombre); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Apellido); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Dni); hashCode = hashCode * -1521134295 + FechaNacimiento.GetHashCode(); hashCode = hashCode * -1521134295 + Edad.GetHashCode(); hashCode = hashCode * -1521134295 + FechaActual.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(GuidNum); return(hashCode); }
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. } }
public override int GetHashCode() { //Log.Debug("Entra GetHashCode"); var hashCode = 292974432; hashCode = hashCode * -1521134295 + Id.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Nombre); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Apellidos); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Dni); hashCode = hashCode * -1521134295 + FechaNacimiento.GetHashCode(); hashCode = hashCode * -1521134295 + Edad.GetHashCode(); hashCode = hashCode * -1521134295 + FechaHora.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Guid); //Log.Debug("Sale GetHashCode"); return(hashCode); }
public override int GetHashCode() { var hashCode = 1497137188; hashCode = hashCode * -1521134295 + idAlumno.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(nombre); hashCode = hashCode * -1521134295 + IdAlumno.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Nombre); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Apellido); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Dni); hashCode = hashCode * -1521134295 + FechaNacimiento.GetHashCode(); hashCode = hashCode * -1521134295 + Edad.GetHashCode(); hashCode = hashCode * -1521134295 + HoraRegistro.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(SavedFormat); hashCode = hashCode * -1521134295 + EqualityComparer <Guid> .Default.GetHashCode(Student_Guid); return(hashCode); }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { if (DateTime.Now < FechaNacimiento.AddYears(16).Date) { yield return (new ValidationResult(errorMessage: "La persona debe tener más de 16 años", memberNames: new[] { "FechaNacimiento" })); } if (IdTipoIdentificacion == 1) { var cad = Identificacion.ToString(); var longitud = cad.Length; var longcheck = longitud - 1; if (cad != "" && longitud != 10) { yield return (new ValidationResult(errorMessage: "La cédula no es válida", memberNames: new[] { "Identificacion" })); } } }
private void btnLimpiar_Click(object sender, RoutedEventArgs e) { txtId.Text = string.Empty; txtNombres.Text = string.Empty; txtApellidos.Text = string.Empty; txtCedula.Text = string.Empty; txtDireccion.Text = string.Empty; txtTelefono.Text = string.Empty; if (FechaNacimiento.GetType() == typeof(DatePicker)) { var datePicker = (DatePicker)FechaNacimiento; datePicker.SelectedDate = DateTime.Now.Date; } if (FechaIncorporacion.GetType() == typeof(DatePicker)) { var datePicker = (DatePicker)FechaIncorporacion; datePicker.SelectedDate = DateTime.Now.Date; } txtSueldo.Text = string.Empty; imgPhoto.Source = null; }
/// <summary> /// deberia haber un metodo tostring para txt, json y este ser usado para escribir en los archivos de distinto formato /// </summary> /// <returns></returns> public override string ToString() { return(Id.ToString() + "," + Nombre + "," + Apellidos + "," + Dni + "," + FechaNacimiento.ToString("dd/MM/yyyy") + "," + Edad + "," + Guid); }
public override int GetHashCode() { return(Id.GetHashCode() & ApYNom.GetHashCode() & EstaEliminado.GetHashCode() & Dni.GetHashCode() & Dni.GetHashCode() & FechaNacimiento.GetHashCode() & Telefono.GetHashCode() & Celular.GetHashCode() & Legajo.GetHashCode() & FechaIncio.GetHashCode() & CategoriaId.GetHashCode() & CUIT.GetHashCode()); }
// override object.GetHashCode public override int GetHashCode() { return(Id.GetHashCode() * 17 + Nombre.GetHashCode() + Apellidos.GetHashCode() + Dni.GetHashCode() + Guid.GetHashCode() + FechaNacimiento.GetHashCode()); }
private string GetLine() { return($"{IdVendedor},{Cedula},{Nombre},{FechaNacimiento.ToShortDateString()},{Sexo},{Telefono},{Correo},{Direccion}," + $"{EstadoCivil},{FechaIngreso.ToShortDateString()},{Salario},{Profesion},{Calificacion}"); }
} //Constructor vacio para poder Registrar usuarios preguntandole datos public bool Registrarse() { do { //EMAIL Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("(Paso 1 de 5) Primero, necesito tu Email:"); Console.ForegroundColor = ConsoleColor.White; Email = IntroducirTextoYComprobarLongitud(100); Email.ToLower(); if (Email.Contains("@") && (Email.Contains(".com") || Email.Contains(".es"))) //comprobación basica para saber si es un email { string query = $"SELECT * FROM Usuarios WHERE Email LIKE '{Email}'"; if (!ConsultarBase(query)) //si no existe, se puede registrar { //NOMBRE Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("(Paso 2 de 5) Segundo, introduce tu Nombre"); Console.ForegroundColor = ConsoleColor.White; Nombre = IntroducirTextoYComprobarLongitud(25); //APELLIDO Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("(Paso 3 de 5) Tercero, introduce tu apellido"); Console.ForegroundColor = ConsoleColor.White; Apellido = IntroducirTextoYComprobarLongitud(25); //FECHA NACIMIENTO Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("(Paso 4 de 5) Cuarto, introduce tu fecha de nacimiento (con este formato: dd/MM/aaaa)"); Console.ForegroundColor = ConsoleColor.White; bool fechaCorrecta = false; do { FechaNacimiento = IntroducirTextoYComprobarLongitud(10); if (FechaNacimiento.Contains("/") || FechaNacimiento.Contains("-")) { try { DateTime tempDate = Convert.ToDateTime(FechaNacimiento); if (tempDate <= DateTime.Today && tempDate.Year > (DateTime.Today.Year - 120)) //franga de control de fecha correcta { fechaCorrecta = true; } else { //ERROR POR FECHA MAL INTRODUCIDA Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("ERROR: La fecha introducida no es valida"); Console.ForegroundColor = ConsoleColor.White; } } catch (FormatException) { //ERROR POR FECHA MAL INTRODUCIDA Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("ERROR: No has introducido un formato de fecha correcto"); Console.ForegroundColor = ConsoleColor.White; } } else { //ERROR POR NO INTRODUCIR UNA FECHA Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("ERROR: No has introducido una fecha"); Console.ForegroundColor = ConsoleColor.White; } } while (!fechaCorrecta); //CONTRASEÑA Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("(Paso 5 de 5) Último, introduce tu contraseña"); Console.ForegroundColor = ConsoleColor.White; Contrasena = IntroducirTextoYComprobarLongitud(20); //COMPROBACIÓN DE DATOS Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Por favor, comprueba que estos datos son correctos (Si/No)"); Console.ForegroundColor = ConsoleColor.White; MostrarDatos(); do { Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("Itroduce Si o No"); Console.ForegroundColor = ConsoleColor.White; string opcion = Console.ReadLine().ToUpper(); if (opcion == "SI") { //introducirlos en la base de datos DateTime tempDate = Convert.ToDateTime(FechaNacimiento); tempDate.ToString("MM/dd/yyyy"); query = $"INSERT INTO Usuarios(Nombre, Apellido, FechaNacimiento, Email, Contrasena) VALUES ('{Nombre}','{Apellido}','{tempDate.Month}/{tempDate.Day}/{tempDate.Year}','{Email}','{Contrasena}')"; ModificarBase(query); return(true); } else if (opcion == "NO") { //Preguntar si quiere modificar o salir Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("¿Quieres modificarlos o quieres salir? "); Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("(Pulsa cualquier tecla para Modificar / introduce S para salir)"); Console.ForegroundColor = ConsoleColor.White; opcion = Console.ReadLine().ToUpper(); if (opcion == "S") { return(false); } } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("ERROR: No has introducido una opcion valida"); Console.ForegroundColor = ConsoleColor.White; } } while (true); } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("El email introducido ya existe, entra con tu email y contraseña o utiliza otro email para registrarte"); Console.ForegroundColor = ConsoleColor.White; } } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("ERROR: No has introducido un email valido"); Console.ForegroundColor = ConsoleColor.White; } } while (true); }
//public string List() //{ // string todos = ""; // foreach (Cliente Cliente in ListaClientes) // { // todos += Cliente.ToString(); // } // return todos; //} /// <summary> /// Muestra los datos de un Cliente /// </summary> public void Show() { Console.WriteLine(Cedula.ToString().PadRight(12) + Nombre.PadRight(35) + FechaNacimiento.ToShortDateString().PadLeft(12) + Sexo.ToString().PadRight(12).PadLeft(15) + Telefono.ToString().PadLeft(12).PadRight(15) + Correo.PadRight(40) + Direccion.PadRight(40) + EstadoCivil.ToString().PadRight(12) + IdCliente.ToString().PadLeft(5)); }
public override string ToString() { return(Cedula.ToString() + "\t" + Nombre + "\t" + FechaNacimiento.ToShortDateString() + "\t" + Sexo.ToString() + "\t" + Telefono.ToString() + "\t" + Correo + "\t" + Direccion + "\t" + EstadoCivil.ToString() + "\t" + IdCliente.ToString()); }