public SelloDiscografico ObtenerSello(string selloId) { string sqltxt = $"SELECT * FROM [dbo].[Sello_Discografico] WHERE id = {selloId}"; var tablaTemporal = _BD.consulta(sqltxt); if (tablaTemporal.Rows.Count == 0) { return(null); } var sello = new SelloDiscografico(); foreach (DataRow fila in tablaTemporal.Rows) { if (fila.HasErrors) { continue; // no corto el ciclo } sello.Id = fila.ItemArray[0].ToString(); // Codigo sello.Nombre = fila.ItemArray[1].ToString(); // Nombre sello.Telefono = fila.ItemArray[2].ToString(); // Telefono sello.Email = fila.ItemArray[3].ToString(); // Telefono } return(sello); }
public bool Editar(SelloDiscografico sello) { string sqltxt = $"UPDATE [dbo].[Sello_Discografico] SET nombre ='{ sello.Nombre }'" + $", telefono='{ sello.Telefono}' " + $", email='{ sello.Email}' " + $"WHERE id= {sello.Id}"; return(_BD.EjecutarSQL(sqltxt)); }
public bool Guardar(SelloDiscografico sello) {//ver aca nombre descripcion string sqltxt = $"INSERT[dbo].[Sello_Discografico]([Nombre],[Telefono],[Email])" + $"VALUES " + $"('{sello.Nombre}', " + $"'{sello.Telefono}', " + $"'{sello.Email}')"; return(_BD.EjecutarSQL(sqltxt)); }
private void btnAceptar_Click(object sender, EventArgs e) { var datosSello = new SelloDiscografico(); datosSello.Nombre = txtSello.Text.Trim(); datosSello.Telefono = txtTelefono.Text.Trim(); datosSello.Email = txtEmail.Text.Trim(); datosSello.Id = _id; if (!datosSello.NombreValido()) { MessageBox.Show("Nombre Inválido!"); txtSello.Text = ""; txtSello.Focus(); return; } if (datosSello.Nombre != sello.Nombre) { if (datosSello.NombreRepetido(datosSello.Nombre)) { MessageBox.Show("Nombre ya existente!"); txtSello.Text = ""; txtSello.Focus(); return; } } if (!datosSello.TelefonoValido(datosSello.Telefono)) { MessageBox.Show("Telefono Inválido!"); txtTelefono.Text = ""; txtTelefono.Focus(); return; } if (!datosSello.EmailValido(datosSello.Email)) { MessageBox.Show("Email Inválido!"); txtEmail.Text = ""; txtEmail.Focus(); return; } if (sellosRepositorio.Editar(datosSello)) { MessageBox.Show("La edicion ha finalizado correctamente."); this.Dispose(); } }
private void btnAceptar_Click(object sender, EventArgs e) { var sello = new SelloDiscografico(); sello.Nombre = txtSello.Text.Trim(); sello.Telefono = txtTelefono.Text.Trim(); sello.Email = txtEmail.Text.Trim(); if (!sello.NombreValido()) { MessageBox.Show("Nombre Inválido!"); txtSello.Text = ""; txtSello.Focus(); return; } if (sello.NombreRepetido(sello.Nombre)) { MessageBox.Show("Nombre ya existe!"); txtSello.Text = ""; txtSello.Focus(); return; } if (!sello.TelefonoValido(sello.Telefono)) { MessageBox.Show("Telefono Inválido!"); txtTelefono.Text = ""; txtTelefono.Focus(); return; } if (!sello.EmailValido(sello.Email)) { MessageBox.Show("Email Inválido!"); txtEmail.Text = ""; txtEmail.Focus(); return; } if (sellosRepositorios.Guardar(sello)) { MessageBox.Show("Se agrego sello discografico con exito!"); this.Dispose(); } }
public ModificarSello(string selloId) { InitializeComponent(); sellosRepositorio = new SelloRepositorio(); sello = sellosRepositorio.ObtenerSello(selloId); }