protected void DlCategorias_SelectedIndexChanged(object sender, EventArgs e) { DlProductos.Enabled = true; DlNombre_Prod.Enabled = true; DlNombre_Prod.Items.Clear(); DlProductos.Items.Clear(); if (DlCategorias.SelectedItem.Text == "Seleccione") { DlNombre_Prod.Items.Clear(); DlProductos.Items.Clear(); DlCategorias.Items.Clear(); Productos(); Cargar_Combos(); } else { DlProductos.DataSource = lcat.Consultar_Categoria(Convert.ToInt32(DlCategorias.SelectedValue)); DlNombre_Prod.DataSource = lcat.Consultar_Categoria(Convert.ToInt32(DlCategorias.SelectedValue)); DlProductos.Items.Add("Seleccione"); DlNombre_Prod.Items.Add("Seleccione"); DlProductos.AppendDataBoundItems = true; DlNombre_Prod.AppendDataBoundItems = true; DlProductos.DataBind(); DlNombre_Prod.DataBind(); } }
public void Cargar_Combos() { DlProductos.DataValueField = "Cod_Producto"; DlNombre_Prod.DataValueField = "Cod_Producto"; DlCategorias.DataValueField = "Id_Categoria"; DlNombre_Prod.DataTextField = "Nombre_Producto"; DlProductos.DataTextField = "Cod_Producto"; DlCategorias.DataTextField = "Nombre_Categoria"; DlProductos.DataBind(); DlCategorias.DataBind(); DlNombre_Prod.DataBind(); }
protected void lbtnQuitarDetalle_Click(object sender, EventArgs e) { Ldet.Eliminar_Detalles(DlProductos.SelectedItem.Text); DlProductos.ClearSelection(); lbtnQuitarDetalle.Enabled = false; DlProductos.Enabled = true; TxtCantidad.Text = ""; DlNombre_Prod.ClearSelection(); GVDetalles.DataSource = Ldet.Consultar_Detalles(); GVDetalles.DataBind(); DlNombre_Prod.Enabled = true; lbtnAgregarDetalle.Visible = true; TxtNitProveedor.Text = ""; TxtNombreRazonSocial.Text = ""; TxtMotivo.Text = ""; }
protected void lbtnRegistrarDevolucion_Click1(object sender, EventArgs e) { bool res = false; bool Detalles = false; res = LolDevPro.Regitrar_Devoluciones(TxtNitProveedor.Text, TxtMotivo.Text, 4); if (res == true) { foreach (GridViewRow row in GVDetalles.Rows) { Detalles = Ldet.Agregar_Detalles(Convert.ToString(row.Cells[1].Text), Convert.ToInt32(row.Cells[3].Text), Convert.ToInt32(row.Cells[4].Text)); if (Detalles) { Lprod.Disminuir(Convert.ToString(row.Cells[1].Text)); Detalles = true; } else { Detalles = false; } } if (Detalles == true) { Respuesta2.Visible = true; Respuesta2.Text = "La devolucion Fue registrada correctamente"; TxtCantidad.Text = ""; TxtMotivo.Text = ""; TxtNitProveedor.Text = ""; DlNombre_Prod.ClearSelection(); TxtNombreRazonSocial.Text = ""; Ldet.Elimina_Detalles(); GVDetalles.DataBind(); } else { Respuesta2.Text = "La devolucion no Fue registrada correctamente"; } } else { Respuesta.Visible = true; Respuesta.Text = "La devolucion no Fue registrada correctamente"; } }