private void ObtenerLocal(bool forzarBD) { if (ViewState["lista"] == null || forzarBD) { LocalBC local = new LocalBC(); DataTable dt = local.obtenerTodoLocal(); ViewState["lista"] = dt; ViewState.Remove("filtrados"); } DataView dw; if (ViewState["filtrados"] == null) { dw = new DataView((DataTable)ViewState["lista"]); } else { dw = new DataView((DataTable)ViewState["filtrados"]); } if (ViewState["sortExpresion"] != null && ViewState["sortExpresion"].ToString() != "") { dw.Sort = (String)ViewState["sortExpresion"]; } this.gv_listar.DataSource = dw; this.gv_listar.DataBind(); }
protected void ddl_tipoDestino_SelectedIndexChanged(object sender, EventArgs e) { if (ddl_tipoDestino.SelectedIndex > 0) { //DestinoTipoBC desti = new DestinoTipoBC(); DataTable dt; //desti = desti.ObtenerSeleccionado(Convert.ToInt32(ddl_tipoDestino.SelectedValue), null); if (ddl_tipoDestino.SelectedValue == "DLPR") { LocalBC l = new LocalBC(); dt = l.obtenerTodoLocal(); utils.CargaDrop(ddl_destino, "ID", "DESCRIPCION", dt); } else { DestinoBC d = new DestinoBC(); dt = d.ObtenerXTipo(ddl_tipoDestino.SelectedValue); utils.CargaDrop(ddl_destino, "ID", "NOMBRE", dt); } if (dt.Rows.Count > 0) { ddl_destino.Enabled = true; } else { ddl_destino.Enabled = false; } } }
protected void btn_agregarCarga_Click(object sender, EventArgs e) { string local = this.txt_buscaLocal.Text; if (this.ComprobarLocalExistente(local)) { DataTable dt = (DataTable)this.ViewState["locales"]; int soli_id = Convert.ToInt32(this.hf_soliId.Value); int soan_orden, loca_id, sold_orden; string anden; int soes_id = 100; int luga_id = Convert.ToInt32(ddl_origenAnden.SelectedValue); anden = ddl_origenAnden.SelectedItem.Text; if (ProxSoanOrden(luga_id, out soan_orden)) { DataTable dt2 = (DataTable)this.ViewState["andenes"]; dt2.Rows.Add(soli_id, soan_orden, luga_id, anden, soes_id, null, ddl_origenAnden.SelectedValue, ddl_origenAnden.SelectedItem.Text); ViewState["andenes"] = dt2; } LocalBC l = new LocalBC(); l = l.obtenerXCodigo(local); if (txt_destinoPallets.Text == "") { txt_destinoPallets.Text = "0"; } int maximo = l.VALOR_CARACT_MAXIMO; 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; } loca_id = l.ID; sold_orden = this.ProxSoldOrden(soan_orden); anden = anden.Trim(); dt.Rows.Add(soli_id, luga_id, anden, soan_orden, sold_orden, loca_id, l.CODIGO, l.DESCRIPCION, l.VALOR_CARACT_MAXIMO, null); txt_descLocal.Text = ""; txt_buscaLocal.Text = ""; txt_destinoPallets.Text = "0"; ViewState["locales"] = dt; ObtenerLocalesSolicitud(false); calcula_solicitud(null, null); ddl_playaDescarga_SelectedIndexChanged(null, null); } else { utils.ShowMessage2(this, "buscarTrailer", "warn_andenLocalVacio"); } }
protected void btn_editGrabar_Click(object sender, EventArgs e) { LocalBC local = new LocalBC(); local.DESCRIPCION = txt_editDesc.Text; local.DIRECCION = txt_editDireccion.Text; local.COMUNA_ID = int.Parse(ddl_editComuna.SelectedValue); local.REGION_ID = int.Parse(ddl_editRegion.SelectedValue); local.CODIGO = txt_editCodigo.Text; if (chk_editInternos.Checked) { local.INTERNOS = 1; } else { local.INTERNOS = 0; } if (chk_editExternos.Checked) { local.EXTERNOS = 1; } else { local.EXTERNOS = 0; } local.EXCLUYENTES = hf_excluyentes.Value; local.NO_EXCLUYENTES = hf_noexcluyentes.Value; //ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "msj1", "alert('Excluyentes: " + hf_excluyentes.Value + "');", true); //ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "msj2", "alert('No Excluyentes: " + hf_noexcluyentes.Value + "');", true); if (hf_idLocal.Value == "") { if (local.Crear(local)) { ObtenerLocal(true); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "modal", "alert('Local creado exitosamente');", true); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cerrar", "cerrarModal('modalLocal');", true); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "modal", "alert('Ocurrió un error al agregar local. Intente nuevamente.');", true); } } else { local.ID = int.Parse(hf_idLocal.Value); if (local.Modificar(local)) { ObtenerLocal(true); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "modal", "alert('Local modificado exitosamente');", true); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cerrar", "cerrarModal('modalLocal');", true); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "modal", "alert('Ocurrió un error al modificar local. Intente nuevamente.');", true); } } }
protected void txt_reanudarCodLocal_TextChanged(object sender, EventArgs e) { LocalBC l = new LocalBC(); l = l.obtenerXCodigo(this.txt_reanudarCodLocal.Text); if (l.ID != 0) { this.txt_reanudarLocal.Text = string.Format("{0}({1})", l.CODIGO2, l.VALOR_CARACT_MAXIMO); } else { this.txt_reanudarCodLocal.Text = ""; this.txt_reanudarLocal.Text = "Local no encontrado"; } }
protected void btn_EliminarLocal_Click(object sender, EventArgs e) { LocalBC local = new LocalBC(); if (local.Eliminar(int.Parse(hf_idLocal.Value))) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "modal", "alert('Local eliminado exitosamente');", true); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "modal", "alert('Ocurrió un error al eliminar local. Revise si tiene otros datos asociados');", true); } ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cerrar", "cerrarModal('modalConfirmacion');", true); ObtenerLocal(true); }
protected void txt_buscaLocal_TextChanged(object sender, EventArgs e) { LocalBC l = new LocalBC(); l = l.obtenerXCodigo(this.txt_buscaLocal.Text); if (l.ID != 0) { this.ViewState["id_local"] = l.ID; this.txt_descLocal.Text = string.Format("{0}({1})", l.CODIGO2, l.VALOR_CARACT_MAXIMO); } else { this.ViewState["id_local"] = null; this.txt_descLocal.Text = "Local no encontrado"; } }
protected void txt_buscaLocal_TextChanged(object sender, EventArgs e) { LocalBC l = new LocalBC(); l = l.obtenerXCodigo(this.txt_buscaLocal.Text); if (l.ID != 0) { this.txt_descLocal.Text = string.Format("{0}({1})", l.CODIGO2, l.VALOR_CARACT_MAXIMO); this.ddl_origenAnden.Enabled = true; } else { this.txt_buscaLocal.Text = ""; this.txt_descLocal.Text = "Local no encontrado"; this.ddl_origenAnden.Enabled = false; } }
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); }
public bool Modificar(LocalBC local) { return(tran.Local_Modificar(local)); }
public bool Crear(LocalBC local) { return(tran.Local_Crear(local)); }
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 = ""; } }
protected void btn_agregarCarga_Click(object sender, EventArgs e) { string local = this.txt_reanudarCodLocal.Text; if (!ComprobarLocalExistente(local)) { utils.ShowMessage2(this, "locales", "warn_andenExiste"); return; } DataTable dt = (DataTable)this.ViewState["locales"]; int soli_id = Convert.ToInt32(this.hf_soliId.Value); int luga_id = 0; int soan_orden = 0; int loca_id = 0; int sold_orden = 0; string anden = ""; int soes_id = 100; switch (hf_accion.Value) { case "Locales": luga_id = Convert.ToInt32(this.ddl_reanudarAnden.SelectedValue.Split(",".ToCharArray())[1]); anden = this.ddl_reanudarAnden.SelectedItem.Text.Split("-".ToCharArray())[1]; soan_orden = Convert.ToInt32(this.ddl_reanudarAnden.SelectedValue.Split(",".ToCharArray())[2]); break; case "AndenEmergencia": luga_id = Convert.ToInt32(this.ddl_reanudarAnden.SelectedValue); anden = this.ddl_reanudarAnden.SelectedItem.Text; if (ProxSoanOrden(luga_id, out soan_orden)) { DataTable dt2 = (DataTable)ViewState["andenes"]; dt2.Rows.Add(soli_id, soan_orden, luga_id, anden, soes_id, null, ddl_reanudarAnden.SelectedValue, ddl_reanudarAnden.SelectedItem.Text); ViewState["andenes"] = dt2; } break; case "Continuar": luga_id = Convert.ToInt32(this.ddl_reanudarAnden.SelectedValue); anden = this.ddl_reanudarAnden.SelectedItem.Text; if (OrdenCorrecto(luga_id)) { if (ProxSoanOrden(luga_id, out soan_orden)) { DataTable dt2 = (DataTable)ViewState["andenes"]; dt2.Rows.Add(soli_id, soan_orden, luga_id, anden, soes_id, null, ddl_reanudarAnden.SelectedValue, ddl_reanudarAnden.SelectedItem.Text); ViewState["andenes"] = dt2; } } else { utils.ShowMessage2(this, "locales", "warn_ordenIncorrecto"); return; } break; } LocalBC l = new LocalBC(); l = l.obtenerXCodigo(this.txt_reanudarCodLocal.Text); loca_id = l.ID; sold_orden = this.ProxSoldOrden(soan_orden); anden = anden.Trim(); dt.Rows.Add(soli_id, luga_id, anden, soan_orden, sold_orden, loca_id, l.CODIGO, l.DESCRIPCION, null, null); this.ViewState["locales"] = dt; this.ObtenerLocalesSolicitud(false); this.calcula_solicitud(this.hf_caractSolicitud.Value, dt); if (hf_accion.Value == "AndenEmergencia") { txt_reanudarLocal.Enabled = false; txt_reanudarCodLocal.Enabled = false; btn_agregarCarga.Enabled = false; ddl_reanudarAnden.Enabled = false; } else { this.txt_reanudarLocal.Text = ""; this.txt_reanudarCodLocal.Text = ""; } }