public void RegistarHorario(int idregistro, int iduser, int idhorario) { DateTime now = DateTime.Now; this.FECHA_CREACION = Convert.ToDateTime(now.ToString("yyyy/MM/dd hh:mm:ss")); this.ID_USUARIO = iduser; this.ID_HORARIO = idhorario; this.ID_REGISTRO = idregistro; try { using (var db = new ModeloGGYM()) { if (this.ID_REGISTRO > 0) { db.Entry(this).State = EntityState.Modified; } else { db.Entry(this).State = EntityState.Added; } db.SaveChanges(); } } catch (Exception e) { throw; } }
public void Habilitar() { var membresia = ObtenerMembresia(ID_MEMBRESIA); this.ID_MEMBRESIA = membresia.ID_MEMBRESIA; this.DESCRIPCION = membresia.DESCRIPCION; this.DURACION = membresia.DURACION; this.COSTO = membresia.COSTO; this.ESTADO = true; try { using (var db = new ModeloGGYM()) { if (this.ID_MEMBRESIA > 0) { db.Entry(this).State = EntityState.Modified; } db.SaveChanges(); } } catch (Exception e) { throw; } }
public void Habilitar() { var usuario = ObtenerUsuario(ID_USUARIO); this.ID_USUARIO = usuario.ID_USUARIO; this.NOMBRE = usuario.NOMBRE; this.APELLIDO = usuario.APELLIDO; this.FECHA_CREACION = usuario.FECHA_CREACION; this.TELEFONO = usuario.TELEFONO; this.DIRECCION = usuario.DIRECCION; this.PESO = usuario.PESO; this.ESTATURA = usuario.ESTATURA; this.EDAD = usuario.EDAD; this.EMAIL = usuario.EMAIL; this.PASSWORD = usuario.PASSWORD; this.ID_TIPOUSUARIO = usuario.ID_TIPOUSUARIO; this.ID_MEMBRESIA = usuario.ID_MEMBRESIA; this.ESTADO = true; try { using (var db = new ModeloGGYM()) { if (this.ID_USUARIO > 0) { db.Entry(this).State = EntityState.Modified; } db.SaveChanges(); } } catch (Exception e) { throw; } }
public void RegistarEntrenador() { this.ESTADO = true; try { using (var db = new ModeloGGYM()) { if (this.ID_USUARIO > 0) { db.Entry(this).State = EntityState.Modified; } else { DateTime now = DateTime.Now; this.PASSWORD = HashHelper.SHA1(this.PASSWORD); this.ID_TIPOUSUARIO = 3; this.FECHA_CREACION = Convert.ToDateTime(now.ToString("yyyy/MM/dd hh:mm:ss")); db.Entry(this).State = EntityState.Added; } db.SaveChanges(); } } catch (Exception e) { throw; } }
public void RegistarSeguimiento(int idusuario, string pesousuario) { //EL DIA DE HOY DateTime now = DateTime.Now; now = Convert.ToDateTime(now.ToString("dd/MM/yyyy")); var seguimiento = ObtenerSeguimientoPorFecha(now, idusuario); this.ID_USUARIO = idusuario; this.PESO = pesousuario; if (seguimiento == null) { // SIGNIFICA QUE ES UN NUEVO DATO this.FECHA = Convert.ToDateTime(now.ToString("dd/MM/yyyy")); try { using (var db = new ModeloGGYM()) { db.Entry(this).State = EntityState.Added; db.SaveChanges(); } } catch (Exception e) { throw; } } else { // NO HACE NADA PORQUE SIGNIFICA QUE SON IGUALES // QUEDARIA COMPARAR LOS PESOS SI NO SON IGUALES PARA ACTUALIZAR if (!this.PESO.Equals(seguimiento.PESO)) { this.ID_SEGUIMIENTO = seguimiento.ID_SEGUIMIENTO; this.ID_USUARIO = seguimiento.ID_USUARIO; this.FECHA = seguimiento.FECHA; try { using (var db = new ModeloGGYM()) { db.Entry(this).State = EntityState.Modified; db.SaveChanges(); } } catch (Exception e) { throw; } } else { // AHORA SI NO HACE NADA } } }
public void RegistrarHorario() { try { using (var db = new ModeloGGYM()) { db.Entry(this).State = EntityState.Added; db.SaveChanges(); } } catch (Exception e) { throw; } }
public void RegistrarMembresia() { this.ESTADO = true; try { using (var db = new ModeloGGYM()) { if (this.ID_USUARIO > 0) { this.ID_TIPOUSUARIO = 2; db.Entry(this).State = EntityState.Modified; } db.SaveChanges(); } } catch (Exception e) { throw; } }
public void RegistrarIMC(int idusuario, string imcTemporal) { var imcchiquito = ObtenerIMC(idusuario); this.ID_USUARIO = idusuario; this.IMC1 = imcTemporal; if (imcchiquito == null) { try { using (var db = new ModeloGGYM()) { db.Entry(this).State = EntityState.Added; db.SaveChanges(); } } catch (Exception e) { throw; } } else { this.ID_IMC = imcchiquito.ID_IMC; try { using (var db = new ModeloGGYM()) { db.Entry(this).State = EntityState.Modified; db.SaveChanges(); } } catch (Exception e) { throw; } } }
public void RegistrarProducto() { try { using (var db = new ModeloGGYM()) { if (this.ID_PRODUCTO > 0) { db.Entry(this).State = EntityState.Modified; } else { db.Entry(this).State = EntityState.Added; } db.SaveChanges(); } } catch (Exception e) { throw; } }
public void RegistrarMembresia() { this.ESTADO = true; try { using (var db = new ModeloGGYM()) { if (this.ID_MEMBRESIA > 0) { db.Entry(this).State = EntityState.Modified; } else { db.Entry(this).State = EntityState.Added; } db.SaveChanges(); } } catch (Exception e) { throw; } }