Ejemplo n.º 1
0
        protected override void ExportToCsv()
        {
            var csv = new GridToCSVBuilder(Usuario.CsvSeparator);

            csv.GenerateHeader(CultureManager.GetMenu(VariableName), GetFilterValues());

            var g           = Grid;
            var allowPaging = Grid.AllowPaging;

            g.AllowPaging = false;

            Bind();

            GenerateCSVColumns(csv);

            GenerateCSVSubColumns(csv);

            GenerateCSVFields(csv);

            SetCsvSessionVars(csv.Build());

            OpenWin(string.Concat(ApplicationPath, "Common/exportCSV.aspx"), CultureManager.GetSystemMessage("EXPORT_CSV_DATA"));

            g.AllowPaging = allowPaging;
        }
Ejemplo n.º 2
0
        protected override void BtnSearchClick(object sender, EventArgs e)
        {
            base.BtnSearchClick(sender, e);

            var desde = SecurityExtensions.ToDataBaseDateTime(dpDesde.SelectedDate.GetValueOrDefault());
            var hasta = SecurityExtensions.ToDataBaseDateTime(dpHasta.SelectedDate.GetValueOrDefault());

            Stadistics = ReportFactory.OperatorStadisticsDAO.GetOperatorStadistics(ddlEmpleado.Selected, desde, hasta);

            var showResults = Stadistics != null && Stadistics.HasActiveDays();

            if (showResults)
            {
                OperatorMobiles = ReportFactory.OperatorMobilesDAO.GetOperatorMobiles(ddlEmpleado.Selected, desde, hasta).Select(om => new OperatorMobilesVo(om)).ToList();

                AddResultsToSession();
            }

            ifDetalleVehiculo.Visible = ifMoviles.Visible = showResults;

            if (NotFound != null)
            {
                NotFound.Text = !showResults?CultureManager.GetSystemMessage("NO_RESULT_FOR_CURRENT_FILTERS") : null;
            }
        }
Ejemplo n.º 3
0
        private void AddNoDetailsScript()
        {
            var interno         = GridUtils.GetCell(Grid.SelectedRow, MobilePositionVehicleVo.IndexVehiculoId).Text;
            var noDetailsScript = string.Format(string.Concat("alert('", CultureManager.GetSystemMessage("NO_POSITIONS_MOBILE"), "');"), interno);

            ScriptManager.RegisterStartupScript(this, typeof(string), "NoDetails", noDetailsScript, true);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Report data binding.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            var            showResults = false;
            MobileActivity activity    = null;

            if (!To.ToShortDateString().Equals(DateTime.UtcNow.ToShortDateString()))
            {
                activity = GetResults();

                showResults = activity != null;
            }

            if (showResults)
            {
                DisplayResults(activity);
            }
            else
            {
                infoLabel1.Mode = InfoLabelMode.INFO;

                infoLabel1.Text = CultureManager.GetSystemMessage(NoRouteInfo);
            }

            var mobile = activity != null ? activity.Movil : DAOFactory.CocheDAO.FindById(Mobile).Interno;

            lblTitle.Text = string.Format(CultureManager.GetLabel(RepGeocercasTitle), mobile);

            tblResults.Visible = showResults;

            lnkResumenDeRuta.Enabled = showResults;
        }
Ejemplo n.º 5
0
        protected override void ExportToCsv()
        {
            var builder = new GridToCSVBuilder(Usuario.CsvSeparator);

            var g = Grid;

            g.AllowPaging = false;
            g.DataSource  = GetResults();
            g.DataBind();

            builder.GenerateHeader(CultureManager.GetMenu("COMB_CONSISTENCIA_STOCK"), GetFilterValues());

            builder.GenerateColumns(/*new List<string>(),*/ g);

            builder.GenerateFields(g);

            builder.GenerateColumns(/*null, */ gridSubTotales);

            builder.GenerateFields(gridSubTotales);

            SetCsvSessionVars(builder.Build());

            OpenWin(string.Concat(ApplicationPath, "Common/exportCSV.aspx"), CultureManager.GetSystemMessage("EXPORT_CSV_DATA"));

            g.AllowPaging = true;
        }
