public static ObservableCollection <Paciente> Cargar(dbcon db) { var list = new ObservableCollection <Paciente>(); db.conexcion.Open(); var cmd = new OleDbCommand(); cmd.Connection = db.conexcion; cmd.CommandText = $"SELECT * FROM Paciente"; var result = cmd.ExecuteReader(); bool correcto = result.HasRows; if (correcto) { while (result.Read()) { var p = new Paciente(db); p.id = result.GetInt32(0); p.cedula = result.GetString(1); p.nombre = result.GetString(2); p.apellido = result.GetString(3); p.telefono = result.GetString(4); p.direccion = result.GetString(5); p.existe = true; list.Add(p); } } db.conexcion.Close(); cmd.Dispose(); return(list); }
public static List <AgendaHoraria> CargarTodos(dbcon db) { List <AgendaHoraria> list = new List <AgendaHoraria>(); db.conexcion.Open(); var cmd = new OleDbCommand(); cmd.Connection = db.conexcion; cmd.CommandText = $"SELECT * FROM AgendaSemanal"; var result = cmd.ExecuteReader(); bool correcto = result.HasRows; if (correcto) { while (result.Read()) { var a = new AgendaHoraria(); a.id = result.GetInt32(0); a.nombre = result.GetString(1); a.horarios[0].dbstring = result.GetString(2); a.horarios[1].dbstring = result.GetString(3); a.horarios[2].dbstring = result.GetString(4); a.horarios[3].dbstring = result.GetString(5); a.horarios[4].dbstring = result.GetString(6); a.horarios[5].dbstring = result.GetString(7); a.horarios[6].dbstring = result.GetString(8); list.Add(a); } } db.conexcion.Close(); cmd.Dispose(); return(list); }
public bool Insertar(dbcon db) { bool correcto = false; db.conexcion.Open(); var cmd = new OleDbCommand(); cmd.Connection = db.conexcion; cmd.CommandText = $"INSERT INTO AgendaSemanal(nombre,lunes,martes,miercoles,jueves,viernes,sabado,domingo) " + $"VALUES(?,?,?,?,?,?,?,?)"; cmd.Parameters.Add("nombre", OleDbType.VarChar).Value = nombre; cmd.Parameters.Add("lunes", OleDbType.VarChar).Value = horarios[0].dbstring; cmd.Parameters.Add("martes", OleDbType.VarChar).Value = horarios[1].dbstring; cmd.Parameters.Add("miercoles", OleDbType.VarChar).Value = horarios[2].dbstring; cmd.Parameters.Add("jueves", OleDbType.VarChar).Value = horarios[3].dbstring; cmd.Parameters.Add("viernes", OleDbType.VarChar).Value = horarios[4].dbstring; cmd.Parameters.Add("sabado", OleDbType.VarChar).Value = horarios[5].dbstring; cmd.Parameters.Add("domingo", OleDbType.VarChar).Value = horarios[6].dbstring; if (cmd.ExecuteNonQuery() > 0) { correcto = true; } cmd.CommandText = "SELECT @@IDENTITY"; id = (int)cmd.ExecuteScalar(); db.conexcion.Close(); cmd.Dispose(); return(correcto); }
public bool Actualizar(dbcon db) { bool correcto = false; db.conexcion.Open(); var cmd = new OleDbCommand(); cmd.Connection = db.conexcion; cmd.CommandText = $"Update AgendaSemanal SET nombre=?,lunes=?,martes=?,miercoles=?" + $",jueves=?,viernes=?,sabado=?,domingo=? WHERE id={id}"; cmd.Parameters.Add("nombre", OleDbType.VarChar).Value = nombre; cmd.Parameters.Add("lunes", OleDbType.VarChar).Value = horarios[0].dbstring; cmd.Parameters.Add("martes", OleDbType.VarChar).Value = horarios[1].dbstring; cmd.Parameters.Add("miercoles", OleDbType.VarChar).Value = horarios[2].dbstring; cmd.Parameters.Add("jueves", OleDbType.VarChar).Value = horarios[3].dbstring; cmd.Parameters.Add("viernes", OleDbType.VarChar).Value = horarios[4].dbstring; cmd.Parameters.Add("sabado", OleDbType.VarChar).Value = horarios[5].dbstring; cmd.Parameters.Add("domingo", OleDbType.VarChar).Value = horarios[6].dbstring; if (cmd.ExecuteNonQuery() > 0) { correcto = true; } db.conexcion.Close(); cmd.Dispose(); return(correcto); }
public void Cargar(dbcon db) { db.conexcion.Open(); var cmd = new OleDbCommand(); cmd.Connection = db.conexcion; cmd.CommandText = $"SELECT * FROM AgendaSemanal WHERE id={id}"; var result = cmd.ExecuteReader(); bool correcto = result.HasRows; existe = correcto; if (correcto) { while (result.Read()) { nombre = result.GetString(1); horarios[0].dbstring = result.GetString(2); horarios[1].dbstring = result.GetString(3); horarios[2].dbstring = result.GetString(4); horarios[3].dbstring = result.GetString(5); horarios[4].dbstring = result.GetString(6); horarios[5].dbstring = result.GetString(7); horarios[6].dbstring = result.GetString(8); } } db.conexcion.Close(); cmd.Dispose(); }
public Paciente(dbcon con, int identificador) { db = con; id = identificador; }
public Paciente(dbcon con) { db = con; }
public FiltroPasientes(dbcon con) { db = con; }
public Personal(dbcon con, int identificador) { db = con; id = identificador; }
public Personal(dbcon con) { db = con; }
public PersonalCollecion(dbcon con) : base() { db = con; }
public CitasList(dbcon con) : base() { db = con; //Reload(); }
public Cita(dbcon con, int identificador) { db = con; id = identificador; }
public Cita(dbcon con) { db = con; }
public ProfesionList(dbcon con) : base() { db = con; }
public Session(dbcon conexcion) { db = conexcion; _auth = false; }