Exemplo n.º 1
0
        public void EnviarSms(bool sync, EstruturaEnvioSMS EstruturaEnvio)
        {
            try
            {
                APIHuman.CorpoEmail = APIHuman.CorpoEmail.Replace("##DataVenda##", EstruturaEnvio.DataVenda);
                APIHuman.CorpoEmail = APIHuman.CorpoEmail.Replace("##Senha##", EstruturaEnvio.Senha);
                APIHuman.CorpoEmail = APIHuman.CorpoEmail.Replace("##Valor##", "R$ " + EstruturaEnvio.ValorTotal);
                APIHuman.CorpoEmail = APIHuman.CorpoEmail.Replace("##Email##", EstruturaEnvio.Email);

                if (EstruturaEnvio.Numero != null)
                {
                    if (sync)
                    {
                        APIHuman.EnviarSmsSync(EstruturaEnvio.Numero);
                    }
                    else
                    {
                        APIHuman.EnviarSms(EstruturaEnvio.Numero);
                    }
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
Exemplo n.º 2
0
        public EstruturaEnvioSMS GetInfoByVendaBilheteriaID(int VendaBilheteriaID)
        {
            try
            {
                BD bd = new BD();
                EstruturaEnvioSMS Sms = new EstruturaEnvioSMS();

                string sql = @"SELECT vb.Senha, vb.ValorTotal, vb.DataVenda, tc.Nome , tc.DDDCelular + tc.Celular AS Numero, tc.Email
                               FROM tVendaBilheteria AS vb
                               INNER JOIN tCliente AS tc ON tc.ID = vb.ClienteID 
                               WHERE vb.ID = " + VendaBilheteriaID;

                bd.Consulta(sql);
                while (bd.Consulta().Read())
                {
                    Sms.DataVenda  = bd.LerStringFormatoDataHora("DataVenda");
                    Sms.Numero     = bd.LerString("Numero");
                    Sms.Senha      = bd.LerString("Senha");
                    Sms.ValorTotal = bd.LerDecimal("ValorTotal");
                    Sms.Nome       = bd.LerString("Nome");
                    Sms.Email      = bd.LerString("Email");
                }

                return(Sms);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 3
0
        public void EnviarSMS(HammerHead.EstruturaVenda venda)
        {
            if (!APIHuman.Ativo)
            {
                return;
            }

            try
            {
                if (string.IsNullOrEmpty(venda.NumeroCelular))
                {
                    return;
                }

                EstruturaEnvioSMS sms = new EstruturaEnvioSMS()
                {
                    Senha      = venda.Senha,
                    DataVenda  = venda.DataVenda.ToShortDateString(),
                    Email      = venda.Cliente.Email,
                    Nome       = venda.Cliente.Nome,
                    Numero     = venda.NumeroCelular,
                    ValorTotal = venda.ValorTotal,
                };

                this.EnviarSms(true, sms);
            }
            catch (Exception ex)
            {
                throw new Exception("Erro: " + ex.Message);
            }
        }
Exemplo n.º 4
0
        public void EnviarSms(EstruturaEnvioSMS EstruturaEnvio)
        {
            try
            {
                APIHuman.CorpoEmail.Replace("##DataVenda##", EstruturaEnvio.DataVenda);
                APIHuman.CorpoEmail.Replace("##Senha##", EstruturaEnvio.Senha);
                APIHuman.CorpoEmail.Replace("##Valor##", "R$ " + EstruturaEnvio.ValorTotal);
                APIHuman.CorpoEmail.Replace("##Email##", EstruturaEnvio.Email);

                APIHuman.EnviarSms(EstruturaEnvio.Numero);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 5
0
        public void EnviaSms(int VendaBilheteriaID)
        {
            try
            {
                if (APIHuman.Ativo)
                {
                    EstruturaEnvioSMS Sms = GetInfoByVendaBilheteriaID(VendaBilheteriaID);

                    this.EnviarSms(Sms);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 6
0
        public void EnviaSms(int VendaBilheteriaID, string numeroCelular)
        {
            try
            {
                if (APIHuman.Ativo)
                {
                    EstruturaEnvioSMS Sms = GetInfoByVendaBilheteriaID(VendaBilheteriaID);

                    Sms.Numero = numeroCelular;

                    this.EnviarSms(Sms);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 7
0
        public void EnviaSms(bool sync, int VendaBilheteriaID, string numeroCelular)
        {
            try
            {
                if (APIHuman.Ativo)
                {
                    EstruturaEnvioSMS Sms = GetInfoByVendaBilheteriaID(VendaBilheteriaID);

                    if (numeroCelular != "")
                    {
                        Sms.Numero = numeroCelular;
                    }

                    this.EnviarSms(sync, Sms);
                }
            }
            catch (Exception e)
            {
                throw new Exception("Erro: " + e.Message);
            }
        }
Exemplo n.º 8
0
        public void EnviaSms(bool sync, int VendaBilheteriaID)
        {
            try
            {
                if (APIHuman.Ativo)
                {
                    EstruturaEnvioSMS Sms = GetInfoByVendaBilheteriaID(VendaBilheteriaID);

                    if (string.IsNullOrEmpty(Sms.Numero))
                    {
                        return;
                    }

                    this.EnviarSms(sync, Sms);
                }
            }
            catch (Exception e)
            {
                throw new Exception("Erro: " + e.Message);
            }
        }
Exemplo n.º 9
0
        public EstruturaEnvioSMS GetInfoByVendaBilheteriaID(int VendaBilheteriaID)
        {
            BD bd = new BD();

            try
            {
                EstruturaEnvioSMS Sms = new EstruturaEnvioSMS();

                string sql = @"SELECT vb.Senha, vb.ValorTotal, vb.DataVenda, tc.Nome , ISNULL(vb.DDD, 0) as DDD , 
                               ISNULL(vb.NumeroCelular,0) AS Numero, tc.Email
                               FROM tVendaBilheteria AS vb (NOLOCK)
                               INNER JOIN tCliente AS tc (NOLOCK) ON tc.ID = vb.ClienteID 
                               WHERE vb.ID = " + VendaBilheteriaID;

                bd.Consulta(sql);
                while (bd.Consulta().Read())
                {
                    DateTime data = bd.LerDateTime("DataVenda");
                    Sms.DataVenda = data.ToString("d/M/yy");
                    string ddd     = Convert.ToString(bd.LerInt("DDD"));
                    string celular = Convert.ToString(bd.LerInt("Numero"));
                    if (ddd != "0" && celular != "0")
                    {
                        Sms.Numero = ddd + celular;
                    }
                    Sms.Senha      = bd.LerString("Senha");
                    Sms.ValorTotal = bd.LerDecimal("ValorTotal");
                    Sms.Nome       = bd.LerString("Nome");
                    Sms.Email      = bd.LerString("Email");
                }

                return(Sms);
            }
            finally
            {
                bd.Fechar();
            }
        }