Ejemplo n.º 6
0
        protected override void ExportToCsv()
        {
            var builder = new GridToCSVBuilder(Usuario.CsvSeparator);

            var g           = gridResumen;
            var allowPaging = gridResumen.AllowPaging;

            var distribuciones = GetDistribuciones(new[] { -1 });
            var controladas    = distribuciones.Where(d => d.Controlado).Select(d => new ViajeDistribucionVo(d)).ToList();

            g.AllowPaging = false;
            g.DataSource  = controladas;
            g.DataBind();

            builder.GenerateHeader(CultureManager.GetMenu(VariableName), GetFilterValues());
            builder.GenerateColumns(g);
            builder.GenerateFields(g);

            Session["CSV_EXPORT"]    = builder.Build();
            Session["CSV_FILE_NAME"] = CultureManager.GetMenu(Module.Name);

            OpenWin(String.Concat(ApplicationPath, "Common/exportCSV.aspx"), CultureManager.GetSystemMessage("EXPORT_CSV_DATA"));

            g.AllowPaging = allowPaging;
        }
Ejemplo n.º 7
0
        protected override void ExportToExcel()
        {
            var path = HttpContext.Current.Request.Url.AbsolutePath;

            path = Path.GetFileNameWithoutExtension(path) + ".xlsx";

            var builder = new GridToExcelBuilder(path, Usuario.ExcelFolder);

            var list = GetExcelItemList();

            if (list.Count > 5000)
            {
                ShowInfo(CultureManager.GetLabel("EXCEL_DEMASIADOS_MENSAJES"));
                return;
            }

            builder.GenerateHeader(CultureManager.GetMenu(VariableName), GetFilterValues());
            builder.AddExcelItemList(list);

            var results = GetMixedReportResults();

            builder.GenerateColumns(results);
            builder.GenerateFields(results);

            SetExcelSessionVars(builder.CloseAndSave());

            OpenWin(String.Concat(ApplicationPath, "Common/exportExcel.aspx"), CultureManager.GetSystemMessage("EXPORT_CSV_DATA"));
        }
Ejemplo n.º 8
0
        //private bool StartDistribucion(int id)
        //{
        //    var distribucion = DAOFactory.ViajeDistribucionDAO.FindById(id);

        //    if (distribucion.Estado != ViajeDistribucion.Estados.Pendiente) return false;
        //    var ciclo = new CicloLogisticoDistribucion(distribucion, DAOFactory, new MessageSaver(DAOFactory));
        //    IEvent evento = new InitEvent(DateTime.UtcNow);

        //    ciclo.ProcessEvent(evento);
        //    return true;
        //}

        protected void BtIniciarClick(object sender, EventArgs e)
        {
            mpePanel.Hide();
            if (TicketToInitId.Get() <= 0)
            {
                return;
            }


            var ticket = DAOFactory.ViajeDistribucionDAO.FindById(TicketToInitId.Get());

            TicketToInitId.Set(-1);

            var ciclo = new CicloLogisticoDistribucion(ticket, DAOFactory, new MessageSaver(DAOFactory));

            var evento = new InitEvent(DateTime.UtcNow);

            try
            {
                ciclo.ProcessEvent(evento);
                ShowInfo(CultureManager.GetSystemMessage("CLOG_START_SENT") + ticket.Vehiculo.Interno);
                Bind();
            }
            catch (NoVehicleException)
            {
                ShowError(new ApplicationException(CultureManager.GetError("TICKET_NO_VEHICLE_ASSIGNED")));
            }
            catch //AlreadyOpenException, QueueException, Exception
            {
                ShowError(new ApplicationException(CultureManager.GetError("CLOG_MESSAGE_NOT_SENT") + ticket.Vehiculo.Interno));
            }
        }
Ejemplo n.º 9
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (EditMode && EditObject.Estado == Ticket.Estados.Anulado)
            {
                var text   = CultureManager.GetSystemMessage("TICKET_ANULADO_USER_DAY_REASON");
                var user   = EditObject.UsuarioAnulacion != null ? EditObject.UsuarioAnulacion.NombreUsuario : " ";
                var fecha  = EditObject.FechaAnulacion.HasValue ? EditObject.FechaAnulacion.Value.ToDisplayDateTime().ToString("dd/MM/yyyy HH:mm") : " ";
                var motivo = EditObject.MotivoAnulacion;
                ShowInfo(string.Format(text, string.Concat("<b>", user, "</b>"), string.Concat("<b>", fecha, "</b>"), string.Concat("<b>", motivo, "</b>")));
            }

            if (IsPostBack)
            {
                return;
            }

            if (!EditMode)
            {
                dtFecha.SetDate();
            }

            BindEstados();

            lblOrdenDiarioText.Visible = lblOrdenDiario.Visible = EditMode;
        }
