Пример #1
0
        private void CarregarInstituicao()
        {
            InstituicoesBL insBL = new InstituicoesBL();
            List<Instituicoes> instituicoes = insBL.PesquisarBL(true);

            foreach (Instituicoes inst in instituicoes)
            {
                lblNomeEmpresa.Text = inst.NomeFantasia;
            }
        }
Пример #2
0
        public string EnviarEmailSenha(DataSet dsUsu)
        {
            try
            {
                InstituicoesBL insBL = new InstituicoesBL();
                List<Instituicoes> instituicoes = insBL.PesquisarBL(true);

                StringBuilder msg = new StringBuilder();
                msg.Append("Olá ");
                msg.Append(dsUsu.Tables[0].Rows[0]["nome"]);
                msg.Append(", \n");
                msg.Append("Segue seus dados de login: \n");
                msg.Append("Usuário: ");
                msg.Append(dsUsu.Tables[0].Rows[0]["login"]);
                msg.Append(", Senha: ");
                msg.Append(utils.DesCriptografar(dsUsu.Tables[0].Rows[0]["senha"].ToString()));

                MailMessage Msg = new MailMessage();

                foreach (Instituicoes inst in instituicoes)
                {
                    // Sender e-mail address.
                    Msg.From = new MailAddress(inst.Email);
                    // Recipient e-mail address.
                    Msg.To.Add(dsUsu.Tables[0].Rows[0]["email"].ToString());
                    Msg.Subject = inst.Razao;
                    Msg.Body = msg.ToString();
                    Msg.IsBodyHtml = true;
                    Msg.SubjectEncoding = Encoding.GetEncoding("ISO-8859-1");
                    Msg.BodyEncoding = Encoding.GetEncoding("ISO-8859-1");
                    // your remote SMTP server IP.
                    SmtpClient smtp = new SmtpClient();
                    smtp.Host = inst.ServidorSMTP;

                    if (utils.ComparaIntComZero(inst.Porta.ToString()) > 0)
                        smtp.Port = utils.ComparaIntComZero(inst.Porta.ToString());

                    if(inst.Login != null || inst.Senha != null)
                        smtp.Credentials = new System.Net.NetworkCredential(inst.Login, inst.Senha);

                    smtp.EnableSsl = true;
                    smtp.Send(Msg);
                }

                return "";

            }
            catch (Exception ex)
            {
                return ex.Message;
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            if (context.Request.QueryString["logoId"] != null)
            {
                InstituicoesBL ibl = new InstituicoesBL();
                int id = Convert.ToInt16(context.Request.QueryString["logoId"]);
                List<Instituicoes> lista = ibl.PesquisarBL(id);
                byte[] img = lista[0].InstituicaoLogo != null ? lista[0].InstituicaoLogo.Imagem : null;

                if (img != null)
                {
                    context.Response.ContentType = "image/" + lista[0].InstituicaoLogo.Extensao;
                    context.Response.OutputStream.Write(img, 0, img.Length);
                }
            }
        }
        private void CarregarDados(int id_ins)
        {
            InstituicoesBL insBL = new InstituicoesBL();
            List<Instituicoes> intituicoes = insBL.PesquisarBL(id_ins);

            foreach (Instituicoes ltIns in intituicoes)
            {
                hfId.Value = ltIns.Id.ToString();
                txtCodigo.Text = ltIns.Codigo.ToString();
                txtRazao.Text = ltIns.Razao;
                txtNomeFantasia.Text = ltIns.NomeFantasia.ToString();
                txtEmail.Text = ltIns.Email;
                txtCnpj.Text = ltIns.Cnpj;
                txtCep.Text = ltIns.Cep;
                txtEndereco.Text = ltIns.Endereco;
                txtNumero.Text = ltIns.Numero.ToString();
                txtComplemento.Text = ltIns.Complemento;
                txttelefone.Text = ltIns.telefone;
                txtRanking.Text = ltIns.Ranking.ToString();
                txtSenha.Text = ltIns.Senha.ToString();
                txtLogin.Text = ltIns.Login.ToString();
                txtServidorSmtp.Text = ltIns.ServidorSMTP.ToString();
                txtPorta.Text = ltIns.Porta.ToString();

                if (ltIns.Cidades != null)
                {
                    ddlUF.SelectedValue = ltIns.Cidades.EstadoId.ToString();
                    CarregarDdlCidade(ddlCidades, ltIns.Cidades.EstadoId);
                    CarregarDdlBairro(ddlBairro, ltIns.CidadeId != null ? Convert.ToInt32(ltIns.CidadeId.ToString()) : 0);
                    ddlCidades.SelectedValue = ltIns.CidadeId.ToString();
                    ddlBairro.SelectedValue = ltIns.BairroId.ToString();
                }

                hfIdInstLogo.Value = ltIns.InstituicaoLogo != null ? ltIns.InstituicaoLogo.Id.ToString() : "0";
            }
        }