protected bool ValidarDatos() { if (this.gvAlquileres.SelectedRow == null) { lb_error.Text = "Debe seleccionar un alquiler."; return false; } else { //Modelo_Entidades.Alquiler oAlquiler = oListaAlquileres[this.gvAlquileres.SelectedIndex]; if (gvAlquileres.SelectedRow.Cells[5].Text != "Activo") { lb_error.Text = "Debe seleccionar un alquiler válido."; return false; } } //if (string.IsNullOrEmpty(this.cmb_tipofertilizante.Text)) //{ // lb_error.Text = "Primero debe seleccionar un tipo de fertilizante."; // return false; //} if ((cmb_tipofertilizante.SelectedIndex == null) || (cmb_tipofertilizante.SelectedIndex == -1)) { lb_error.Text = "Primero debe seleccionar un tipo de fertilizante."; return false; } oProducto = oListaProductos[cmb_tipofertilizante.SelectedIndex]; if(oProducto == null) { oProducto = oListaProductos[cmb_tipofertilizante.SelectedIndex]; } if (string.IsNullOrEmpty(this.txt_cantidadenkg.Text)) { lb_error.Text = "Primero debe ingresar la cantidad de fertilizante."; return false; } if (string.IsNullOrEmpty(this.txt_numerodocumento.Text)) { lb_error.Text = "Primero debe ingresar el número del documento."; return false; } //if (oProducto == null) //{ // lb_error.Text = "Primero debe sellecionar un tipo de fertilizante. oProducto Nulo."; // return false; //} return true; }
private void LeerDeSesion() { oOperacion = (Modelo_Entidades.Operacion)HttpContext.Current.Session["Operacion"]; oAlquiler = (Modelo_Entidades.Alquiler)HttpContext.Current.Session["Alquiler"]; oProducto = (Modelo_Entidades.Producto)HttpContext.Current.Session["Producto"]; oListaAlquileres = (List<Modelo_Entidades.Alquiler>)HttpContext.Current.Session["ListaAlquileres"]; oListaTiposOperacion = (List<Modelo_Entidades.Tipo_Operacion>)HttpContext.Current.Session["ListaTipos"]; oListaProductos = (List<Modelo_Entidades.Producto>)HttpContext.Current.Session["ListaProductos"]; oListaEstadosOperacion = (List<Modelo_Entidades.Estado_Operacion>)HttpContext.Current.Session["ListaEstado"]; }
protected void cmb_tipofertilizante_SelectedIndexChanged(object sender, EventArgs e) { message.Visible = false; tipofertilizante = cmb_tipofertilizante.Text.ToString(); //oProducto = oCCUGProductos.ObtenerProducto(tipofertilizante); oProducto = oListaProductos[cmb_tipofertilizante.SelectedIndex]; }