private void txtPatente_TextChanged(object sender, EventArgs e) { foreach (Control c in this.Controls) { if (c is GroupBox) { foreach (Control g in c.Controls) { if (g is TextBox) { ((TextBox)g).CharacterCasing = CharacterCasing.Upper; } } //Empleamos un casteo } } string Patente = txtPatente.Text; int b = 0; if (Patente.Length > 5) { Clases.cAuto auto = new Clases.cAuto(); DataTable trdo = auto.GetAutoxPatente(Patente); if (trdo.Rows.Count > 0) { b = 1; txtDescripcion.Text = trdo.Rows[0]["Descripcion"].ToString(); txtAnio.Text = trdo.Rows[0]["Anio"].ToString(); txtKms.Text = trdo.Rows[0]["Kilometros"].ToString(); txtCodAuto.Text = trdo.Rows[0]["CodAuto"].ToString(); txtImporte.Text = trdo.Rows[0]["Importe"].ToString(); if (trdo.Rows[0]["CodCiudad"].ToString() != "") { cmbCiudad.SelectedValue = trdo.Rows[0]["CodCiudad"].ToString(); } if (trdo.Rows[0]["CodMarca"].ToString() != "") { cmbMarca.SelectedValue = trdo.Rows[0]["CodMarca"].ToString(); } Clases.cStockAuto stock = new Clases.cStockAuto(); DataTable trdo2 = stock.GetStockAutosVigentes(Convert.ToInt32(txtCodAuto.Text)); if (trdo2.Rows.Count > 0) { txtCodStock.Text = trdo2.Rows[0]["CodStock"].ToString(); //cargo los gastos x cod stock } CargarGrilla(); } } if (b == 0) { LimpiarAuto(); } }
private Boolean ExisteStock(Int32 CodAuto) { Boolean Existe = false; Clases.cStockAuto stock = new Clases.cStockAuto(); DataTable trdo = stock.GetStockAutosVigentes(CodAuto); if (trdo.Rows.Count > 0) { if (trdo.Rows[0]["CodAuto"].ToString() != "") { Existe = true; } } return(Existe); }
private void txtPatente_TextChanged(object sender, EventArgs e) { foreach (Control c in this.Controls) { if (c is GroupBox) { foreach (Control g in c.Controls) { if (g is TextBox) { ((TextBox)g).CharacterCasing = CharacterCasing.Upper; } } //Empleamos un casteo } } Clases.cFunciones fun = new Clases.cFunciones(); string Patente = txtPatente.Text; int b = 0; if (Patente.Length > 5) { Clases.cAuto auto = new Clases.cAuto(); DataTable trdo = auto.GetAutoxPatente(Patente); if (trdo.Rows.Count > 0) { b = 1; txtDescripcion.Text = trdo.Rows[0]["Descripcion"].ToString(); txtAnio.Text = trdo.Rows[0]["Anio"].ToString(); txtKms.Text = trdo.Rows[0]["Kilometros"].ToString(); txtCodAuto.Text = trdo.Rows[0]["CodAuto"].ToString(); txtImporte.Text = trdo.Rows[0]["Importe"].ToString(); if (txtImporte.Text != "") { txtImporte.Text = fun.SepararDecimales(txtImporte.Text); } if (trdo.Rows[0]["CodCiudad"].ToString() != "") { cmbCiudad.SelectedValue = trdo.Rows[0]["CodCiudad"].ToString(); } if (trdo.Rows[0]["CodMarca"].ToString() != "") { cmbMarca.SelectedValue = trdo.Rows[0]["CodMarca"].ToString(); } if (trdo.Rows[0]["Propio"].ToString() == "1") { radioPropio.Checked = true; radioConcesion.Checked = false; } if (trdo.Rows[0]["Concesion"].ToString() == "1") { radioPropio.Checked = false; radioConcesion.Checked = true; } Clases.cStockAuto stock = new Clases.cStockAuto(); DataTable trdo2 = stock.GetStockAutosVigentes(Convert.ToInt32(txtCodAuto.Text)); if (trdo2.Rows.Count > 0) { txtCodStock.Text = trdo2.Rows[0]["CodStock"].ToString(); CargarCostoxstock(Convert.ToInt32(txtCodStock.Text)); } } } if (b == 0) { LimpiarAuto(); } }