Esempio n. 1
0
        public LlamarCliente GetLlamarCliente()
        {
            SqlDatabase   _Db       = null;
            LlamarCliente _instance = null;

            try
            {
                string sql = "SELECT TOP 1 * FROM  dbo.VistaLlamarCliente  WHERE IdEstado = 1 ORDER BY FechaSistema ASC";

                DatabaseProviderFactory factory = new DatabaseProviderFactory();

                _Db = factory.CreateDefault() as SqlDatabase;

                using (DbConnection connetion = _Db.CreateConnection())
                {
                    if (connetion.State == ConnectionState.Closed)
                    {
                        connetion.Open();
                    }

                    using (DbCommand _DbCommand = _Db.GetSqlStringCommand(sql))
                    {
                        _DbCommand.Connection = connetion;

                        using (IDataReader reader = _DbCommand.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                _instance = new LlamarCliente();
                                _instance.IdLlamarCliente = reader["IdLlamarCliente"] != DBNull.Value ? Convert.ToInt32(reader["IdLlamarCliente"]) : 0;
                                _instance.IdCaja          = reader["IdCaja"] != DBNull.Value ? Convert.ToInt32(reader["IdCaja"]) : 0;
                                _instance.Caja            = reader["Descripcion"] != DBNull.Value ? reader["Descripcion"].ToString() : "";
                                _instance.NumeroTicket    = reader["NumeroTicket"] != DBNull.Value ? Convert.ToInt32(reader["NumeroTicket"]) : 0;
                                _instance.IdEstado        = reader["IdEstado"] != DBNull.Value ? Convert.ToInt32(reader["IdEstado"]) : 0;
                                _instance.Estatus         = reader["Estatus"] != DBNull.Value ? reader["Estatus"].ToString() : "";
                                _instance.FechaSistema    = reader["FechaSistema"] != DBNull.Value ? Convert.ToDateTime(reader["FechaSistema"]) : DateTime.Now;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Com.Hit.TurnoMatic.Utils.Log.LogError(TAG, "GetLlamarCliente", ex);
            }

            return(_instance);
        }
Esempio n. 2
0
        private void LLamar()
        {
            LlamarCliente _llamarCliente = null;

            using (LlamarClienteService service = new LlamarClienteService())
            {
                _llamarCliente = service.GetLlamarCliente();
            }
            //
            if (_llamarCliente != null)
            {
                //
                string fileNameNumero = string.Format("{0}.wav", _llamarCliente.NumeroTicket);
                //
                string fileNameCaja = string.Format("caja0{0}.wav", _llamarCliente.IdCaja);
                //
                SoundPlayer soundNumero = new SoundPlayer(string.Format("{0}\\Numeros\\{1}", this.PathSound, fileNameNumero));
                SoundPlayer soundCaja   = new SoundPlayer(string.Format("{0}\\Cajas\\{1}", this.PathSound, fileNameCaja));
                //
                this.rTxtLlamandoCliente.Text += String.Format("Numero {0} a {1} Estatus {2}", _llamarCliente.NumeroTicket, _llamarCliente.Caja, _llamarCliente.Estatus) + System.Environment.NewLine;

                if (File.Exists(string.Format("{0}\\Numeros\\{1}", this.PathSound, fileNameNumero)))
                {
                    //
                    soundNumero.Play();
                }

                //
                System.Threading.Thread.Sleep(4000);
                //
                if (File.Exists(string.Format("{0}\\Cajas\\{1}", this.PathSound, fileNameCaja)))
                {
                    //
                    soundCaja.Play();
                }
                //
                using (LlamarClienteService service = new LlamarClienteService())
                {
                    service.ChangeLlamarCliente(_llamarCliente.NumeroTicket);
                }

                System.Threading.Thread.Sleep(2000);
            }
        }