示例#1
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");
 }
        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);
        }
示例#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
 private void HabilitarCajas(bool habilitadas)
 {
     NombreEmpleado.Clear();
     Edad.Clear();
     Sexo.Clear();
     NombreEmpleado.IsEnabled = habilitadas;
     Edad.IsEnabled           = habilitadas;
     Sexo.IsEnabled           = habilitadas;
 }
示例#5
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);
        }
示例#6
0
 public ActionResult Edit([Bind(Include = "FechaMinNacimiento,FechaMaxNacimiento,FechaPorDefecto,Estado,FechaDeInicio,FechaDeFin")] Edad edad)
 {
     if (ModelState.IsValid)
     {
         db.Entry(edad).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(edad));
 }
示例#7
0
        public ActionResult RealDeleteConfirmed(DateTime FechaMinNacimiento, DateTime FechaMaxNacimiento)
        {
            Edad edad = db.EDAD.Find(FechaMinNacimiento, FechaMaxNacimiento);

            db.EDAD.Remove(edad);
            db.SaveChanges();
            TempData["Type"]    = "error";
            TempData["Message"] = "El registro se eliminó correctamente";
            return(RedirectToAction("Index"));
        }
示例#8
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);
        }
示例#9
0
        public override int GetHashCode()
        {
            var hashCode = 1550485279;

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Nombre);

            hashCode = hashCode * -1521134295 + Edad.GetHashCode();
            hashCode = hashCode * -1521134295 + Id.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Dni);

            hashCode = hashCode * -1521134295 + EqualityComparer <Guid> .Default.GetHashCode(Al_Guid);

            return(hashCode);
        }
