protected void ImageButton3_Click(object sender, ImageClickEventArgs e) { ArticuloId = null; ImageButton ImgB = sender as ImageButton; GridViewRow gvRow = (GridViewRow)ImgB.NamingContainer; if (!_isRefresh) { ArticuloId = ControlArticulo.BuscarXId(Convert.ToInt32(gvRow.Cells[0].Text)); if (ControlArticulo.ArtRepetidosEnElPedido(ListaArticulo, ArticuloId) == false) { ModalPopupExtender3.Show(); } else { ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "ArtIngresado();", true); TxtBuscarNombre.Text = ""; } } else { Limpiar(); Response.Redirect("AgregarPedido.aspx"); } }
protected void CustomValidator6_ServerValidate(object source, ServerValidateEventArgs args) { if (ControlArticulo.BuscarXId(Convert.ToInt32(txtcod.Text)) != null) { args.IsValid = false; } else { args.IsValid = true; } }
protected void GrillaArticulos_RowUpdating(object sender, GridViewUpdateEventArgs e) { if (!_isRefresh) { GridViewRow row = GrillaArticulos.Rows[e.RowIndex]; TextBox Txtc = (TextBox)row.Cells[4].Controls[0]; Txtc.Focus(); int CodArt = Convert.ToInt32(row.Cells[0].Text); int nropedido = Convert.ToInt32(txtnropedidomostrar.Text); Articulo ArticuloAux = ControlArticulo.BuscarXId(CodArt); if (ArticuloAux != null) { if ((!string.IsNullOrEmpty(Txtc.Text))) { if (Int32.TryParse(Txtc.Text, out int result)) { if (Convert.ToInt32(Txtc.Text) > 0) { DetallePedidoDTO AuxiDetalle = ListaDetalleDTO[e.RowIndex]; if (AuxiDetalle.Cantidad > Convert.ToInt32(Txtc.Text))//cantidad sdisminuye { AuxiDetalle.Cantidad = Convert.ToInt32(Txtc.Text); GrillaArticulos.EditIndex = -1; RefrescarTabla(); } else { int cant = Convert.ToInt32(Txtc.Text) - AuxiDetalle.Cantidad; if (StockInsuficiente(ArticuloAux, cant)) { ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "errorStockInsu();", true); } else { AuxiDetalle.Cantidad = AuxiDetalle.Cantidad + cant; GrillaArticulos.EditIndex = -1; RefrescarTabla(); } } } else { ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "errornega();", true); } } else { ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "errornvalorinco();", true); } } else { ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "errorvacio();", true); } } } else { Response.Redirect("EditarPedido.aspx"); } }