private void EnviaEmail(List<string> lCaminhosXml, List<belIde> objlbelIde)
        {
            string hostservidor = LeRegWin.LeRegConfig("HostServidor").ToString().Trim();
            string porta = LeRegWin.LeRegConfig("PortaServidor").ToString().Trim();
            string remetente = LeRegWin.LeRegConfig("EmailRemetente").ToString().Trim();
            string senha = LeRegWin.LeRegConfig("SenhaRemetente").ToString().Trim();
            bool autentica = Convert.ToBoolean(LeRegWin.LeRegConfig("RequerSSL").ToString().Trim());

            List<belEmail> objlbelEmail = new List<belEmail>();

            //OS_25285
            for (int i = 0; i < lCaminhosXml.Count; i++)
            {

                if ((hostservidor != "") && (porta != "0") && (remetente != "") && (senha != ""))
                {
                    for (int e = 0; e < objlbelIde.Count; e++)
                    {
                        if (lCaminhosXml[i].Substring(lCaminhosXml[i].IndexOf("-nfe") - 7, 6).Equals(objlbelIde[e].Nnf))
                        {
                            InformaStatusEnvio("Estruturando Email", i, lCaminhosXml.Count);
                            belEmail objemail = new belEmail(objlbelIde[e].Nnf, objlbelIde[e].Cnf, belStatic.codEmpresaNFe, hostservidor, porta, remetente, senha, @lCaminhosXml[i], "", autentica);
                            objlbelEmail.Add(objemail);
                        }
                    }
                }
                else
                {
                    if (KryptonMessageBox.Show(null, "Campos para o envio de e-Mail automático não estão preenchidos corretamente!" +
                                    Environment.NewLine + Environment.NewLine +
                                    "Deseja Preencher os campos corretamente agora ?", "E-Mail não pode ser enviado", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
                    {
                        frmConfiguracao objconfiguracao = new frmConfiguracao(2);
                        objconfiguracao.ShowDialog();
                    }
                    else
                    {
                        break;
                    }
                }
            }

            if (objlbelEmail.Count > 0)
            {
                frmEmailNfe objfrmEmail = new frmEmailNfe(objlbelEmail);
                objfrmEmail.ShowDialog();
                int icount = 0;
                for (int i = 0; i < objfrmEmail.objLbelEmail.Count; i++)
                {
                    if ((objfrmEmail.objLbelEmail[i]._envia == true) && (objfrmEmail.objLbelEmail[i]._para != "" || objfrmEmail.objLbelEmail[i]._paraTransp != ""))
                    {
                        try
                        {
                            InformaStatusEnvio("Enviando Email", i, lCaminhosXml.Count);
                            objfrmEmail.objLbelEmail[i].enviaEmail();
                            icount++;
                        }
                        catch (Exception ex)
                        {
                            KryptonMessageBox.Show(null, ex.Message + Environment.NewLine + Environment.NewLine + "E-mail: " + objfrmEmail.objLbelEmail[i]._para + "   - Seq: " + objfrmEmail.objLbelEmail[i]._sSeq, "E R R O - E N V I O", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
                if (icount > 0)
                {
                    KryptonMessageBox.Show(null, "Procedimento de Envio de E-mail Finalizado!"
                           + Environment.NewLine
                           + Environment.NewLine,
                           "A V I S O",
                            MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
        private void EnviaEmailCancelamento(List<string> objListaEmail) //NFe_2.0
        {
            try
            {
                Globais LeRegWin = new Globais();
                string hostservidor = LeRegWin.LeRegConfig("HostServidor").ToString().Trim();
                string porta = LeRegWin.LeRegConfig("PortaServidor").ToString().Trim();
                string remetente = LeRegWin.LeRegConfig("EmailRemetente").ToString().Trim();
                string senha = LeRegWin.LeRegConfig("SenhaRemetente").ToString().Trim();
                bool autentica = Convert.ToBoolean(LeRegWin.LeRegConfig("RequerSSL").ToString().Trim());
                List<belEmail> objlbelEmail = new List<belEmail>();
                int iCount = 0;

                if ((hostservidor != "") && (porta != "0") && (remetente != "") && (senha != ""))
                {
                    for (int i = 0; i < objListaEmail.Count; i++)
                    {
                        belEmail objemail = new belEmail(objListaEmail[i].Substring(0, 6), LeRegWin.LeRegConfig("Empresa").ToString().Trim(), hostservidor, porta, remetente, senha, "", autentica);
                        objlbelEmail.Add(objemail);
                    }
                }
                else
                {
                    if (KryptonMessageBox.Show(null, "Campos para o envio de e-Mail automático não estão preenchidos corretamente!" +
                                    Environment.NewLine + Environment.NewLine +
                                    "Deseja Preencher os campos corretamente agora ?", "E-Mail não pode ser enviado", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
                    {
                        Boolean ok = false;
                        foreach (Form frm in this.MdiChildren)
                        {
                            if (frm is frmLoginConfig)
                            {
                                frm.BringToFront();
                                ok = true;
                            }
                        }
                        if (!ok)
                        {
                            frmLoginConfig objfrm = new frmLoginConfig(objPrincipal);
                            objfrm.MdiParent = this;
                            objfrm.Show();
                        }
                    }
                }
                if (objlbelEmail.Count > 0)
                {
                    frmEmailNfe objfrmEmail = new frmEmailNfe(objlbelEmail);
                    objfrmEmail.sTipo = "C";
                    objfrmEmail.ShowDialog();
                    for (int i = 0; i < objfrmEmail.objLbelEmail.Count; i++)
                    {
                        if ((objfrmEmail.objLbelEmail[i]._envia == true) && (objfrmEmail.objLbelEmail[i]._para != "" || objfrmEmail.objLbelEmail[i]._paraTransp != ""))
                        {
                            try
                            {
                                objfrmEmail.objLbelEmail[i].enviaEmail();
                                iCount++;
                            }
                            catch (Exception ex)
                            {
                                KryptonMessageBox.Show(null, ex.Message + Environment.NewLine + Environment.NewLine + "E-mail: " + objfrmEmail.objLbelEmail[i]._para + "   - Seq: " + objfrmEmail.objLbelEmail[i]._sSeq, "E R R O - E N V I O", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                    }
                    if (iCount > 0)
                    {
                        KryptonMessageBox.Show(null, "Procedimento de Envio de E-mail Finalizado!"
                            + Environment.NewLine
                            + Environment.NewLine,
                            "A V I S O",
                             MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch (Exception ex)
            {
                KryptonMessageBox.Show(null, ex.Message, "ALERTA", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

        }
        private void EnviaEmailCancelamento(string sSeq) //NFe_2.0
        {
            string hostservidor = LeRegWin.LeRegConfig("HostServidor").ToString().Trim();
            string porta = LeRegWin.LeRegConfig("PortaServidor").ToString().Trim();
            string remetente = LeRegWin.LeRegConfig("EmailRemetente").ToString().Trim();
            string senha = LeRegWin.LeRegConfig("SenhaRemetente").ToString().Trim();
            bool autentica = Convert.ToBoolean(LeRegWin.LeRegConfig("RequerSSL").ToString().Trim());
            List<belEmail> objlbelEmail = new List<belEmail>();
            if ((hostservidor != "") && (porta != "0") && (remetente != "") && (senha != ""))
            {
                belEmail objemail = new belEmail(sSeq, belStatic.codEmpresaNFe, hostservidor, porta, remetente, senha, "", autentica);
                objlbelEmail.Add(objemail);
            }
            else
            {
                if (KryptonMessageBox.Show(null, "Campos para o envio de e-Mail automático não estão preenchidos corretamente!" +
                                Environment.NewLine + Environment.NewLine +
                                "Deseja Preencher os campos corretamente agora ?", "E-Mail não pode ser enviado", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
                {
                    frmConfiguracao objconfiguracao = new frmConfiguracao(2);
                    objconfiguracao.ShowDialog();
                }
            }
            if (objlbelEmail.Count > 0)
            {
                frmEmailNfe objfrmEmail = new frmEmailNfe(objlbelEmail);
                objfrmEmail.sTipo = "C";
                objfrmEmail.ShowDialog();
                for (int i = 0; i < objfrmEmail.objLbelEmail.Count; i++)
                {
                    if ((objfrmEmail.objLbelEmail[i]._envia == true) && (objfrmEmail.objLbelEmail[i]._para != "" || objfrmEmail.objLbelEmail[i]._paraTransp != ""))
                    {
                        try
                        {
                            objfrmEmail.objLbelEmail[i].enviaEmail();
                            KryptonMessageBox.Show(null, "Procedimento de Envio de E-mail Finalizado!"
                            + Environment.NewLine
                            + Environment.NewLine,
                            "A V I S O",
                             MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        catch (Exception ex)
                        {
                            KryptonMessageBox.Show(null, ex.Message + Environment.NewLine + Environment.NewLine + "E-mail: " + objfrmEmail.objLbelEmail[i]._para + "   - Seq: " + objfrmEmail.objLbelEmail[i]._sSeq, "E R R O - E N V I O", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
            }

        }