protected void DropDownList_Factura_SelectedIndexChanged(object sender, EventArgs e) { if (DropDownList_Factura.SelectedIndex <= 0) { TextBox_CantidadProducto.Text = ""; Label_CantidadMax.Text = "0"; Label_CantidadDisponible.Text = "0"; RangeValidator_TextBox_CantidadProducto.MaximumValue = "0"; RangeValidator_TextBox_CantidadProducto.MinimumValue = "0"; } else { Entrega _entrega = new Entrega(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString()); String[] datosArray = DropDownList_Factura.SelectedValue.Split(':'); Decimal ID_DOCUMENTO = Convert.ToDecimal(datosArray[0]); Decimal ID_LOTE = Convert.ToDecimal(datosArray[1]); DataTable tablaInfoLote = _entrega.ObtenerCantidadesEnLote(ID_DOCUMENTO, ID_LOTE); DataRow filaInfoLote = tablaInfoLote.Rows[0]; Int32 CANTIDAD_TOTAL = Convert.ToInt32(HiddenField_CANTIDAD_TOTAL.Value); Int32 CANTIDAD_ENTREGADA = Convert.ToInt32(HiddenField_CANTIDAD_ENTREGADA.Value); Int32 CANTIDAD_DISPONIBLE_LOTE = ObtieneCantidadRealDisponibleEnLoteEquipos(Convert.ToInt32(filaInfoLote["CANTIDAD_DISPONIBLE"]), ID_LOTE); TextBox_CantidadProducto.Text = ""; Label_CantidadMax.Text = (CANTIDAD_TOTAL - CANTIDAD_ENTREGADA).ToString(); Label_CantidadDisponible.Text = CANTIDAD_DISPONIBLE_LOTE.ToString(); if ((CANTIDAD_TOTAL - CANTIDAD_ENTREGADA) < CANTIDAD_DISPONIBLE_LOTE) { RangeValidator_TextBox_CantidadProducto.MaximumValue = (CANTIDAD_TOTAL - CANTIDAD_ENTREGADA).ToString(); } else { RangeValidator_TextBox_CantidadProducto.MaximumValue = CANTIDAD_DISPONIBLE_LOTE.ToString(); } RangeValidator_TextBox_CantidadProducto.MinimumValue = "1"; } }
protected void DropDownList_FacturaEquipos_SelectedIndexChanged(object sender, EventArgs e) { if (DropDownList_FacturaEquipos.SelectedIndex <= 0) { Label_CantidadMaxEquipos.Text = "0"; Label_CantidadDisponibleEquipos.Text = "0"; Panel_GrillaEquipos.Visible = false; GridView_SeleccionarEquipos.DataSource = null; GridView_SeleccionarEquipos.DataBind(); } else { Entrega _entrega = new Entrega(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString()); String[] datosArray = DropDownList_FacturaEquipos.SelectedValue.Split(':'); Decimal ID_DOCUMENTO = Convert.ToDecimal(datosArray[0]); Decimal ID_LOTE = Convert.ToDecimal(datosArray[1]); DataTable tablaInfoLote = _entrega.ObtenerCantidadesEnLote(ID_DOCUMENTO, ID_LOTE); DataRow filaInfoLote = tablaInfoLote.Rows[0]; Int32 CANTIDAD_TOTAL = Convert.ToInt32(HiddenField_CANTIDAD_TOTAL_EQUIPOS.Value); Int32 CANTIDAD_ENTREGADA = Convert.ToInt32(HiddenField_CANTIDAD_ENTREGADA_EQUIPOS.Value); Int32 CANTIDAD_DISPONIBLE_LOTE = ObtieneCantidadRealDisponibleEnLote(Convert.ToInt32(filaInfoLote["CANTIDAD_DISPONIBLE"]), ID_LOTE); Label_CantidadMaxEquipos.Text = (CANTIDAD_TOTAL - CANTIDAD_ENTREGADA).ToString(); Label_CantidadDisponibleEquipos.Text = CANTIDAD_DISPONIBLE_LOTE.ToString(); DataTable tablaEuiposDisponibles = _entrega.ObtenerEquiposDisponiblesEnLote(ID_DOCUMENTO, ID_LOTE); Panel_GrillaEquipos.Visible = true; Cargar_GridView_SeleccionarEquipos_DesdeDataTable(tablaEuiposDisponibles); inhabilitarFilasGrilla(GridView_SeleccionarEquipos, 0, GridView_SeleccionarEquipos.Columns.Count - 1); } }