示例#10
0
        // GET: Edads/Details/5
        public ActionResult Details(DateTime FechaMinNacimiento, DateTime FechaMaxNacimiento)
        {
            if (FechaMinNacimiento == null || FechaMaxNacimiento == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Edad edad = db.EDAD.Find(FechaMinNacimiento, FechaMaxNacimiento);

            if (edad == null)
            {
                return(HttpNotFound());
            }
            return(View(edad));
        }
示例#11
0
        public IncidenteDetalle(DataRow dr, DataTable dtCalculo = null)
        {
            FecIncidente         = DateTime.ParseExact(dr["FecIncidente"].ToString(), "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture); //Convert.ToInt64(dr["FecIncidente"].ToString());
            NroIncidente         = dr["NroIncidente"].ToString();
            Paciente             = dr["Paciente"].ToString();
            Sexo                 = dr["Sexo"].ToString();
            Edad                 = dr["Edad"].ToString();
            Origen               = dr["Origen"].ToString();
            Destino              = dr["Destino"].ToString();
            Anexo1               = dr["Anexo1"].ToString();
            Anexo2               = dr["Anexo2"].ToString();
            Concepto             = dr["Concepto"].ToString();
            Motivo               = dr["Motivo"].ToString();
            Importe              = Convert.ToDecimal(dr["Importe"].ToString());
            CoPago               = Convert.ToDecimal(dr["CoPago"].ToString());
            HorDespacho          = ConvertToDateTimeSecure(dr["HorDespacho"]);
            HorLlegada           = ConvertToDateTimeSecure(dr["HorLlegada"]);
            IncidenteCalculoList = new List <IncidenteCalculo>();
            if (dtCalculo != null)
            {
                foreach (DataRow drCalculo in dtCalculo.Rows)
                {
                    IncidenteCalculoList.Add(new IncidenteCalculo(drCalculo));
                }
            }
            //Limpiar campo Edad
            int iReturn;

            if (!string.IsNullOrEmpty(Edad) && !int.TryParse(Edad, out iReturn))
            {
                Edad = Edad.ToUpper();
                int i = -1;
                do
                {
                    i++;
                    if (!Char.IsNumber(Edad[i]))
                    {
                        if (Edad.Substring(i, 1) == "A")
                        {
                            Edad = Edad.Substring(0, i);
                        }
                        else
                        {
                            Edad = Edad.Substring(0, i + 1);
                        }
                    }
                } while (i < Edad.Length - 1);
            }
        }
示例#12
0
        public ActionResult DeleteConfirmed(DateTime FechaMinNacimiento, DateTime FechaMaxNacimiento)
        {
            Edad edad = db.EDAD.Find(FechaMinNacimiento, FechaMaxNacimiento);

            if (edad.Estado == "I")
            {
                edad.Estado = "A";
            }
            else
            {
                edad.Estado = "I";
            }
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#13
0
        public override int GetHashCode()
        {
            var hashCode = -818402288;

            hashCode = hashCode * -1521134295 + Id.GetHashCode();
            hashCode = hashCode * -1521134295 + Edad.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 + EqualityComparer <string> .Default.GetHashCode(Guid.ToString());

            return(hashCode);
        }
示例#14
0
        // GET: Edads/Edit/5
        public ActionResult Edit(DateTime FechaMinNacimiento, DateTime FechaMaxNacimiento)
        {
            if (FechaMinNacimiento == null || FechaMaxNacimiento == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Edad edad = db.EDAD.Find(FechaMinNacimiento, FechaMaxNacimiento);

            if (edad == null)
            {
                return(HttpNotFound());
            }
            edad.FechaMinNacimiento = DateTime.Parse(edad.FechaMinNacimiento.ToString("yyyy/MM/dd"));

            return(View(edad));
        }
示例#15
0
        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);
        }
示例#16
0
        public override int GetHashCode()
        {
            var hashCode = 1122968978;

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Nombre);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Apellidos);

            hashCode = hashCode * -1521134295 + IdAlumno.GetHashCode();
            hashCode = hashCode * -1521134295 + FechadeNacimiento.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Dni);

            hashCode = hashCode * -1521134295 + Edad.GetHashCode();

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Guid);

            return(hashCode);
        }
        public override int GetHashCode()
        {
            var hashCode = -377388725;

            hashCode = hashCode * -1521134295 + EqualityComparer <Guid> .Default.GetHashCode(Guid);

            hashCode = hashCode * -1521134295 + Id.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Dni);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Nombre);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Apellidos);

            hashCode = hashCode * -1521134295 + Edad.GetHashCode();
            hashCode = hashCode * -1521134295 + Nacimiento.GetHashCode();
            hashCode = hashCode * -1521134295 + Registro.GetHashCode();
            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.
     }
 }
示例#19
0
        public override void CargarDatos(int?entidadId)
        {
            // Instancion por medio del Inyector el Objeto Grupo
            paciente = ObjectFactory.GetInstance <Dominio.DatosPaciente.Entidades.Paciente>();

            if (cmbGrupoSanguineo.Items.Count > 0)
            {
                this.cmbGrupoSanguineo.SelectedIndex = 3;
            }

            if (entidadId.HasValue)
            {
                paciente = datosPacienteUoW.PacienteRepositorio.ObtenerPorId(entidadId.Value);

                this.txtApellido.Text           = paciente.Apellido;
                this.txtNombre.Text             = paciente.Nombre;
                this.txtDni.Text                = paciente.Dni;
                this.txtTelefono.Text           = paciente.Telefono;
                this.txtNroAfiliado.Text        = paciente.NumeroAfiliado;
                this.txtPlanObraSocial.Text     = paciente.PlanObraSocial;
                this.txtCelular.Text            = paciente.Celular;
                this.txtMail.Text               = paciente.Mail;
                this.txtDireccion.Text          = paciente.Domicilio;
                this.dtpFechaNacimiento.Value   = paciente.FechaNacimiento;
                this.dtpFechaNacimiento.MaxDate = DateTime.Today;

                this.imgFotoPaciente.Image = Imagen.Convertir_Bytes_Imagen(paciente.Foto);

                this.cmbGrupoSanguineo.SelectedValue = paciente.GrupoSanguineoId;
                this.cmbObraSocial.SelectedValue     = paciente.ObraSocialId;
                this.cmbSexo.SelectedValue           = paciente.SexoId;

                this.chkEsDown.Checked = paciente.EsDown;

                this.txtEdad.Text = Edad.Calcular(paciente.FechaNacimiento, DateTime.Today);

                this.txtApellido.Focus();
            }
            else
            {
                Mensaje.Mostrar(new Exception("Error al cargar los Datos"), Constantes.TipoMensaje.Error);
            }
        }
