private void btnOK_Click(object sender, EventArgs e)
        {
            var Path1 = Application.StartupPath;

            if (ultraValidator1.Validate(true, false).IsValid)
            {
                if (txtLabel.Text.Trim() == "")
                {
                    MessageBox.Show("Por favor ingrese Correo Electrónico.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (txtSubject.Text.Trim() == "")
                {
                    MessageBox.Show("Por favor ingrese un Asunto.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }


                EmailBL  oEmailBL  = new EmailBL();
                emailDto oemailDto = new emailDto();
                oemailDto.v_Email = txtLabel.Text;
                OperationResult objOperationResult = new OperationResult();
                oEmailBL.AddEmail(ref objOperationResult, oemailDto);
                this.Enabled = false;
                _frmWaiting.Show(this);

                RunWorkerAsyncPackage packageForSave = new RunWorkerAsyncPackage();
                packageForSave.NombreEmpresaCliente = _EmpresaCliente;
                packageForSave.FechaInicio          = _FechaInicio;
                packageForSave.FechaFin             = _FechaFin;
                backgroundWorker1.RunWorkerAsync(packageForSave);
            }
        }
示例#2
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        System.Web.Security.MembershipUser user = System.Web.Security.Membership.GetUser();
        if (User.Identity.IsAuthenticated)
        {
            BusinessObject.Answers answer = new BusinessObject.Answers();
            answer.Ans        = editor1.Text;
            answer.QuestionId = Convert.ToInt16(Request.QueryString["Id"]);
            answer.CreatedOn  = Convert.ToString(DateTime.Now);
            answer.UserName   = user.UserName;
            answer.IsApproved = false;
            answer.IsDeleted  = false;
            BusinessLogic.AnswerBL.Add(answer);

            Repeater1.DataBind();

            Email email = new Email();

            email.to = System.Configuration.ConfigurationManager.AppSettings["Mail"];

            email.subject = System.Web.Security.Membership.GetUser().Email;

            email.body = editor1.Text + "................" + System.Web.Security.Membership.GetUser().Email;

            EmailBL.sendmail(email);
        }
    }
示例#3
0
 protected void RadAjaxManager1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
 {
     lblError.Text           = "";
     lblError.Visible        = false;
     lblPasswordSent.Visible = false;
     if (!UserBL.ExistsUsername(txtUsername.Text))
     {
         lblError.Visible = true;
         lblError.Text    = "Usuario no encontrado.";
         return;
     }
     else
     {
         var user                  = UserBL.GetUserByUsername(txtUsername.Text);
         var lstParameters         = ParameterBL.GetParameters();
         var ForgotPasswordSubject = lstParameters.Where(p => p.Name.Equals("ForgotPasswordSubject")).FirstOrDefault().Value;
         var ForgotPasswordBody    = lstParameters.Where(p => p.Name.Equals("ForgotPasswordBody")).FirstOrDefault().Value.Replace("{Password}", user.Password);
         EmailBL.SendEmails(new DA.MailMessageDA()
         {
             ToAddresses = new string[] { user.Email }, Subject = ForgotPasswordSubject, Body = ForgotPasswordBody
         });
         var PasswordSent = lstParameters.Where(p => p.Name.Equals("PasswordSentText")).FirstOrDefault().Value;
         lblPasswordSent.Text    = PasswordSent;
         lblPasswordSent.Visible = true;
     }
 }
示例#4
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (ultraValidator1.Validate(true, false).IsValid)
            {
                if (txtLabel.Text.Trim() == "")
                {
                    MessageBox.Show("Por favor ingrese Correo Electrónico.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (txtSubject.Text.Trim() == "")
                {
                    MessageBox.Show("Por favor ingrese un Asunto.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                EmailBL  oEmailBL  = new EmailBL();
                emailDto oemailDto = new emailDto();
                oemailDto.v_Email = txtLabel.Text;
                OperationResult objOperationResult = new OperationResult();
                oEmailBL.AddEmail(ref objOperationResult, oemailDto);


                this.Enabled = false;
                _frmWaiting.Show(this);
                backgroundWorker1.RunWorkerAsync();
            }
        }
示例#5
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        // To get the username, we will have to use the Membership class in System.Web.Security namespace
        System.Web.Security.MembershipUser user = System.Web.Security.Membership.GetUser();


        Uploads upload = new Uploads();

        upload.UserName = user.UserName;


        if (System.Web.Security.Roles.IsUserInRole("Admin"))
        {
            upload.IsApproved = true;
        }
        else
        {
            upload.IsApproved = false;
        }
        upload.IsDeleted = false;


        upload.CreatedOn = Convert.ToString(DateTime.Now);


        upload.TopicsId      = Convert.ToInt16(DropDownList2.SelectedValue);
        upload.IsDeleted     = false;
        upload.UploadsTypeId = Convert.ToInt16(DropDownList3.SelectedValue);

        upload.Title = UploadFileTitle.Text;

        if (FileUpload1.HasFile)
        {
            string UploadFolderRelativePath = "~/Uploads/";
            string UploadFolderAbsolutePath = Server.MapPath(UploadFolderRelativePath);

            string FullFilePath     = string.Format("{0}/{1}", UploadFolderAbsolutePath, FileUpload1.FileName);
            string FileRelativePath = string.Format("{0}/{1}", UploadFolderRelativePath, FileUpload1.FileName);

            FileUpload1.SaveAs(FullFilePath);
            upload.Path = FileRelativePath;
        }



        UploadsBL.Add(upload);


        Email send = new Email();

        send.to = "*****@*****.**";

        send.subject = System.Web.Security.Membership.GetUser().Email;

        send.body = "New user add some file <a href='http://localhost:2709/WebUI/Admin/ManageUploads.aspx'>click Link to approved the file</a>";

        EmailBL.sendmail(send);
    }
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (txtLabel.Text.Trim() == "")
            {
                MessageBox.Show("Por favor ingrese Correo Electrónico.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (txtSubject.Text.Trim() == "")
            {
                MessageBox.Show("Por favor ingrese un Asunto.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (rbInforme1.Checked)
            {
                foreach (var item in _ListaServicios)
                {
                    var o = ruta + item.ToString() + "-" + Constants.INFORME_FICHA_MEDICA_TRABAJADOR + ".pdf";
                    _filesNameToMerge.Add(o);
                }
            }
            else if (rbInforme2.Checked)
            {
                foreach (var item in _ListaServicios)
                {
                    var o = ruta + item.ToString() + "-" + Constants.INFORME_FICHA_MEDICA_TRABAJADOR_2 + ".pdf";
                    _filesNameToMerge.Add(o);
                }
            }

            var x = _filesNameToMerge.ToList();

            _mergeExPDF.FilesName = x;
            var EmpresaCliente = _EmpresaCliente.Replace("/", "_");

            _mergeExPDF.DestinationFile = ruta + "Informes " + EmpresaCliente + ".pdf";
            _mergeExPDF.Execute();


            EmailBL  oEmailBL  = new EmailBL();
            emailDto oemailDto = new emailDto();

            oemailDto.v_Email = txtLabel.Text;
            OperationResult objOperationResult = new OperationResult();

            oEmailBL.AddEmail(ref objOperationResult, oemailDto);
            this.Enabled = false;
            _frmWaiting.Show(this);

            RunWorkerAsyncPackage packageForSave = new RunWorkerAsyncPackage();

            packageForSave.NombreEmpresaCliente = _EmpresaCliente;
            packageForSave.FechaInicio          = _FechaInicio;
            packageForSave.FechaFin             = _FechaFin;
            backgroundWorker1.RunWorkerAsync(packageForSave);
        }
        public bool ConfirmOrder([FromBody] Order order)
        {
            bool    isSend  = false;
            EmailBL emailBL = new EmailBL();

            var httpResponse = new HttpResponseMessage();


            if (emailBL.SendOrderConfirmationEmail(order))
            {
                isSend = true;
            }
            return(isSend);
        }
示例#8
0
    protected void Submit_Click(object sender, EventArgs e)
    {
        Email email = new Email();

        email.to      = System.Configuration.ConfigurationManager.AppSettings["Mail"];
        email.subject = MsgTitle.Text + " " + EmailAddress.Text;
        email.body    = Body.Text;

        EmailBL.sendmail(email);

        EmailAddress.Text = " ";
        MsgTitle.Text     = " ";
        Body.Text         = " ";
        Number.Text       = " ";
        FullName.Text     = " ";
    }
示例#9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            value      = Request.QueryString["eValue"];
            guestEmail = Request.QueryString["Guest"];
            eventId    = Request.QueryString["Event"];


            //if the user has arrived here by clicking an rsvp link then the rsvp system has to save the guest information
            if (value != null && guestEmail != null && eventId != null)
            {
                EmailBL emailNew = new EmailBL();

                GuestBL guest = emailNew.GetActiveGuest(eventId, guestEmail);

                emailNew.ChangeGuestRSVP(guest, Convert.ToInt32(value));
            }
        }
示例#10
0
        private void frmEnviarCertificados_Load(object sender, EventArgs e)
        {
            OperationResult objOperationResult = new OperationResult();
            EmailBL         oEmailBL           = new EmailBL();

            txtLabel.Select();
            txtLabel.DataSource    = oEmailBL.LlenarEmail(ref objOperationResult);
            txtLabel.DisplayMember = "v_Email";
            txtLabel.ValueMember   = "v_Email";

            txtLabel.AutoCompleteMode      = Infragistics.Win.AutoCompleteMode.Suggest;
            txtLabel.AutoSuggestFilterMode = Infragistics.Win.AutoSuggestFilterMode.Contains;
            this.txtLabel.DropDownWidth    = 550;
            //this.txtLabel.DisplayLayout.AutoFitStyle = AutoFitStyle.ResizeAllColumns;

            txtLabel.DisplayLayout.Bands[0].Columns[0].Width = 10;
            txtLabel.DisplayLayout.Bands[0].Columns[1].Width = 350;
        }
示例#11
0
    protected void SubmitAns_Click(object sender, EventArgs e)
    {
        System.Web.Security.MembershipUser user = System.Web.Security.Membership.GetUser();

        Question question = new Question();


        question.Title       = QuestionTitleV.Text;
        question.Description = DescriptionV.Text;
        question.UserName    = user.UserName;

        if (System.Web.Security.Roles.IsUserInRole("Admin"))
        {
            question.IsApproved = true;
        }
        else
        {
            question.IsApproved = false;
        }


        question.CreatedOn = Convert.ToString(DateTime.Now);
        question.IsDeleted = false;


        QuestionBL.Add(question);

        Email email = new Email();

        email.to = System.Configuration.ConfigurationManager.AppSettings["Mail"];

        email.subject = QuestionTitleV.Text;


        email.body = QuestionTitleV.Text + "..............." + System.Web.Security.Membership.GetUser().Email + "................" + DescriptionV.Text + "<br/>" + "http://localhost:4949/WebUI/Admin/Default.aspx";


        EmailBL.sendmail(email);


        QuestionTitleV.Text = " ";

        DescriptionV.Text = " ";
    }
示例#12
0
        protected void GenerateQrScan()
        {
            string          code        = txtIDNumber.Text + txtName.Text + txtSurname.Text;
            QRCodeGenerator qrGenerator = new QRCodeGenerator();
            QRCodeData      qrCodeData  = qrGenerator.CreateQrCode(code, QRCodeGenerator.ECCLevel.Q);
            QRCode          qrCode      = new QRCode(qrCodeData);

            System.Web.UI.WebControls.Image imgBarCode = new System.Web.UI.WebControls.Image();
            imgBarCode.Height = 150;
            imgBarCode.Width  = 150;
            using (Bitmap bitMap = qrCode.GetGraphic(20))
            {
                using (MemoryStream ms = new MemoryStream())
                {
                    bitMap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                    byte[] byteImage = ms.ToArray();
                    imgBarCode.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(byteImage);
                }
                PlaceHolder1.Controls.Add(imgBarCode);



                using (LoyaltyPointSystemEntities db = new LoyaltyPointSystemEntities())
                {
                    EmailBL EML = new EmailBL();

                    EML.Email("You have successfully Registered for Loyalty Points: " + txtName.Text + " " + txtSurname.Text, "Dear" + txtName.Text

                              + "<br/> <br/>"

                              + "This is your QrScan :" + "< img src = " + imgBarCode + " >" + "<br/>" +
                              "Your application has been Approve. " + "<br/>" +


                              "<br/>" + "This is an automatically generated email. Please do not reply. " +

                              "<br/> <br/>" + "For more details feel free to call us on 031 455 4576." + "<br/> <br/>" +
                              "Regards" + "<br/>" +
                              "Loyalty Point", txtEmail.Text, "Loyalty Point", "*****@*****.**");
                }
            }
        }
        private void frmEnvioEmailCalendar_Load(object sender, EventArgs e)
        {
            OperationResult  objOperationResult = new OperationResult();
            List <EmailList> ListaEmails        = new List <EmailList>();
            EmailBL          oEmailBL           = new EmailBL();

            txtLabel.Select();
            txtLabel.DataSource    = oEmailBL.LlenarEmail(ref objOperationResult);
            txtLabel.DisplayMember = "v_Email";
            txtLabel.ValueMember   = "v_Email";

            txtLabel.AutoCompleteMode      = Infragistics.Win.AutoCompleteMode.Suggest;
            txtLabel.AutoSuggestFilterMode = Infragistics.Win.AutoSuggestFilterMode.Contains;
            this.txtLabel.DropDownWidth    = 550;
            //this.txtLabel.DisplayLayout.AutoFitStyle = AutoFitStyle.ResizeAllColumns;

            txtLabel.DisplayLayout.Bands[0].Columns[0].Width = 10;
            txtLabel.DisplayLayout.Bands[0].Columns[1].Width = 350;
            var clientOrganization = BLL.Utils.GetJoinOrganization(ref objOperationResult, Globals.ClientSession.i_CurrentExecutionNodeId);
        }
示例#14
0
        public void sendEmail()
        {
            using (LoyaltyPointSystemEntities db = new LoyaltyPointSystemEntities())
            {
                EmailBL EML = new EmailBL();

                EML.Email("Status Notification for Reference No: " + "refNo", "Dear Applicant"

                          + "<br/> <br/>"

                          + "Your Reference is :" + "refNo" + "<br/>" +
                          "Your application has been Approve. " + "<br/>" +


                          "<br/>" + "This is an automatically generated email. Please do not reply. " +

                          "<br/> <br/>" + "For more details feel free to call us on 031 455 4576." + "<br/> <br/>" +
                          "Regards" + "<br/>" +
                          "Ethekwini Municipality", "*****@*****.**", "Ethekwini Municipality", "*****@*****.**");
            }
        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (ultraValidator1.Validate(true, false).IsValid)
            {
                if (txtLabel.Text.Trim() == "")
                {
                    MessageBox.Show("Por favor ingrese Correo Electrónico.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (txtSubject.Text.Trim() == "")
                {
                    MessageBox.Show("Por favor ingrese un Asunto.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (rbCotizacion.Checked)
                {
                    //var frm = new Reports.frmConsolidateCotizacion(_serviceOrderId, _protocolId);
                    //frm.ShowDialog();
                }
                else
                {
                    //var frm = new Reports.frmConsolidateServiceOrder(_serviceOrderId, _protocolId);
                    //frm.ShowDialog();
                }
                EmailBL  oEmailBL  = new EmailBL();
                emailDto oemailDto = new emailDto();
                oemailDto.v_Email = txtLabel.Text;
                OperationResult objOperationResult = new OperationResult();
                oEmailBL.AddEmail(ref objOperationResult, oemailDto);
                this.Enabled = false;
                _frmWaiting.Show(this);
                backgroundWorker1.RunWorkerAsync();
            }
        }
示例#16
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            var Path1 = Application.StartupPath;

            if (ultraValidator1.Validate(true, false).IsValid)
            {
                if (txtLabel.Text.Trim() == "")
                {
                    MessageBox.Show("Por favor ingrese Correo Electrónico.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (txtSubject.Text.Trim() == "")
                {
                    MessageBox.Show("Por favor ingrese un Asunto.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (rbCotizacion.Checked)
                {
                    ServiceBL                  oServiceBL  = new ServiceBL();
                    ProtocolBL                 oProtocolBL = new ProtocolBL();
                    ReportDocument             rp;
                    DiskFileDestinationOptions objDiskOpt = new DiskFileDestinationOptions();

                    string ruta          = Common.Utils.GetApplicationConfigValue("rutaCotizacion").ToString();
                    var    MedicalCenter = oServiceBL.GetInfoMedicalCenterSede();

                    DataSet   ds      = new DataSet();
                    var       Valores = new ServiceBL().ObtenerCabeceraCotizacion(ddlCustomerOrganization.SelectedValue.ToString());
                    DataTable dt      = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(Valores);
                    dt.TableName = "dtCartaCotizacion";
                    ds.Tables.Add(dt);

                    //Reporte 1
                    rp = new Reports.crReporteCotizacion01();
                    rp.SetDataSource(ds);

                    rp.ExportOptions.ExportFormatType      = ExportFormatType.PortableDocFormat;
                    rp.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
                    objDiskOpt = new DiskFileDestinationOptions();
                    objDiskOpt.DiskFileName = ruta + "Cotizacion1.pdf";
                    _filesNameToMerge.Add(objDiskOpt.DiskFileName);
                    rp.ExportOptions.DestinationOptions = objDiskOpt;
                    rp.Export();
                    rp.Close();

                    //Reporte 2
                    rp = new Reports.crReporteCotizacion02();
                    rp.SetDataSource(ds);

                    rp.ExportOptions.ExportFormatType      = ExportFormatType.PortableDocFormat;
                    rp.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
                    objDiskOpt = new DiskFileDestinationOptions();
                    objDiskOpt.DiskFileName = ruta + "Cotizacion2.pdf";
                    _filesNameToMerge.Add(objDiskOpt.DiskFileName);
                    rp.ExportOptions.DestinationOptions = objDiskOpt;
                    rp.Export();
                    rp.Close();

                    //Reporte 3
                    rp = new Reports.crReporteCotizacion03();
                    rp.SetDataSource(ds);

                    rp.ExportOptions.ExportFormatType      = ExportFormatType.PortableDocFormat;
                    rp.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
                    objDiskOpt = new DiskFileDestinationOptions();
                    objDiskOpt.DiskFileName = ruta + "Cotizacion3.pdf";
                    _filesNameToMerge.Add(objDiskOpt.DiskFileName);
                    rp.ExportOptions.DestinationOptions = objDiskOpt;
                    rp.Export();
                    rp.Close();


                    //Reporte 4
                    rp = new Reports.crReporteCotizacion04();
                    rp.SetDataSource(ds);

                    rp.ExportOptions.ExportFormatType      = ExportFormatType.PortableDocFormat;
                    rp.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
                    objDiskOpt = new DiskFileDestinationOptions();
                    objDiskOpt.DiskFileName = ruta + "Cotizacion4.pdf";
                    _filesNameToMerge.Add(objDiskOpt.DiskFileName);
                    rp.ExportOptions.DestinationOptions = objDiskOpt;
                    rp.Export();
                    rp.Close();


                    var l = oProtocolBL.CotizacionProtocoloPorEmpresaClienteId(ddlCustomerOrganization.SelectedValue.ToString());
                    HojaCotizacion.CrearHojaCotizacion(l, ddlCustomerOrganization.Text, MedicalCenter, ruta + ddlCustomerOrganization.Text + ".pdf");
                    _filesNameToMerge.Add(string.Format("{0}.pdf", Path.Combine(ruta + ddlCustomerOrganization.Text)));

                    _filesNameToMerge.Add(string.Format("{0}.pdf", Path1 + @"\Archivos\Archivo2"));

                    var x = _filesNameToMerge.ToList();
                    _mergeExPDF.FilesName       = x;
                    _mergeExPDF.DestinationFile = ruta + ddlCustomerOrganization.Text + " " + DateTime.Now.Date.ToString("dd MMMM") + ".pdf";;
                    _mergeExPDF.Execute();
                }
                else if (rbCarta.Checked)
                {
                    string ruta = Common.Utils.GetApplicationConfigValue("rutaCotizacion").ToString();

                    ReportDocument             rp;
                    DiskFileDestinationOptions objDiskOpt = new DiskFileDestinationOptions();
                    DataSet   ds      = new DataSet();
                    var       Valores = new ServiceBL().ObtenerCabeceraCotizacion(ddlCustomerOrganization.SelectedValue.ToString());
                    DataTable dt      = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(Valores);
                    dt.TableName = "dtCartaCotizacion";
                    ds.Tables.Add(dt);

                    rp = new Reports.crCartaPresentación();
                    rp.SetDataSource(ds);

                    rp.ExportOptions.ExportFormatType      = ExportFormatType.PortableDocFormat;
                    rp.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
                    objDiskOpt = new DiskFileDestinationOptions();
                    objDiskOpt.DiskFileName = ruta + "Carta Presentación " + ddlCustomerOrganization.Text + ".pdf";
                    _filesNameToMerge.Add(objDiskOpt.DiskFileName);
                    rp.ExportOptions.DestinationOptions = objDiskOpt;
                    rp.Export();
                    rp.Close();

                    _filesNameToMerge.Add(string.Format("{0}.pdf", Path1 + @"\Archivos\Archivo1"));

                    var x = _filesNameToMerge.ToList();
                    _mergeExPDF.FilesName       = x;
                    _mergeExPDF.DestinationFile = ruta + "Carta Presentación " + ddlCustomerOrganization.Text + " " + DateTime.Now.Date.ToString("dd MMMM") + ".pdf";
                    _mergeExPDF.Execute();
                }
                //else if (rbDocumentos.Checked)
                //{
                //    List<string> ArchivoAdjunto = new List<string>();
                //    ArchivoAdjunto.Add(Path1 + @"\Archivos\Acreditacion.pdf");
                //    ArchivoAdjunto.Add(Path1 + @"\Archivos\Recomendaciones.pdf");
                //    ArchivoAdjunto.Add(Path1 + @"\Archivos\Informacion.pdf");
                //    ArchivoAdjunto.Add(Path1 + @"\Archivos\Mapa.pdf");

                //    ArchivoAdjunto.Add(Path1 + @"\Archivos\PLANTILLA.xlsx");
                //    ArchivoAdjunto.Add(Path1 + @"\Archivos\FICHA CLIENTE.xlsx");
                //}
                EmailBL  oEmailBL  = new EmailBL();
                emailDto oemailDto = new emailDto();
                oemailDto.v_Email = txtLabel.Text;
                OperationResult objOperationResult = new OperationResult();
                oEmailBL.AddEmail(ref objOperationResult, oemailDto);
                this.Enabled = false;
                _frmWaiting.Show(this);
                RunWorkerAsyncPackage packageForSave = new RunWorkerAsyncPackage();
                packageForSave.NombreEmpresaCliente = ddlCustomerOrganization.Text;
                backgroundWorker1.RunWorkerAsync(packageForSave);
            }
        }
示例#17
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (txtLabel.Text.Trim() == "")
            {
                MessageBox.Show("Por favor ingrese Correo Electrónico.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (txtSubject.Text.Trim() == "")
            {
                MessageBox.Show("Por favor ingrese un Asunto.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (rb312.Checked)
            {
                foreach (var item in _ListaServicios)
                {
                    var o = ruta + item.ToString() + "-" + Constants.INFORME_CERTIFICADO_APTITUD + ".pdf";
                    _filesNameToMerge.Add(o);
                }
            }
            else if (rbEmpresarial.Checked)
            {
                foreach (var item in _ListaServicios)
                {
                    var o = ruta + item.ToString() + "-" + Constants.INFORME_CERTIFICADO_APTITUD_EMPRESARIAL + ".pdf";
                    _filesNameToMerge.Add(o);
                }
            }
            else if (rbSinDx.Checked)
            {
                foreach (var item in _ListaServicios)
                {
                    var o = ruta + item.ToString() + "-" + Constants.INFORME_CERTIFICADO_APTITUD_SIN_DX + ".pdf";
                    _filesNameToMerge.Add(o);
                }
            }
            else if (rbToxicologico.Checked)
            {
                foreach (var item in _ListaServicios)
                {
                    var o = ruta + item.ToString() + "-" + Constants.TOXICOLOGICO_ID + ".pdf";
                    _filesNameToMerge.Add(o);
                }
            }
            else if (rbAltura18.Checked)
            {
                foreach (var item in _ListaServicios)
                {
                    var o = ruta + item.ToString() + "-" + Constants.ALTURA_ESTRUCTURAL_ID + ".pdf";
                    _filesNameToMerge.Add(o);
                }
            }
            else if (rbSomnolencia.Checked)
            {
                foreach (var item in _ListaServicios)
                {
                    var o = ruta + item.ToString() + "-" + Constants.SOMNOLENCIA_ID + ".pdf";
                    _filesNameToMerge.Add(o);
                }
            }


            var resultado = MessageBox.Show("¿Desea enviar certificados?", "¡ INFORMACIÓN !", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            if (resultado == DialogResult.Yes)
            {
                foreach (var item in _ListaServicios)
                {
                    _serviceBL.ActualizarEnvioCertificado(item, 1);
                }
            }

            var x = _filesNameToMerge.ToList();

            _mergeExPDF.FilesName = x;
            var EmpresaCliente = _EmpresaCliente.Replace("/", "_");

            _mergeExPDF.DestinationFile = ruta + "Certificados " + EmpresaCliente + " " + _FechaInicio + " " + _FechaFin + ".pdf";
            _mergeExPDF.Execute();


            EmailBL  oEmailBL  = new EmailBL();
            emailDto oemailDto = new emailDto();

            oemailDto.v_Email = txtLabel.Text;
            OperationResult objOperationResult = new OperationResult();

            oEmailBL.AddEmail(ref objOperationResult, oemailDto);
            this.Enabled = false;
            _frmWaiting.Show(this);

            RunWorkerAsyncPackage packageForSave = new RunWorkerAsyncPackage();

            packageForSave.NombreEmpresaCliente = _EmpresaCliente;
            packageForSave.FechaInicio          = _FechaInicio;
            packageForSave.FechaFin             = _FechaFin;
            backgroundWorker1.RunWorkerAsync(packageForSave);
        }
示例#18
0
        private void SendHtmlFormattedEmail(string body)
        {
            guestListTemp = new List <String>();

            //Loop through all the texboxes created in the placeholder
            foreach (Control ctr in PlaceHolder1.Controls)
            {
                //Check to see if the control is a textbox
                if (ctr is TextBox)
                {
                    //Try catch to stop app from crashing if sending email fails
                    try
                    {
                        SmtpClient client = new SmtpClient();
                        client.DeliveryMethod = SmtpDeliveryMethod.Network;
                        client.EnableSsl      = true;
                        client.Host           = "smtp.gmail.com";
                        client.Port           = 587;
                        System.Net.NetworkCredential credentials =
                            new System.Net.NetworkCredential("*****@*****.**", "eventready123");
                        client.UseDefaultCredentials = false;
                        client.Credentials           = credentials;


                        //Add email content including from, to, subject and body
                        MailMessage msg = new MailMessage();
                        msg.From = new MailAddress("*****@*****.**");
                        msg.To.Add(new MailAddress(((TextBox)ctr).Text));
                        msg.Subject = "EventReady - Invitation";
                        //Add the guest email for each email sent as a variable for the RSVP buttons
                        body = body.Replace("{guestEmail}", ((TextBox)ctr).Text);

                        string testthis = ((TextBox)ctr).Text;
                        msg.Body       = body;
                        msg.IsBodyHtml = true;

                        AlternateView view = AlternateView
                                             .CreateAlternateViewFromString(
                            body, null, "text/html");
                        string         imgPathOne = Server.MapPath("../Image/ribbon.png");
                        LinkedResource img        = new LinkedResource(imgPathOne);
                        img.ContentId = "ribbonImage";
                        view.LinkedResources.Add(img);

                        msg.AlternateViews.Add(view);

                        //Getting textbox value
                        string tempEmail = ((TextBox)ctr).Text;



                        //Adding it to a new list
                        guestListTemp.Add(tempEmail);
                        count++;

                        client.Send(msg);
                        //Changes the email value back to guestEmail so it can redo for the next loop
                        body = body.Replace(((TextBox)ctr).Text, "{guestEmail}");


                        EmailBL emailInfo = new EmailBL();

                        eventID = Request.QueryString["eventId"];
                        //needs eventId

                        emailInfo.AddToGuestList(((TextBox)ctr).Text, eventID);
                    }

                    catch
                    {
                        //Display error message for email failing to send
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Invitations were unable to be sent to all guests. Emails with correct addresses were sent');window.location ='Home.aspx';", true);
                    }
                }
            }
        }
示例#19
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (txtLabel.Text.Trim() == "")
            {
                MessageBox.Show("Por favor ingrese Correo Electrónico.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (txtSubject.Text.Trim() == "")
            {
                MessageBox.Show("Por favor ingrese un Asunto.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (rb312.Checked)
            {
                foreach (var item in _ListaServicios)
                {
                    var o = ruta + item.ToString() + "-" + Constants.INFORME_CERTIFICADO_APTITUD + ".pdf";
                    _filesNameToMerge.Add(o);
                }
            }
            else if (rbEmpresarial.Checked)
            {
                foreach (var item in _ListaServicios)
                {
                    var o = ruta + item.ToString() + "-" + Constants.INFORME_CERTIFICADO_APTITUD_EMPRESARIAL + ".pdf";
                    _filesNameToMerge.Add(o);
                }
            }
            else if (rbSinDx.Checked)
            {
                foreach (var item in _ListaServicios)
                {
                    var o = ruta + item.ToString() + "-" + Constants.INFORME_CERTIFICADO_APTITUD_SIN_DX + ".pdf";
                    _filesNameToMerge.Add(o);
                }
            }
            else if (rbToxicologico.Checked)
            {
                foreach (var item in _ListaServicios)
                {
                    var o = ruta + item.ToString() + "-" + Constants.TOXICOLOGICO_ID + ".pdf";
                    _filesNameToMerge.Add(o);
                }
            }
            else if (rbAltura18.Checked)
            {
                foreach (var item in _ListaServicios)
                {
                    var o = ruta + item.ToString() + "-" + Constants.ALTURA_ESTRUCTURAL_ID + ".pdf";
                    _filesNameToMerge.Add(o);
                }
            }
            else if (rbSomnolencia.Checked)
            {
                foreach (var item in _ListaServicios)
                {
                    var o = ruta + item.ToString() + "-" + Constants.SOMNOLENCIA_ID + ".pdf";
                    _filesNameToMerge.Add(o);
                }
            }

            var x = _filesNameToMerge.ToList();

            _mergeExPDF.FilesName       = x;
            _mergeExPDF.DestinationFile = ruta + "Consolidado de Formatos" + ".pdf";
            _mergeExPDF.Execute();


            EmailBL  oEmailBL  = new EmailBL();
            emailDto oemailDto = new emailDto();

            oemailDto.v_Email = txtLabel.Text;
            OperationResult objOperationResult = new OperationResult();

            oEmailBL.AddEmail(ref objOperationResult, oemailDto);
            this.Enabled = false;
            _frmWaiting.Show(this);
            backgroundWorker1.RunWorkerAsync();
        }
示例#20
0
 public void CreateEmail(EmailDTO email)
 {
     EmailBL.CreateEmail(email);
 }
示例#21
0
    protected void MailTemplate()
    {
        try
        {
            if (gdvParticipantes.Rows.Count > 0)
            {
                StringBuilder    sb  = new StringBuilder();
                UserControl      ctr = (UserControl)LoadControl("~/Minutas/TemplateMailMinuta.ascx");
                StringWriter     sw  = new StringWriter(sb);
                Html32TextWriter htw = new Html32TextWriter(sw);
                ctr.RenderControl(htw);
                string templete = sb.ToString();
                idsesion = Convert.ToInt32(hd_idsesion.Value);
                MinutasUsuarios mu = new MinutasUsuarios()
                {
                    ObjMinutas = new Minutas(), ObjUsuarios = new UsuariosDatos()
                    {
                        User = new Usuarios()
                    }
                };
                mu.ObjMinutas.IdSesion     = idsesion;
                mu.ObjUsuarios.User.IdUser = Convert.ToInt32(Session["IdUser"]);
                MinutasBL blmu = new MinutasBL();


                MinutasBL bl  = new MinutasBL();
                Minutas   min = new Minutas()
                {
                    ObjUsuarios = new UsuariosDatos()
                    {
                        User = new Usuarios()
                    }
                };
                min.IdSesion = idsesion;
                min.ObjUsuarios.User.IdUser = Convert.ToInt32(Session["IdUser"]);
                min = bl.GetMinutasbyFolio(min);

                templete = templete.Replace("#Foliominuta#", string.Format("{0:D8}", idsesion));
                templete = templete.Replace("#Fechacreacion#", min.Fecharegistro.ToShortDateString());
                templete = templete.Replace("#Usuariocreador#", min.ObjUsuarios.NombreUser);
                templete = templete.Replace("#Tematica#", min.ObjTemas.descripcion);
                templete = templete.Replace("#Fechaentrega#", min.Fechafin.HasValue ? min.Fechafin.Value.ToShortDateString() : "");
                templete = templete.Replace("#Tiposesion#", min.ObjTipoSesion.TipoSesion);

                templete = templete.Replace("#Objetivo#", HttpUtility.HtmlDecode(min.Objetivo));
                templete = templete.Replace("#Descripcion#", HttpUtility.HtmlDecode(min.Descripcion));

                string minutacompleta = "";

                Email   objemail = new Email();
                EmailBL blmail   = new EmailBL();
                objemail.Principal = true;
                objemail.IdMail    = 0;
                objemail.Usermail  = string.Empty;

                objemail        = blmail.GetEmail(objemail);
                objemail.Asunto = "Notificación de nueva Sesión de minuta. Folio " + string.Format("{0:D8}", idsesion);


                foreach (MinutasUsuarios item in blmu.GetUsuariosSesion(mu))
                {
                    MinutasUsuarios obj = new MinutasUsuarios()
                    {
                        ObjMinutas = new Minutas(), ObjUsuarios = new UsuariosDatos()
                        {
                            User = new Usuarios()
                        }
                    };
                    obj.ObjMinutas.IdSesion     = idsesion;
                    obj.ObjUsuarios.User.IdUser = item.IdUserMinuta;
                    MinutasBL mbl = new MinutasBL();

                    StringBuilder    sb1  = new StringBuilder();
                    UserControl      ctr1 = (UserControl)LoadControl("~/Minutas/TemplateMailMinuta.ascx");
                    StringWriter     sw1  = new StringWriter(sb1);
                    Html32TextWriter htw1 = new Html32TextWriter(sw1);
                    ctr1.RenderControl(htw1);
                    string templeteaux = sb1.ToString();

                    templeteaux = templeteaux.Replace("#Usuario#", item.ObjUsuarios.NombreCompleto);
                    templeteaux = templeteaux.Replace("#Foliominuta#", string.Format("{0:D8}", idsesion));
                    templeteaux = templeteaux.Replace("#Fechacreacion#", min.Fecharegistro.ToShortDateString());
                    templeteaux = templeteaux.Replace("#Usuariocreador#", min.ObjUsuarios.NombreUser);
                    templeteaux = templeteaux.Replace("#Tematica#", min.ObjTemas.descripcion);
                    templeteaux = templeteaux.Replace("#Fechaentrega#", min.Fechafin.HasValue ? min.Fechafin.Value.ToShortDateString() : "");
                    templeteaux = templeteaux.Replace("#Tiposesion#", min.ObjTipoSesion.TipoSesion);

                    templeteaux = templeteaux.Replace("#Objetivo#", HttpUtility.HtmlDecode(min.Objetivo));
                    templeteaux = templeteaux.Replace("#Descripcion#", HttpUtility.HtmlDecode(min.Descripcion));

                    StringBuilder                  sbltvUsuariosMinuta = new StringBuilder();
                    System.IO.StringWriter         stringWrite         = new System.IO.StringWriter(sbltvUsuariosMinuta);
                    System.Web.UI.Html32TextWriter htmlWrite           = new Html32TextWriter(stringWrite);

                    ltvUsuariosSesion.DataSource = mbl.GetUsuariosSesion(obj);
                    ltvUsuariosSesion.DataBind();
                    ltvUsuariosSesion.RenderControl(htmlWrite);

                    minutacompleta += sbltvUsuariosMinuta.ToString();
                    templeteaux     = templeteaux.Replace("#Acuerdos#", sbltvUsuariosMinuta.ToString());

                    generales gral = new generales();
                    if (gral.IsValidEmail(item.ObjUsuarios.User.Username))
                    {
                        objemail.Body    = templeteaux;
                        objemail.MailTo  = item.ObjUsuarios.User.Username;
                        objemail.MailCC  = string.Empty;
                        objemail.MailBcc = string.Empty;
                        generales.enviarMail(objemail);
                    }
                    stringWrite.Dispose();
                    htmlWrite.Dispose();

                    sw1.Dispose();
                    htw1.Dispose();
                }

                ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "$('.modalfinsesion').modal('show')", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "bootbox.alert('<div class=\" alert alert-warning\">No existe participantes para ésta sesión. Para enviar la notificación es necesario incluir a los participantes.</div>')", true);
            }
        }
        catch (Exception ex)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "bootbox.alert('<div class=\"alert alert-danger\">Se produjo un error al enviar el mail! " + ex.Message.Replace("'", "") + "</div>');", true);
        }
    }