public void btn_Agregar_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Text_Modelo.Text)) { //consultar si existe Modelo DataTable tabla = new DataTable(); tabla = Transaccion.Consulta_ModeloAuto(Lis_marca.SelectedValue, Text_Modelo.Text); if (tabla.Rows.Count == 0) { Transaccion.InsertaModeloAuto(Convert.ToInt32(Lis_marca.SelectedValue), Text_Modelo.Text); this.Page.RegisterClientScriptBlock("Mensaje", "<script>alert('Se ingreso correctamente');</script>"); Text_Modelo.Text = ""; } else { this.Page.RegisterClientScriptBlock("Mensaje", "<script>alert('ya esta registrado el modelo');</script>"); } } else { this.Page.RegisterClientScriptBlock("Mensaje", "<script>alert('Debe indicar Modelo');</script>"); } }
public void btn_Agregar_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(TextBox1.Text)) { //consultar si existe DataTable tabla = new DataTable(); tabla = Transaccion.Consulta_ModeloAuto(TextBox1.Text); if (tabla.Rows.Count == 0) { Transaccion.InsertaMarcaAuto(TextBox1.Text); this.Page.RegisterClientScriptBlock("Mensaje", "<script>alert('Se ingreso correctamente');</script>"); TextBox1.Text = ""; } else { this.Page.RegisterClientScriptBlock("Mensaje", "<script>alert('ya esta registrado la Marca');</script>"); TextBox1.Text = ""; } } else { this.Page.RegisterClientScriptBlock("Mensaje", "<script>alert('Debe indicar Marca');</script>"); } }