示例#20
0
        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);
        }
示例#21
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);
        }
示例#22
0
文件: Student.cs 项目: EnPeRe/Vueling
        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);
        }
示例#23
0
        public ActionResult Create([Bind(Include = "FechaMinNacimiento,FechaMaxNacimiento,FechaPorDefecto,Estado,FechaDeInicio,FechaDeFin")] Edad edad)
        {
            if (ModelState.IsValid)
            {
                db.EDAD.Add(edad);
                string mensaje = Verificar(edad.FechaMinNacimiento, edad.FechaMaxNacimiento);
                if (mensaje == "")
                {
                    db.SaveChanges();

                    TempData["Type"]    = "success";
                    TempData["Message"] = "El registro se realizó correctamente";
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ViewBag.Type    = "warning";
                    ViewBag.Message = mensaje;
                    return(View(edad));
                }
            }

            return(View(edad));
        }
示例#24
0
 override public string ToString()
 {
     return(Nombre + " " + Apellidos + " " + Sexo + " " + Edad.ToString() + " " + Carrera);
 }
示例#25
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)}");
 }
        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
        }
示例#27
0
 public int CompareByEdad(Usuario usuario)
 {
     return(Edad.CompareTo(usuario.Edad));
 }
示例#28
0
 public override string ToString()
 {
     return(Guid.ToString() + "," + Id.ToString() + "," + Nombre + "," + Apellido + "," + Dni + "," + FechaNacimiento.ToString() + "," + Edad.ToString() + "," + FechaRegistro.ToString());
 }
