private void CargarInicial() { var usuarioInfo = ObtenerUsuarioInfo(); var tablaMaestraInfo = new TablaMaestra().Listar(0, Constantes.TablaTamanioPagina).Where(x => x.Activo.Equals(1)).ToList(); LlenarCombo(ddlNumeroRegistros, tablaMaestraInfo, "NombreCorto", "NombreLargo"); ddlNumeroRegistros.SelectedValue = "5"; var listaAlmacen = new Negocio.Almacen().Listar(0); LlenarCombo(ddlAlmacen, listaAlmacen, "AlmacenId", "Nombre"); ddlAlmacen.Items.Insert(0, new ListItem(Constantes.Seleccione, Constantes.Seleccione_Value)); LlenarCombo(ddlAlmacenOrigen, listaAlmacen, "AlmacenId", "Nombre"); LlenarCombo(ddlAlmacenDestino, listaAlmacen, "AlmacenId", "Nombre"); ddlAlmacenDestino.Items.Insert(0, new ListItem(Constantes.Seleccione, Constantes.Seleccione_Value)); var listaUsuario = new Negocio.Usuario().Listar(0, "", "", "", Constantes.PerfilAdministrador, 0); foreach (var usuario in listaUsuario) { ddlResponsable.Items.Add(new ListItem(usuario.Nombres + "," + usuario.ApellidoPaterno + " " + usuario.ApellidoMaterno, usuario.UsuarioId.ToString())); } ddlResponsable.Items.Insert(0, new ListItem(Constantes.Seleccione, Constantes.Seleccione_Value)); }
protected void btnGuardarAlmacen_OnClick(object sender, EventArgs e) { var empresaId = Convert.ToInt32(Request["EmpresaId"]); var usuarioInfo = ObtenerUsuarioInfo(); var script = new StringBuilder(String.Empty); var mensaje = String.Empty; var almacenId = Convert.ToInt32(hdnAlmacenId.Value); #region Datos Almacen var almacenInfo = new AlmacenInfo(); almacenInfo.AlmacenId = Convert.ToInt32(hdnAlmacenId.Value); almacenInfo.EmpresaId = Convert.ToInt32(ddlEmpresa.SelectedValue); almacenInfo.Codigo = txtCodigo.Text.Trim(); almacenInfo.Nombre = txtNombre.Text.Trim(); almacenInfo.Descripcion = txtDescripcion.Text.Trim(); almacenInfo.Direccion = txtDireccion.Text.Trim(); almacenInfo.Activo = (chkActivo.Checked) ? 1 : 0; #endregion if (almacenId.Equals(0)) { almacenInfo.UsuarioCreacionId = usuarioInfo.UsuarioId; almacenId = new Negocio.Almacen().Insertar(almacenInfo); if (almacenId > 0) { script.Append("document.getElementById('hdnAlmacenId').value = " + almacenId + ";"); mensaje = "Se registró la Almacen correctamente"; } else { mensaje = "Ya existe una Almacen registrado con el nombre: " + txtNombre.Text.Trim(); } } else { almacenInfo.UsuarioModificacionId = usuarioInfo.UsuarioId; almacenId = new Negocio.Almacen().Actualizar(almacenInfo); if (almacenId > 0) { mensaje = "Se actualizó la Almacen correctamente"; } else { mensaje = "Ya existe una Almacen registrada con el nombre: " + txtNombre.Text.Trim(); } } script.Append("MostrarMensaje('" + mensaje + "');"); script.Append("LimpiarAlmacen();"); script.Append("var modalDialog = $find('mpeAlmacen'); modalDialog.hide();"); CargarDatos(empresaId); RegistrarScript(script.ToString(), "GuardarAlmacen"); }
private void CargarDatos(int empresaId) { var script = new StringBuilder(""); grvAlmacen.DataBind(); int numeroRegistros = Convert.ToInt16(ddlNumeroRegistros.SelectedValue); int numeroPagina = Convert.ToInt16(ViewState["PageIndex"]); int indicePagina = numeroPagina == 0 ? 0 : numeroPagina - 1; pageIndex = indicePagina + 1; var almacenInfoLista = new Negocio.Almacen().ListarPaginado(0, empresaId, numeroRegistros, indicePagina); grvAlmacen.DataSource = almacenInfoLista; grvAlmacen.DataBind(); if (almacenInfoLista.Count > 0) { grvAlmacen.HeaderRow.Attributes["style"] = "display: none"; grvAlmacen.UseAccessibleHeader = true; grvAlmacen.HeaderRow.TableSection = TableRowSection.TableHeader; } rowCount = almacenInfoLista.Count > 0 ? almacenInfoLista.First().TotalFilas : 0; pageCount = CalcPageCount(rowCount); ViewState["PageCount"] = pageCount; #region Texto del Pie de Página if (almacenInfoLista.Count > 0) { if (numeroRegistros == 0) { lblPaginacion.Text = "Página " + pageIndex.ToString("") + " de 1, con un Total de " + rowCount.ToString("") + " registros"; script.Append("document.getElementById('lblPaginacion').innerText = '"); script.Append("Página " + pageIndex.ToString("") + " de 1, con un Total de " + rowCount.ToString("") + " registros';"); } else { lblPaginacion.Text = "Página " + pageIndex.ToString("") + " de " + pageCount.ToString("") + ", con un Total de " + rowCount.ToString("") + " registros"; script.Append("document.getElementById('lblPaginacion').innerText = '"); script.Append("Página " + pageIndex.ToString("") + " de " + pageCount.ToString("") + ", con un Total de " + rowCount.ToString("") + " registros';"); } } else { lblPaginacion.Text = "No se obtuvieron resultados"; script.Append("document.getElementById('lblPaginacion').innerText = 'No se obtuvieron resultados';"); } #endregion RefreshPageButtons(); RegistrarScript(script.ToString(), "Paginacion"); }
private void CargarInicial() { var usuarioInfo = ObtenerUsuarioInfo(); var tablaMaestraInfo = new TablaMaestra().Listar(0, Constantes.TablaTamanioPagina).Where(x => x.Activo.Equals(1)).ToList(); LlenarCombo(ddlNumeroRegistros, tablaMaestraInfo, "NombreCorto", "NombreLargo"); ddlNumeroRegistros.SelectedValue = "5"; var listaAlmacen = new Negocio.Almacen().Listar(0); LlenarCombo(ddlAlmacen, listaAlmacen, "AlmacenId", "Nombre"); ddlAlmacen.Items.Insert(0, new ListItem(Constantes.Seleccione, Constantes.Seleccione_Value)); }
protected void btnCargarAlmacen_OnClick(object sender, EventArgs e) { var empresaId = Convert.ToInt32(Request["EmpresaId"]); grvAlmacen.DataBind(); var almacenInfoLista = new Negocio.Almacen().ListarPaginado(0, empresaId, 0, 0); grvAlmacen.DataSource = almacenInfoLista; grvAlmacen.DataBind(); if (almacenInfoLista.Count > 0) { grvAlmacen.HeaderRow.Attributes["style"] = "display: none"; grvAlmacen.UseAccessibleHeader = true; grvAlmacen.HeaderRow.TableSection = TableRowSection.TableHeader; } }
private void CargarInicial() { var tablaMaestraInfo = new TablaMaestra().Listar(0, Constantes.TablaTipoComprobanteCompra).Where(x => x.Activo.Equals(1)).ToList(); LlenarCombo(ddlTipoComprobante, tablaMaestraInfo, "Codigo", "NombreLargo"); ddlTipoComprobante.Items.Insert(0, new ListItem(Constantes.Seleccione, Constantes.Seleccione_Value)); tablaMaestraInfo = new TablaMaestra().Listar(0, Constantes.TablaMoneda).Where(x => x.Activo.Equals(1)).ToList(); LlenarCombo(ddlMoneda, tablaMaestraInfo, "Codigo", "NombreLargo"); ddlMoneda.Items.Insert(0, new ListItem(Constantes.Seleccione, Constantes.Seleccione_Value)); //tablaMaestraInfo = new TablaMaestra().Listar(0, Constantes.TablaMotivoIngresoCompra).Where(x => x.Activo.Equals(1)).ToList(); //LlenarCombo(ddlMotivoIngreso, tablaMaestraInfo, "Codigo", "NombreLargo"); ddlMotivoIngreso.Items.Insert(0, new ListItem(Constantes.Seleccione, Constantes.Seleccione_Value)); tablaMaestraInfo = new TablaMaestra().Listar(0, Constantes.TablaUnidades).Where(x => x.Activo.Equals(1)).ToList(); LlenarCombo(ddlUnidad, tablaMaestraInfo, "Codigo", "NombreCorto"); ddlUnidad.Items.Insert(0, new ListItem(Constantes.Seleccione, Constantes.Seleccione_Value)); var listaAlmacen = new Negocio.Almacen().Listar(0).Where(x => x.Activo.Equals(1)).ToList(); LlenarCombo(ddlAlmacen, listaAlmacen, "AlmacenId", "Nombre"); ddlAlmacen.Items.Insert(0, new ListItem(Constantes.Seleccione, Constantes.Seleccione_Value)); }