Ejemplo n.º 10
0
        private void SendMessage(string cmd, string par)
        {
            if (cbSubEntidadMensaje.SelectedIndex < 0)
            {
                JsAlert(string.Format(CultureManager.GetError("NO_SELECTED"), CultureManager.GetEntity("PARENTI81")));
                return;
            }

            var ok    = 0;
            var error = 0;

            var sent   = string.Empty;
            var failed = string.Empty;

            foreach (ListItem li in cbSubEntidadMensaje.Items)
            {
                if (!li.Selected)
                {
                    continue;
                }

                var c = DAOFactory.SubEntidadDAO.FindById(Convert.ToInt32(li.Value));

                if (c.Sensor == null || c.Sensor.Dispositivo == null)
                {
                    JsAlert(string.Format(CultureManager.GetSystemMessage("UNASIGNED_VEHICLE"), c.Descripcion));
                    continue;
                }

                var dispositivo = c.Sensor.Dispositivo;
                var message     = M2mMessageSender.Create(dispositivo, new M2mMessageSaver(DAOFactory)).AddCommand(cmd);

                var cfgValue = par.Equals("On") ? "true" : "false";
                message.AddConfigParameter("DigitalOutput1", cfgValue, 0);

                var sendState = message.Send();

                if (sendState)
                {
                    ok++;
                    sent += "\\n" + li.Text;
                }
                else
                {
                    error++;
                    failed += "\\n" + li.Text;
                }
            }

            if (ok > 0)
            {
                JsAlert(string.Format(CultureManager.GetSystemMessage("MESSAGE_SENT"), sent));
            }
            if (error > 0)
            {
                JsAlert(string.Format(CultureManager.GetError("MESSAGE_NOT_SENT"), failed));
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Gets report data and generates the chart.
        /// </summary>
        protected void DoSearch()
        {
            ReportObjectsList = GetResults();

            Graph.Visible = ReportObjectsList.Count > 0;

            if (NotFound != null)
            {
                NotFound.Text = !Graph.Visible ? CultureManager.GetSystemMessage("NO_RESULT_FOR_CURRENT_FILTERS") : null;
            }
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Adds the delete action button to the toolbar.
 /// </summary>
 public void AddDeleteToolbarButton()
 {
     AddControls(new ToolBarButton
     {
         ID            = ToolBarButtonDeleteId,
         SkinID        = "Delete",
         CommandName   = ButtonCommandNameDelete,
         Text          = CultureManager.GetControl("BUTTON_DELETE"),
         OnClientClick = "return confirm('" + CultureManager.GetSystemMessage("CONFIRM_OPERATION") + "');"
     });
 }
Ejemplo n.º 13
0
        /// <summary>
        /// Exports the Grid to CSV.
        /// Cuidado con esto porque rebindea la grilla sacandole el paging.
        /// </summary>
        protected override void ExportToCsv()
        {
            var builder = new GridToCSVBuilder(Usuario.CsvSeparator);

            builder.GenerateHeader(CultureManager.GetMenu("COMB_REMITOS"), GetFilterValues());
            GenerateCSVBody(builder);

            SetCsvSessionVars(builder.Build());

            OpenWin(string.Concat(ApplicationPath, "Common/exportCSV.aspx"), CultureManager.GetSystemMessage("EXPORT_CSV_DATA"));
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Duplicates the current object being edited.
        /// </summary>
        protected void Duplicate()
        {
            Id = 0;
            if (_editobj != null)
            {
                _editobj.Id = 0;
            }
            UpdateToolbar();
            ShowInfo(CultureManager.GetSystemMessage("DUPLICATED_ELEMENT"));

            OnDuplicate();
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Exports the Grid to CSV.
        /// Cuidado con esto porque rebindea la grilla sacandole el paging.
        /// </summary>
        protected override void ExportToCsv()
        {
            var builder = new GridToCSVBuilder(Usuario.CsvSeparator);

            builder.GenerateHeader(CultureManager.GetMenu("COMB_INGRESOS_POZO"), GetFilterValues());
            GenerateCSVBody(builder);

            Session["CSV_EXPORT"]    = builder.Build();
            Session["CSV_FILE_NAME"] = "report";

            OpenWin(string.Concat(ApplicationPath, "Common/exportCSV.aspx"), CultureManager.GetSystemMessage("EXPORT_CSV_DATA"));
        }
Ejemplo n.º 16
0
        protected override void ExportToCsv()
        {
            var separator = Usuario.CsvSeparator;

            var sb = new StringBuilder();

            sb.Append(GetLine(CultureManager.GetMenu(ToolBar.VariableName)));
            sb.Append(GetLine(DateTime.UtcNow.ToDisplayDateTime().ToString("dd/MM/yyyy HH:mm")));
            sb.Append(GetLine());
            sb.Append(GetLine(CultureManager.GetEntity("PARENTI01"), cbEmpresa.SelectedItem.Text));
            sb.Append(GetLine(CultureManager.GetEntity("PARENTI02"), cbLinea.SelectedItem.Text));
            sb.Append(GetLine(CultureManager.GetEntity("BOCADECARGA"), cbBocaDeCarga.SelectedItem.Text));
            sb.Append(GetLine(CultureManager.GetEntity("PARENTI63"), cbProducto.SelectedItem.Text));
            sb.Append(GetLine(CultureManager.GetLabel("DIA"), dtDia.SelectedDate.Value.ToString("dd/MM/yyyy")));
            sb.Append(GetLine(CultureManager.GetLabel("PROGRAMACION_CARGA_MAXIMA"), txtCargaMaxima.Text));
            sb.Append(GetLine(CultureManager.GetLabel("PROGRAMACION_CANTIDAD_MIXERS"), txtCantidadMixers.Text));
            sb.Append(GetLine());

            var bocas = cbBocaDeCarga.Selected > 0
                ? new List <BocaDeCarga> {
                DAOFactory.BocaDeCargaDAO.FindById(cbBocaDeCarga.Selected)
            }
                : DAOFactory.BocaDeCargaDAO.GetList(new[] { cbEmpresa.Selected }, new[] { cbLinea.Selected });

            var inicio = bocas.Min(boca => GetInicioActividad(boca));
            var fin    = bocas.Max(boca => GetFinActividad(boca));

            sb.Append(string.Join(separator.ToString(), CsvHeader));
            for (var i = inicio; i <= fin; i = i.Add(TimeSpan.FromHours(1)))
            {
                sb.Append(string.Concat(separator, FormatTimeSpan(i)));
            }
            sb.Append(GetLine());

            foreach (RepeaterItem r in repPedidos.Items)
            {
                var item = new RepeaterItemPedido(r);

                if (r.ItemType != ListItemType.Item && r.ItemType != ListItemType.AlternatingItem)
                {
                    continue;
                }
                sb.Append(GetLine(string.Join(separator.ToString(), item.GetCsvLine())));
            }
            sb.Append((string)hidCsvFooter.Value);
            sb.Append(GetLine());

            Session["CSV_EXPORT"]    = sb.ToString();
            Session["CSV_FILE_NAME"] = "programacion";

            OpenWin(string.Concat(ApplicationPath, "Common/exportCSV.aspx"), CultureManager.GetSystemMessage("EXPORT_CSV_DATA"));
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Exports the report into a csv file.
        /// </summary>
        protected override void ExportToCsv()
        {
            var builder = new BaseCsvBuilder(Usuario.CsvSeparator);

            GenerateCsvHeader(builder);
            GenerateStadisticsColumns(builder);
            GenerateMaximumSpeedColumns(builder);
            GenerateOperatorsColumns(builder);

            Session["CSV_EXPORT"]    = builder.Build();
            Session["CSV_FILE_NAME"] = "report";

            OpenWin(string.Concat(ApplicationPath, "Common/exportCSV.aspx"), CultureManager.GetSystemMessage("EXPORT_CSV_DATA"));
        }
Ejemplo n.º 18
0
        protected override void ExportToCsv() 
        {
            var builder = new GridToCSVBuilder(Usuario.CsvSeparator);

            BtnSearchClick(null, null);

            builder.GenerateHeader(CultureManager.GetMenu(VariableName), GetFilterValues());
            builder.GenerateColumns(gridViajes);
            builder.GenerateFields(gridViajes);

            SetCsvSessionVars(builder.Build());

            OpenWin(String.Concat(ApplicationPath, "Common/exportCSV.aspx"), CultureManager.GetSystemMessage("EXPORT_CSV_DATA"));
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Exports the Grid to CSV.
        /// Cuidado con esto porque rebindea la grilla sacandole el paging.
        /// </summary>
        protected override void ExportToCsv()
        {
            var builder = new GraphToCsvBuilder(Usuario.CsvSeparator);

            builder.GenerateHeader(CultureManager.GetMenu(VariableName), GetFilterValues());

            GetGraphCategoriesAndDatasets();

            builder.ExportGraph(XAxisLabel, YAxisLabel, GraphCategories, GraphDataSet);

            Session["CSV_EXPORT"]    = builder.Build();
            Session["CSV_FILE_NAME"] = "report";

            OpenWin(String.Concat(ApplicationPath, "Common/exportCSV.aspx"), CultureManager.GetSystemMessage("EXPORT_CSV_DATA"));
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Displays the givenn fragment in the historic monitor or alerts if the time span is too big.
        /// </summary>
        /// <param name="salida"></param>
        /// <param name="entrada"></param>
        private void ShowRouteDetails(string salida, string entrada)
        {
            var from = Convert.ToDateTime(salida);
            var to   = Convert.ToDateTime(entrada);

            if (to.Subtract(from).TotalHours > 24)
            {
                ShowErrorPopup(CultureManager.GetSystemMessage("ROUTE_TOO_LONG"));

                return;
            }

            AddSessionParameters(to, from);

            ifResumenViaje.Visible = true;
        }
Ejemplo n.º 21
0
        protected void btIniciar_Click(object sender, EventArgs e)
        {
            mpePanel.Hide();
            if (TicketToInitId.Get() <= 0)
            {
                return;
            }

            var date = dtHora.SelectedDate;

            if (!date.HasValue)
            {
                ThrowMustEnter("FECHA");
            }

            var ticket = DAOFactory.TicketDAO.FindById(TicketToInitId.Get());

            TicketToInitId.Set(-1);

            SetStartDate(ticket, SecurityExtensions.ToDataBaseDateTime(date.Value));

            var messageSaver = new MessageSaver(DAOFactory);

            var ciclo = new CicloLogisticoHormigon(ticket, DAOFactory, messageSaver);

            var evento = new InitEvent(DateTime.UtcNow);

            try
            {
                ciclo.ProcessEvent(evento);
                ShowInfo(CultureManager.GetSystemMessage("CLOG_START_SENT") + ticket.Vehiculo.Interno);
                Bind();
                if (TieneDocumentosVencidos.Get())
                {
                    messageSaver.Save(MessageCode.CicloLogisticoIniciadoDocumentosInvalidos.GetMessageCode(),
                                      ticket.Vehiculo, evento.Date.AddSeconds(1), null, string.Empty);
                }
            }
            catch (NoVehicleException)
            {
                ShowError(new ApplicationException(CultureManager.GetError("TICKET_NO_VEHICLE_ASSIGNED")));
            }
            catch //AlreadyOpenException, QueueException, Exception
            {
                ShowError(new ApplicationException(CultureManager.GetError("CLOG_MESSAGE_NOT_SENT") + ticket.Vehiculo.Interno));
            }
        }
Ejemplo n.º 22
0
        protected override void Regenerate()
        {
            if (EditObject.Vehiculo == null)
            {
                ThrowMustEnter("Entities", "PARENTI03");
            }

            var ticket = DAOFactory.TicketDAO.FindById(EditObject.Id);
            var ciclo  = new CicloLogisticoHormigon(ticket, DAOFactory, null /*new MessageSaver(DAOFactory)*/);

            ciclo.Regenerate();

            ShowInfo(CultureManager.GetSystemMessage("TCIKET_REGENERATE_DONE"));
            Bind();
            updRefreshTabGeneral.Update();
            updRefreshTabDetalles.Update();
        }
Ejemplo n.º 23
0
        protected virtual void SendReportToMail()
        {
            var path = HttpContext.Current.Request.Url.AbsolutePath;

            path = Path.GetFileNameWithoutExtension(path) + ".xlsx";

            var builder = new GridToExcelBuilder(path, Usuario.ExcelFolder);

            var list = GridUtils.Search(Data, SearchString);

            builder.GenerateHeader(CultureManager.GetMenu(VariableName), new Dictionary <string, string>());
            builder.GenerateColumns(list);
            builder.GenerateFields(list);

            SetExcelSessionVars(builder.CloseAndSave());

            OpenWin(String.Concat(ApplicationPath, "Common/exportExcel.aspx"), CultureManager.GetSystemMessage("EXPORT_CSV_DATA"));
        }
Ejemplo n.º 24
0
        protected override void ExportToCsv()
        {
            var builder = new BaseCsvBuilder(Usuario.CsvSeparator);

            GenerateCsvHeader(builder);
            GenerateColumns(builder);
            GenerateFields(builder);

            builder.GenerateRow(string.Empty);
            builder.GenerateRow(CultureManager.GetLabel("TOTALES"));
            builder.GenerateRow(string.Format(CultureManager.GetLabel("PONDERACION_GRAVES_RANKING"), TransportistasGraves));
            builder.GenerateRow(string.Format(CultureManager.GetLabel("PONDERACION_MEDIAS_RANKING"), TransportistasMedios));
            builder.GenerateRow(string.Format(CultureManager.GetLabel("PONDERACION_LEVES_RANKING"), TransportistasLeves));

            SetCsvSessionVars(builder.Build());

            OpenWin(string.Concat(ApplicationPath, "Common/exportCSV.aspx"), CultureManager.GetSystemMessage("EXPORT_CSV_DATA"));
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Shows the selected route fragment in the historic monitor or aletrs of any error situation.
        /// </summary>
        private void ShowSelectedRouteDetails()
        {
            var salida  = GridUtils.GetCell(Grid.SelectedRow, MobileTourVo.IndexSalida).Text + ' ' + GridUtils.GetCell(Grid.SelectedRow, MobileTourVo.IndexSalidaHora).Text;
            var entrada = GridUtils.GetCell(Grid.SelectedRow, MobileTourVo.IndexEntrada).Text + ' ' + GridUtils.GetCell(Grid.SelectedRow, MobileTourVo.IndexEntradaHora).Text;

            try
            {
                Convert.ToDateTime(salida);
                Convert.ToDateTime(entrada);
            }
            catch
            {
                ShowErrorPopup(CultureManager.GetSystemMessage("NO_GEOCERCA_INFO"));
                return;
            }

            ShowRouteDetails(salida, entrada);
        }
Ejemplo n.º 26
0
        protected override void ExportToExcel()
        {
            var path = HttpContext.Current.Request.Url.AbsolutePath;

            path = Path.GetFileNameWithoutExtension(path) + ".xlsx";

            var builder        = new GridToExcelBuilder(path, Usuario.ExcelFolder);
            var distribuciones = GetDistribuciones(new[] { -1 });
            var controladas    = distribuciones.Where(d => d.Controlado).Select(d => new ViajeDistribucionVo(d)).ToList();
            var list           = controladas.Select(c => new ControlDistribucionVo(c)).ToList();

            builder.GenerateHeader(CultureManager.GetMenu(VariableName), GetFilterValues());
            builder.GenerateColumns(list);
            builder.GenerateFields(list);

            Session["TMP_FILE_NAME"] = builder.CloseAndSave();
            Session["CSV_FILE_NAME"] = CultureManager.GetMenu(Module.Name);

            OpenWin(String.Concat(ApplicationPath, "Common/exportExcel.aspx"), CultureManager.GetSystemMessage("EXPORT_CSV_DATA"));
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Override for generating the grid using a DataSet (not the GetResult method) as DataSource.
        /// </summary>
        protected override void Bind()
        {
            if (lbMobiles.SelectedValues.Count.Equals(0))
            {
                LblInfo.Text = CultureManager.GetError("MUST_SELECT_MOBILE");

                return;
            }

            Grid.AllowColMoving = false;
            Grid.AllowGrouping  = false;

            InitializeDictionaries();

            var src = ReportFactory.TicketReportDAO.GetTicketsTimeDifferencesByDateAndMobiles(lbMobiles.SelectedValues, dpDesde.SelectedDate.GetValueOrDefault().ToDataBaseDateTime(),
                                                                                              dpHasta.SelectedDate.GetValueOrDefault().ToDataBaseDateTime(), ddlPlanta.Selected);


            if (src.Tables.Count.Equals(0))
            {
                LblInfo.Text    = CultureManager.GetSystemMessage(NoResultForCurrentFilters);
                LblInfo.Visible = true;

                return;
            }

            var source = src.Tables[0];

            GenerateGridWidth(source);

            GenerateColumnsHeaders(source);

            Bind(source);

            HideIdColumns();

            FormatGridColumns();

            GenerateSubtotalsGrid();
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Exports the Grid to CSV.
        /// Cuidado con esto porque rebindea la grilla sacandole el paging.
        /// </summary>
        protected virtual void ExportToCsv()
        {
            var builder = new GridToCSVBuilder(Usuario.CsvSeparator);

            var g           = Grid;
            var allowPaging = Grid.AllowPaging;

            g.AllowPaging = false;
            g.DataSource  = Data;
            g.DataBind();

            GenerateCsvHeader(builder);

            builder.GenerateColumns(/*null, */ g);
            builder.GenerateFields(g);

            SetCsvSessionVars(builder.Build());

            OpenWin(string.Concat(ApplicationPath, "Common/exportCSV.aspx"), CultureManager.GetSystemMessage("EXPORT_CSV_DATA"));

            g.AllowPaging = allowPaging;
        }
Ejemplo n.º 29
0
        protected override void ExportToExcel()
        {
            Logger.Debug("ExportToExcel start");
            var path = HttpContext.Current.Request.Url.AbsolutePath;



            path = Path.GetFileNameWithoutExtension(path) + ".xlsx";

            var builder = new GridToExcelBuilder(path, Usuario.ExcelFolder);

            var list = GridUtils.Search(Data, SearchString);

            Logger.Debug("ExportToExcel builder.GenerateHeader");
            if (list.Count > 5000)
            {
                ShowInfo(CultureManager.GetLabel("EXCEL_DEMASIADOS_MENSAJES"));
                return;
            }
            if (list.Count == 50)
            {
                ShowInfo(CultureManager.GetLabel("EXCEL_DEMASIADOS_MENSAJES"));
                return;
            }


            builder.GenerateHeader(CultureManager.GetMenu(VariableName), GetFilterValues());
            Logger.Debug("ExportToExcel builder.GenerateColumns");
            builder.GenerateColumns(list);
            Logger.Debug("ExportToExcel builder.GenerateFields");
            //  Hay que mejorar este GenerateFields
            builder.GenerateFields(list, CustomExportFormat);

            Logger.Debug("ExportToExcel SetExcelSessionVars");
            SetExcelSessionVars(builder.CloseAndSave());

            OpenWin(String.Concat(ApplicationPath, "Common/exportExcel.aspx"), CultureManager.GetSystemMessage("EXPORT_CSV_DATA"));
            Logger.Debug("ExportToExcel end");
        }
Ejemplo n.º 30
0
        private void Edit(int idEntrada, int idSalida)
        {
            popupEdit.Show();
            ResetFilters();
            ResetEditFilters();

            txtEditEmpleados.Enabled = true;

            if (idEntrada > 0)
            {
                var entrada = DAOFactory.EventoAccesoDAO.FindById(idEntrada);
                txtEditEmpleados.Selected = entrada.Empleado.Id;
                txtEditEmpleados.Text     = entrada.Empleado.Entidad.Descripcion;
                cbEditPuertaEntrada.SetSelectedValue(entrada.Puerta.Id);
                dtEditHoraEntrada.SelectedDate = entrada.Fecha.ToDisplayDateTime();
                txtEditEmpleados.Enabled       = false;
            }
            else
            {
                cbEditPuertaEntrada.SetSelectedValue(cbEditPuertaEntrada.NoneValue);
                dtEditHoraEntrada.SelectedDate = null;
            }
            if (idSalida > 0)
            {
                var salida = DAOFactory.EventoAccesoDAO.FindById(idSalida);
                txtEditEmpleados.Selected = salida.Empleado.Id;
                txtEditEmpleados.Text     = salida.Empleado.Entidad.Descripcion;
                cbEditPuertaSalida.SetSelectedValue(salida.Puerta.Id);
                dtEditHoraSalida.SelectedDate = salida.Fecha.ToDisplayDateTime();
                txtEditEmpleados.Enabled      = false;
            }
            else
            {
                cbEditPuertaSalida.SetSelectedValue(cbEditPuertaEntrada.NoneValue);
                dtEditHoraSalida.SelectedDate = null;
            }
            btAceptar.CommandArgument = idEntrada + ":" + idSalida;
            btAceptar.OnClientClick   = string.Format("return confirm(\"{0}\");", CultureManager.GetSystemMessage("CONFIRM_OPERATION"));
        }