Exemplo n.º 1
0
        protected void btAceptarDocumentos_Click(object sender, EventArgs e)
        {
            if (TicketToInitId.Get() <= 0)
            {
                return;
            }
            NoValidarDocumentos = true;
            var ticket = DAOFactory.TicketDAO.FindById(TicketToInitId.Get());

            StartTicketWindow(ticket);
        }
Exemplo n.º 2
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));
            }
        }
Exemplo n.º 3
0
        protected void btOpenedCerrarTicket_Click(object sender, EventArgs e)
        {
            if (TicketToInitId.Get() <= 0)
            {
                return;
            }

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

            var opened = DAOFactory.TicketDAO.FindEnCurso(ticket.Vehiculo.Dispositivo);

            if (opened != null)
            {
                opened.UserField3 += "(cerrado manual x inicio)";
                var ciclo  = new CicloLogisticoHormigon(opened, DAOFactory, new MessageSaver(DAOFactory));
                var evento = new CloseEvent(DateTime.UtcNow);
                ciclo.ProcessEvent(evento);
            }

            StartTicketWindow(ticket);
        }