public void DeleteThis()
        {
            SQLSERVERDB dbManager = new SQLSERVERDB(BD_SERVER, BD_NAME);

            dbManager.Delete("delete from tMedicamento where id_medicamento = " + this.id + ";");
            this.id             = -1;
            this.laboratorio_id = null;
            this.nombre         = null;
            this.cantidad       = -1;
        }
        public Medicamento(int id)
        {
            SQLSERVERDB dbManager = new SQLSERVERDB(BD_SERVER, BD_NAME);

            Object[] pastanaga = dbManager.Select("select * from tMedicamento where id_medicamento = " + id + ";")[0];
            this.id             = (int)pastanaga[0];
            this.nombre         = (string)pastanaga[1];
            this.cantidad       = (int)pastanaga[2];
            this.laboratorio_id = new Laboratorio((int)pastanaga[3]);
        }
        public Medicamento(int id, string nombre, int cantidad, Laboratorio lab)
        {
            SQLSERVERDB dbManager = new SQLSERVERDB(BD_SERVER, BD_NAME);

            dbManager.Insert("insert into tMedicamento(id_medicamento, nombre_medicamento, cantidad_disponible, laboratorio) values" +
                             "(" + id + ", '" + nombre + "', " + cantidad + ", " + lab.ID + ");");
            this.id             = id;
            this.nombre         = nombre;
            this.cantidad       = cantidad;
            this.laboratorio_id = lab;
        }
Example #4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // TODO: esta línea de código carga datos en la tabla 'bD_MEDICAMENTOSDataSet.tMedicamento' Puede moverla o quitarla según sea necesario.
            refreshGridView();
            SQLSERVERDB db = new SQLSERVERDB(Prueba_2.Properties.Settings.Default.BD_SERVER, Prueba_2.Properties.Settings.Default.BD_NAME);

            foreach (Laboratorio lab in Laboratorio.ListaLaboratorios())
            {
                labList.Items.Add(lab);
            }
        }