public void ActualizaDato(entSwitches entswitch) { var comando = new SqlCommand("stp_Actualiza_Switch", Conexion.AbrirConexion()); comando.CommandType = CommandType.StoredProcedure; comando.Parameters.AddWithValue("@idSwitch", entswitch.idSwitch); comando.Parameters.AddWithValue("@Serie_Sw", entswitch.Serie); comando.Parameters.AddWithValue("@Mac_Sw", entswitch.Mac); comando.Parameters.AddWithValue("@Ip_Sw", entswitch.Ip); comando.Parameters.AddWithValue("@Msk", entswitch.Mascara); comando.Parameters.AddWithValue("@Gw", entswitch.Gateway); comando.Parameters.AddWithValue("@Tip_Conex", entswitch.TConexion); comando.Parameters.AddWithValue("@idMarca", entswitch.Marca); comando.Parameters.AddWithValue("@idModelo", entswitch.Modelo); comando.Parameters.AddWithValue("@idSite", entswitch.Site); comando.Parameters.AddWithValue("@idEdificio", entswitch.Edificio); try { comando.ExecuteNonQuery(); } catch (Exception ex) { Console.WriteLine(ex); } Conexion.CerrarConexion(); }
private void button6_Click(object sender, EventArgs e) { negSwitches negswitches = new negSwitches(); entSwitches entswitches = new entSwitches(); //entswitches.idSwitch = Convert.ToInt32(dgvSwitches.CurrentRow.Cells["Clave"].Value.ToString()); negswitches.EliminaDato(entswitches); CargarDGV(); }
private void button5_Click(object sender, EventArgs e) { negSwitches negswitches = new negSwitches(); entSwitches entswitch = new entSwitches(); if (Nuevo) { entswitch.Edificio = Convert.ToInt32(cmbEdificios.SelectedValue); //entswitch.Marca = Convert.ToInt32(cmbMarca.SelectedValue); //entswitch.Modelo = Convert.ToInt32(cmbModelo.SelectedValue); //entswitch.Serie = txtSerie.Text; if (rdbSSH.Checked) { entswitch.TConexion = "SSH"; } if (rdbTelnet.Checked) { entswitch.TConexion = "Telnet"; } //entswitch.Mac = txtMac.Text; entswitch.Ip = txtIp.Text; entswitch.Mascara = txtMascara.Text; entswitch.Gateway = txtGateway.Text; entswitch.Site = Convert.ToInt32(cmbSite.SelectedValue); negswitches.InsertarDato(entswitch); } else { //entswitch.idSwitch= Convert.ToInt32(dgvSwitches.CurrentRow.Cells["Clave"].Value.ToString()); entswitch.Edificio = Convert.ToInt32(cmbEdificios.SelectedValue); //entswitch.Marca = Convert.ToInt32(cmbMarca.SelectedValue); //entswitch.Modelo = Convert.ToInt32(cmbModelo.SelectedValue); //entswitch.Serie = txtSerie.Text; if (rdbSSH.Checked) { entswitch.TConexion = "SSH"; } if (rdbTelnet.Checked) { entswitch.TConexion = "Telnet"; } //entswitch.Mac = txtMac.Text; entswitch.Ip = txtIp.Text; entswitch.Mascara = txtMascara.Text; entswitch.Gateway = txtGateway.Text; entswitch.Site = Convert.ToInt32(cmbSite.SelectedValue); negswitches.ActualizaDato(entswitch); } CargarDGV(); limpiarobjetos(); hinabilitarrobjetos(); }
public void EliminaDato(entSwitches entswitch) { var comando = new SqlCommand("stp_Elimina_Switch", Conexion.AbrirConexion()); comando.CommandType = CommandType.StoredProcedure; comando.Parameters.AddWithValue("@idSwitch", entswitch.idSwitch); try { comando.ExecuteNonQuery(); } catch (Exception ex) { Console.WriteLine(ex); } Conexion.CerrarConexion(); }
public void EliminaDato(entSwitches entswitch) { datSwitches datswitches = new datSwitches(); datswitches.EliminaDato(entswitch); }
public void ActualizaDato(entSwitches entswitch) { datSwitches datswitches = new datSwitches(); datswitches.ActualizaDato(entswitch); }
public void InsertarDato(entSwitches entswitch) { datSwitches datswitches = new datSwitches(); datswitches.InsertarDato(entswitch); }