示例#29
0
    // Use this for initialization
    void Start()
    {
        CS = GameObject.Find("Scripts").GetComponent(typeof(Change_States)) as Change_States;
        //System.DateTime departure = new System.DateTime(2010, 6, 1, 23, 50, 0);
        //System.DateTime arrival = new System.DateTime(2010, 6, 3, 00, 5, 0);
        System.DateTime Now = System.DateTime.Now;
        //System.TimeSpan travelTime = arrival - departure;
        //Debug.Log("travelTime: " + travelTime );

        int Inicio = PlayerPrefs.GetInt("Inicios");

        selectSpritePet();

        name.GetComponent <Text>().text     = PlayerPrefs.GetString("namePet");
        specimen.GetComponent <Text>().text = PlayerPrefs.GetString("specimenPet");
        diet.GetComponent <Text>().text     = PlayerPrefs.GetString("dietPet");
        if (Inicio == 0)
        {
            // Save the first Now
            PlayerPrefs.SetInt("Inicios", 1);
            //	Save birth
            PlayerPrefs.SetInt("Año_Nacimiento", Now.Year);
            PlayerPrefs.SetInt("Mes_Nacimiento", Now.Month);
            PlayerPrefs.SetInt("Dia_Nacimiento", Now.Day);
            PlayerPrefs.SetInt("Hora_Nacimiento", Now.Hour);
            PlayerPrefs.SetInt("Minuto_Nacimiento", Now.Minute);
            // Initiate Temp Stats
            System.DateTime reinicio = System.DateTime.Now;
            PlayerPrefs.SetInt("A_rC", reinicio.Year);
            PlayerPrefs.SetInt("Me_rC", reinicio.Month);
            PlayerPrefs.SetInt("D_rC", reinicio.Day);
            PlayerPrefs.SetInt("H_rC", reinicio.Hour);
            PlayerPrefs.SetInt("Mi_rC", reinicio.Minute);

            PlayerPrefs.SetInt("A_rB", reinicio.Year);
            PlayerPrefs.SetInt("Me_rB", reinicio.Month);
            PlayerPrefs.SetInt("D_rB", reinicio.Day);
            PlayerPrefs.SetInt("H_rB", reinicio.Hour);
            PlayerPrefs.SetInt("Mi_rB", reinicio.Minute);

            PlayerPrefs.SetInt("A_rA", reinicio.Year);
            PlayerPrefs.SetInt("Me_rA", reinicio.Month);
            PlayerPrefs.SetInt("D_rA", reinicio.Day);
            PlayerPrefs.SetInt("H_rA", reinicio.Hour);
            PlayerPrefs.SetInt("Mi_rA", reinicio.Minute);
            //
            Label.GetComponent <Text>().text = "Primer inicio";
            Edad.GetComponent <Text>().text  = "Edad: 0 horas";
        }
        else
        {
            //Load Last Desconnection
            System.DateTime Last = new System.DateTime(PlayerPrefs.GetInt("A_Desc"),
                                                       PlayerPrefs.GetInt("Me_Desc"),
                                                       PlayerPrefs.GetInt("D_Desc"),
                                                       PlayerPrefs.GetInt("H_Desc"),
                                                       PlayerPrefs.GetInt("Mi_Desc"),
                                                       PlayerPrefs.GetInt("S_Desc"));
            //Load Birth
            System.DateTime Birth = new System.DateTime(PlayerPrefs.GetInt("Año_Nacimiento"),
                                                        PlayerPrefs.GetInt("Mes_Nacimiento"),
                                                        PlayerPrefs.GetInt("Dia_Nacimiento"),
                                                        PlayerPrefs.GetInt("Hora_Nacimiento"),
                                                        PlayerPrefs.GetInt("Minuto_Nacimiento"),
                                                        0);
            // Load Comida
            System.DateTime ultimaCom = new System.DateTime(PlayerPrefs.GetInt("A_rC"),
                                                            PlayerPrefs.GetInt("Me_rC"),
                                                            PlayerPrefs.GetInt("D_rC"),
                                                            PlayerPrefs.GetInt("H_rC"),
                                                            PlayerPrefs.GetInt("Mi_rC"),
                                                            0);
            //

            //Calculate the diference between the saved time and the atual time
            System.TimeSpan Diferencia    = Now - Last;
            System.TimeSpan DiferenciaCom = Now - ultimaCom;
            //Put into the label the information
            //Label.GetComponent<Text>().text = "Minutos" + Diferencia.TotalMinutes;
            Label.GetComponent <Text>().text = "Ultima conexión: " + Mathf.RoundToInt((float)(Diferencia.TotalMinutes)) + " min " + " - Ultima Comida: " + Mathf.RoundToInt((float)(DiferenciaCom.TotalSeconds)) + " s";

            //Calcular edad
            E_dad = Now - Birth;
            if (E_dad.Days > 0)
            {
                Edad.GetComponent <Text>().text = "Edad: " + E_dad.Days + " días";
            }
            else
            {
                Edad.GetComponent <Text>().text = "Edad: " + E_dad.Hours + " horas";
            }
            CS.UpdateBasics(
                PlayerPrefs.GetInt("contComida"),
                PlayerPrefs.GetInt("contAnimo"),
                PlayerPrefs.GetInt("contAseo"),
                PlayerPrefs.GetInt("contSueño"),
                PlayerPrefs.GetInt("contSalud"),
                PlayerPrefs.GetInt("contFelicidad"));
            //Calcular el cambio de status
            CS.calcularComida(Diferencia);
            CS.calcularAnimo(Diferencia);
            CS.calcularAseo(Diferencia);
            CS.calcularSueño(Diferencia);
        }
    }
示例#30
0
 private void dtpFechaNacimiento_ValueChanged(object sender, EventArgs e)
 {
     this.txtEdad.Text = Edad.Calcular(((DateTimePicker)sender).Value, DateTime.Today);
 }