Esempio n. 1
0
        public void ReportView()
        {
            try
            {
                var manifiestoEncabezado = Convert.ToInt32(Session["MANIFEST_HEADER"]);

                var centroDeDistribucionId = Convert.ToInt32(UiListaDeCentrosDeDistribucion.GridView.GetRowValues(UiListaDeCentrosDeDistribucion.GridView.FocusedRowIndex, "DISTRIBUTION_CENTER_ID").ToString());

                var pResult      = "";
                var dsEncabezado = _objManifest.GetManifestHeader(Session["connectionString"].ToString(), manifiestoEncabezado, ref pResult);
                var dsDetalle    = _objManifest.GetManifestDetails(Session["connectionString"].ToString(), manifiestoEncabezado, ref pResult);
                var dsConductor  = _objManifest.GetDriverAndVehicleByManifest(Session["connectionString"].ToString(), manifiestoEncabezado, centroDeDistribucionId, ref pResult);

                if (pResult == "")
                {
                    var centroDeDistribucion = ""; var logo = "";

                    logo = dsConductor.Rows[0]["LOGO_IMG"].ToString();

                    centroDeDistribucion = UiListaDeCentrosDeDistribucion.GridView.GetRowValues(UiListaDeCentrosDeDistribucion.GridView.FocusedRowIndex, "NAME_DISTRIBUTION_CENTER").ToString();
                    if (centroDeDistribucion == "" || centroDeDistribucion == "Ningun Centro de Distribución")
                    {
                        logo = Session["LOGO_IMG"].ToString();
                    }
                    else
                    {
                        logo = UiListaDeCentrosDeDistribucion.GridView.GetRowValues(UiListaDeCentrosDeDistribucion.GridView.FocusedRowIndex, "LOGO_IMG").ToString();
                    }

                    var ds = new System.Data.DataSet();
                    ds.Tables.Add(dsEncabezado);
                    ds.Tables.Add(dsDetalle);
                    ds.Tables.Add(dsConductor);
                    var reporte = new Report.ManifiestoReporte
                    {
                        DataSource = ds
                    };
                    reporte.Parameters["destination"].Value        = UiTextoDestino.Text;
                    reporte.Parameters["distributionCenter"].Value = centroDeDistribucion;
                    reporte.Parameters["logoImg"].Value            = logo;
                    reporte.Parameters["manifestHeader"].Value     = manifiestoEncabezado;
                    reporte.Parameters["nameEnterprice"].Value     = Session["NAME_ENTERPRISE"].ToString();

                    Session["DSDISEÑOMANIFEST"] = ds;
                    ASPxDocumentViewer1.Report  = reporte;
                    ASPxDocumentViewer1.DataBind();
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('" + pResult + "');", true);
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText",
                                                    "CallError('Error: " + ex.Message + "');", true);
            }
        }
Esempio n. 2
0
        public void ReportView()
        {
            try
            {
                var manifiestoEncabezado   = Convert.ToInt32(Session["MANIFEST_HEADER"]);
                var centroDeDistribucionId = Convert.ToInt32(UiListaDeCentrosDeDistribucion.GridView.GetRowValues(UiListaDeCentrosDeDistribucion.GridView.FocusedRowIndex, "DISTRIBUTION_CENTER_ID").ToString());
                var pResult     = "";
                var dsConductor = _objManifest.GetDriverAndVehicleByManifest(Session["connectionString"].ToString(), manifiestoEncabezado, centroDeDistribucionId, ref pResult);
                if (pResult == "")
                {
                    var centroDeDistribucion = ""; var logo = "";

                    logo = dsConductor.Rows[0]["LOGO_IMG"].ToString();

                    centroDeDistribucion = UiListaDeCentrosDeDistribucion.GridView.GetRowValues(UiListaDeCentrosDeDistribucion.GridView.FocusedRowIndex, "NAME_DISTRIBUTION_CENTER").ToString(); //"Ningun Centro de Distribución";
                    if (centroDeDistribucion == "" || centroDeDistribucion == "Ningun Centro de Distribución")
                    {
                        logo = Session["LOGO_IMG"].ToString();
                    }
                    else
                    {
                        logo = UiListaDeCentrosDeDistribucion.GridView.GetRowValues(UiListaDeCentrosDeDistribucion.GridView.FocusedRowIndex, "LOGO_IMG").ToString();
                    }

                    UsuarioDeseaObtenerReporteManifiesto.Invoke(new object(), new ManifiestoArgumento {
                        ManifiestoEncabezado = new ManifiestoEncabezado {
                            MANIFEST_HEADER = manifiestoEncabezado
                        }
                    });
                    var ds           = new System.Data.DataSet();
                    var dsDetalle = MobilityScm.Utilerias.ListToDataTableClass.ListToDataTable <ReporteManifiestoDetalle>(ReporteManifiestoDetalles.ToList());
                    dsDetalle.TableName = "MANIFEST_BY_SKU";
                    var dsEncabezado = MobilityScm.Utilerias.ListToDataTableClass.ListToDataTable <ReporteManifiestoEncabezado>(ReporteManifiestoEncabezados.ToList());
                    dsEncabezado.TableName = "MANIFEST_BY_CUSTOMER";
                    ds.Tables.Add(dsEncabezado);
                    ds.Tables.Add(dsDetalle);
                    ds.Tables.Add(dsConductor);
                    var reporte = new Report.ManifiestoReporte
                    {
                        DataSource = ds
                    };
                    reporte.Parameters["destination"].Value        = UiTextoDestino.Text;
                    reporte.Parameters["distributionCenter"].Value = centroDeDistribucion;
                    reporte.Parameters["logoImg"].Value            = logo;
                    reporte.Parameters["manifestHeader"].Value     = manifiestoEncabezado;
                    reporte.Parameters["nameEnterprice"].Value     = Session["NAME_ENTERPRISE"].ToString();

                    Session["DSDISEÑOMANIFEST"] = ds;
                    UiDocumentoVistaReporteManifiesto.Report = reporte;
                    UiDocumentoVistaReporteManifiesto.DataBind();
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('" + pResult + "');", true);
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText",
                                                    "CallError('Error: " + ex.Message + "');", true);
            }
        }