protected void gv_listaLocal_RowEditing(object sender, GridViewEditEventArgs e) { ViewState.Remove("datosA"); LocalBC local = new LocalBC(); ComunaBC comuna = new ComunaBC(); CaractCargaBC caracteristica = new CaractCargaBC(); DataTable dt = new DataTable(); gv_listar.SelectedIndex = e.NewEditIndex; hf_idLocal.Value = this.gv_listar.SelectedDataKey.Value.ToString(); local = local.obtenerXID(int.Parse(hf_idLocal.Value)); txt_editCodigo.Text = local.CODIGO; txt_editDesc.Text = local.DESCRIPCION; txt_editDireccion.Text = local.DIRECCION; ddl_editRegion.SelectedValue = local.REGION_ID.ToString(); hf_caracteristicasLocal.Value = local.EXCLUYENTES; hf_excluyentes.Value = local.EXCLUYENTES; hf_noexcluyentes.Value = local.NO_EXCLUYENTES; dt = caracteristica.obtenerXLocal(int.Parse(hf_idLocal.Value)); ViewState["datosA"] = dt; if (local.INTERNOS == 0) { chk_editInternos.Checked = false; } else { chk_editInternos.Checked = true; } if (local.EXTERNOS == 0) { chk_editExternos.Checked = false; } else { chk_editExternos.Checked = true; } ddl_editRegion_IndexChanged(null, null); if (ddl_editRegion.SelectedIndex != 0) { utils.CargaDrop(ddl_editComuna, "ID", "NOMBRE", comuna.obtenerComunasXRegion(int.Parse(ddl_editRegion.SelectedValue))); ddl_editComuna.SelectedValue = local.COMUNA_ID.ToString(); } ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "llenarForm", "llenarForm();", true); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "modal", "modalEditarLocal();", true); }
protected void btn_agregarCarga_Click(object sender, EventArgs e) { if (this.ViewState["id_local"] == null) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Debe seleccionar local.');", true); } else if (ddl_origenAnden.SelectedIndex <= 0) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Debe ingresar un andén de origen.');", true); } else { DataTable dt; if (ViewState["datosA"] == null) { dt = new DataTable(); dt.Columns.Add("ID_ANDEN"); dt.Columns.Add("SOLI_ID"); dt.Columns.Add("ID_LOCAL"); dt.Columns.Add("ORDEN"); dt.Columns.Add("NUMERO_LOCAL"); dt.Columns.Add("NOMBRE_LOCAL"); dt.Columns.Add("LUGA_ID"); dt.Columns.Add("ANDEN"); dt.Columns.Add("PALLETS"); dt.Columns.Add("SOES_ID"); dt.Columns.Add("SOAN_ORDEN"); ViewState["datosA"] = dt; } dt = ViewState["datosA"] as DataTable; LocalBC l = new LocalBC(); l.ID = (int)ViewState["id_local"]; l = l.obtenerXID(); //DataRow local = (DataRow)this.Session["id_local"]; int maximo = 0; try { maximo = Math.Min(Convert.ToInt32(this.Session["MaxPallet"]), l.VALOR_CARACT_MAXIMO); } catch (Exception) { maximo = l.VALOR_CARACT_MAXIMO; } if (maximo == 0) { maximo = l.VALOR_CARACT_MAXIMO; } dt.Rows.Add(this.ddl_origenAnden.SelectedValue, hf_idSolicitud.Value, l.ID, null, l.CODIGO, l.DESCRIPCION, this.ddl_origenAnden.SelectedValue, this.ddl_origenAnden.SelectedItem.Text, 0, -1, null); Ordenar(dt, true); this.gv_solLocales.DataSource = ViewState["datosA"]; this.gv_solLocales.DataBind(); this.calcula_solicitud(null, null); this.ViewState["id_local"] = null; this.txt_descLocal.Text = ""; this.txt_buscaLocal.Text = ""; } }