using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI.WebControls; using Extensiones; using System.Data; using static Extensiones.ModExtensiones; using Microsoft.Reporting.WebForms; public partial class CGame_RepEmpaque : ClsPaginas { #region PROPIEDADES private DataTable DtDatos { get { return DtDatos = (DataTable)ViewState["DtDatos"]; } set { ViewState["DtDatos"] = value; } } private int CveProduccion { get { return (ViewState["CveProduccion"] == null) ? -1 : Convert.ToInt32(ViewState["CveProduccion"]); } set { ViewState["CveProduccion"] = value; } } #endregion protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { CargaHuerta(); txtFechaI.Text = Request["FechaInicial"] == null ? DateTime.Now.ToShortDateString() : Request["FechaInicial"].ToString().ToString(); txtFechaF.Text = Request["FechaFinal"] == null ? DateTime.Now.ToShortDateString() : Request["FechaFinal"].ToString().ToString(); DdlHuerta.SelectedValueExist(Request["CveHuerta"] == null ? -1 : Request["CveHuerta"].ToString().ToEntero()); TxtFolio.Text = Request["Folio"] == null ? "" : Request["Folio"].ToString().ToString(); CveProduccion = Request["CveProduccion"] == null ? -1 : Request["CveProduccion"].ToString().ToEntero(); Consulta(); } } protected void CargaHuerta() { ClsCGame ObjCort = new ClsCGame(); if (ObjCort.GetHuerta(UsuarioActual.CveEmpresa)) { DdlHuerta.DataSource = ObjCort.DtResultados; DdlHuerta.Items.Insert(0, new ListItem("Todos", "-1")); DdlHuerta.DataBind(); } ObjCort.Dispose(); UPDatos.Update(); } protected void Consultar_Click(object sender, EventArgs e) { Consulta(); } private void Consulta() { String Folio; if (TxtFolio.Text != "") { Folio = TxtFolio.Text; } else { Folio = "-1"; } ClsCGame ObjCGame = new ClsCGame(); if (ObjCGame.GetRepProduccionResultadoDetalle(UsuarioActual.CveEmpresa, Folio, CveProduccion, DdlHuerta.SelectedValue.ToEntero(), txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate())) { GvDatos.DataSource = ObjCGame.DtResultados; DtDatos = ObjCGame.DtResultados; ObjCGame.Dispose(); } GvDatos.DataBind(); CveProduccion = -1; UPDatos.Update(); } #region GridView protected void GvDatos_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { if (e.Row.DBCampo("CveOrdenProduccion").ToEntero() < 1) { e.Row.Cells[0].Text = "No Asignada"; } if (e.Row.DBCampo("CveTipoEtiqueta").ToEntero() == 1) { e.Row.FCLabel("LblTipoEtiqueta").Text = "Si"; } else { e.Row.FCLabel("LblTipoEtiqueta").Text = "No"; } } } #endregion }