Exemplo n.º 1
0
        public async Task TrainSelection(byte numberQueue)
        {
            if (MasterTcpIp == null || !MasterTcpIp.IsConnect)
            {
                return;
            }

            //ЗАПРОС О СОСТОЯНИИ ОЧЕРЕДИ
            var provider = new Terminal2ServerExchangeDataProvider {
                InputData = new TerminalInData {
                    NumberQueue = numberQueue, Action = TerminalAction.Info
                }
            };
            await MasterTcpIp.RequestAndRespoune(provider);


            if (provider.IsOutDataValid)
            {
                var prefix      = provider.OutputData.NumberQueue == 1 ? "A" : "B";
                var ticketName  = prefix + provider.OutputData.NumberElement.ToString("000");
                var countPeople = provider.OutputData.CountElement.ToString();

                var isAdded = OnConfirmationAdded(ticketName, countPeople);
                if (isAdded)
                {
                    //ЗАПРОС О ДОБАВЛЕНИИ ЭЛЕМЕНТА В ОЧЕРЕДЬ
                    provider = new Terminal2ServerExchangeDataProvider {
                        InputData = new TerminalInData {
                            NumberQueue = numberQueue, Action = TerminalAction.Add
                        }
                    };
                    await MasterTcpIp.RequestAndRespoune(provider);

                    if (provider.IsOutDataValid)
                    {
                        prefix      = provider.OutputData.NumberQueue == 1 ? "A" : "B";
                        ticketName  = prefix + provider.OutputData.NumberElement.ToString("000");
                        countPeople = provider.OutputData.CountElement.ToString();

                        PrintTicket.Print(ticketName, countPeople, provider.OutputData.AddedTime);
                    }
                }
                else
                {
                    // "НЕ добавлять"
                }
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Doctor   doctor1   = new Doctor("Alberto Rodriguez", "Oncologia");
            Doctor   doctor2   = new Doctor("", "Oncologia");
            Doctor   doctor3   = new Doctor("Jorge", "Medicina General");
            Paciente paciente3 = new Paciente("Pedro", "4.321.256-9", "096325148");
            Paciente paciente1 = new Paciente("Matias Ojeda", "4.548.797-8", "099636261");
            Paciente paciente2 = new Paciente("juan", "45632", "");
            Consulta consulta1 = new Consulta(DateTime.Now, "Consultorio Parque Batlle", doctor1, paciente1);
            Consulta consulta2 = new Consulta(DateTime.Now, "Consultorio Tres Cruces", doctor2, paciente2);
            Consulta consulta3 = new Consulta(DateTime.Now, "Consultorio Tres Cruces", doctor3, paciente3);

            PrintTicket.Print(consulta1);
            Console.WriteLine();
            PrintTicket.Print(consulta2);
            PrintTicket.Print(consulta3);
        }
        public void Print2Pdf()
        {
            //Arrage
            var printTicket = new PrintTicket("Microsoft Print to PDF");
            var ticketName  = "Б019";
            var countPeople = "0";
            var dateAdded   = DateTime.Parse("19.09.2019 15:39:52");
            //var descriptionQueue = "Оформление багажа и живности";
            var descriptionQueue = "Администратор: идентификация 14-значного номера электронного билета, восстановление утраченных и испорченных билетов, вопросы по работе билетных касс";

            //var descriptionQueue = "Оформление, возврат, переоформление, прерывание поездки, опоздание на поезд дальнего следования - внутреннее и межгосударственное сообщения"; ;


            //Act
            printTicket.Print(ticketName, countPeople, dateAdded, descriptionQueue);

            //Assert
        }
Exemplo n.º 4
0
        private void button3_Click(object sender, EventArgs e)
        {
            AlquileresVigentes veralquileres = new AlquileresVigentes();
            Ticket             unTicket      = new Ticket();

            veralquileres.dgvAlquileres.AllowUserToAddRows = false;
            string[] alquileres = new string[6];


            foreach (Alquiler p in administracion.GetAlquileres())
            {
                string datos = p.getClinete().Nombre + ";" + p.getClinete().Dni + ";" + p.getClinete().Telefono + ";" + Convert.ToString(p.DiasDeAlquiler) + ";" + p.Auto.Marca + ";" + p.Auto.Patente + ";" + p.Auto.Kms + ";" + (p.Auto.PrecioAlquiladoEnUDC * p.PrecioAlquilado * p.DiasDeAlquiler);

                alquileres = datos.Split(';');
                veralquileres.dgvAlquileres.ColumnCount = alquileres.Length;
                veralquileres.dgvAlquileres.Rows.Add(alquileres);
            }

            if (veralquileres.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    devolucion = new Alquiler();
                    devolucion = administracion.GetAlquileres()[veralquileres.dgvAlquileres.CurrentRow.Index];
                    precio     = administracion.Devolucion(veralquileres.dgvAlquileres.CurrentRow.Index, Convert.ToInt32(veralquileres.textBox1.Text), veralquileres.dgvAlquileres, veralquileres.dateTimePicker1.Value);


                    unTicket.printPreviewControl1.Document = PrintTicket;
                    ActualizarListboxs();


                    if (unTicket.ShowDialog() == DialogResult.OK)
                    {
                        PrintTicket.Print();
                    }
                }
                catch (Exception er) {
                    MessageBox.Show(er.Message);
                }
            }
        }
        public async Task QueueSelection(string nameQueue, string prefixQueue, string descriptionQueue)
        {
            if (!IsConnectTcpIp)
            {
                _loggerRaw.Info("NotConnect");   //DEBUG
                return;
            }

            try
            {
                _loggerRaw.Info("ЗАПРОС О СОСТОЯНИИ ОЧЕРЕДИ");   //DEBUG

                //ЗАПРОС О СОСТОЯНИИ ОЧЕРЕДИ
                var provider = new Terminal2ServerExchangeDataProvider {
                    InputData = new TerminalInData {
                        NameQueue = nameQueue, PrefixQueue = prefixQueue, Action = TerminalAction.Info
                    }
                };
                _loggerRaw.Info("RequestAndRespouneAsync");   //DEBUG
                await MasterTcpIp.RequestAndRespouneAsync(provider);

                //_logger.Info($"provider.IsOutDataValid=   {provider.IsOutDataValid}");
                _loggerRaw.Info($"provider.IsOutDataValid=  {provider.IsOutDataValid}");   //DEBUG

                if (provider.IsOutDataValid)
                {
                    var prefix      = provider.OutputData.PrefixQueue;
                    var ticketName  = prefix + provider.OutputData.NumberElement.ToString("000");
                    var countPeople = provider.OutputData.CountElement.ToString();

                    _loggerRaw.Info($"prefix= {prefix}  ticketName= {ticketName}  countPeople= {countPeople}");   //DEBUG

                    var isAdded = OnConfirmationAdded(ticketName, countPeople, descriptionQueue);
                    if (isAdded)
                    {
                        //ЗАПРОС О ДОБАВЛЕНИИ ЭЛЕМЕНТА В ОЧЕРЕДЬ
                        provider = new Terminal2ServerExchangeDataProvider {
                            InputData = new TerminalInData {
                                NameQueue = nameQueue, PrefixQueue = prefixQueue, Action = TerminalAction.Add
                            }
                        };
                        await MasterTcpIp.RequestAndRespouneAsync(provider);

                        if (provider.IsOutDataValid)
                        {
                            prefix      = provider.OutputData.PrefixQueue;
                            ticketName  = prefix + provider.OutputData.NumberElement.ToString("000");
                            countPeople = provider.OutputData.CountElement.ToString();

                            PrintTicket.Print(ticketName, countPeople, provider.OutputData.AddedTime);

                            //_logger.Info($"PrintTicket: {provider.OutputData.AddedTime}     {ticketName}    nameQueue= {nameQueue}   descriptionQueue= {descriptionQueue}");
                            _loggerRaw.Info($"PrintTicket: {provider.OutputData.AddedTime}     {ticketName}    nameQueue= {nameQueue}   descriptionQueue= {descriptionQueue}");   //DEBUG
                        }
                    }
                    else
                    {
                        // "НЕ добавлять"
                    }
                }
            }
            catch (Exception ex)
            {
                //_logger.Error($"TerminalModel/QueueSelection()=   {ex}");
                _loggerRaw.Error($"provider.IsOutDataValid= {ex}");   //DEBUG
            }
        }