public bool InsertarRegistroTemporal(ENT_RegistroTemporal oEnt_Atr, ref string Serial, ref int ExisteDominio)
 {
     return dataTx.InsertarRegistroTemporal(oEnt_Atr, ref Serial, ref ExisteDominio);
 }
Exemple #2
0
        protected void btnRegistrar_Click(object sender, EventArgs e)
        {
            if (txtRazonSocial.Text.Length == 0
                || txtCorreo.Text.Length == 0
                || txtDominioCorreo.Text.Length == 0)
            {
                string msj = msj_incompletdata;
                ScriptManager.RegisterStartupScript(this, typeof(Page), "MostrarMensaje", "alert('" + msj + "');", true);
                chkDominio.Checked = false;
                    return;
            }

            ENT_RegistroTemporal oENT_RegTemp = new ENT_RegistroTemporal();
            LN_RegistroTemporal oLN_RegTemp = new LN_RegistroTemporal();
            bool result = false;
            bool Enviado = false;
            string Serial = string.Empty;
            int ExisteDominio = -1;
            int existeCorreo = -1;
            oENT_RegTemp.RazonSocial = txtRazonSocial.Text.Trim();
            oENT_RegTemp.Dominio = txtDominio.Text.Trim();
            oENT_RegTemp.Correo = txtCorreo.Text.Trim()+"@"+txtDominioCorreo.Text.Trim();

            oLN_RegTemp.VerificarCorreo(oENT_RegTemp.Correo, ref existeCorreo);
            if(existeCorreo != 0)
            {
                string msj = msj_emailregister;
                ScriptManager.RegisterStartupScript(this, typeof(Page), "MostrarMensaje", "alert('" + msj + "');", true);

                return;
            }

            result = oLN_RegTemp.InsertarRegistroTemporal(oENT_RegTemp, ref Serial, ref ExisteDominio);

            if (ExisteDominio != 0)
            {
                string msj = msj_domainregister;
                ScriptManager.RegisterStartupScript(this, typeof(Page), "MostrarMensaje", "alert('" + msj + "');", true);

                return;
            }

            if (result)
            {

                try
                {
                    Correo Cr = new Correo();
                    MailMessage mnsj = new MailMessage();

                    mnsj.Subject = msj_confregister;

                    mnsj.To.Add(new MailAddress(oENT_RegTemp.Correo));

                    //mnsj.From = new MailAddress("*****@*****.**", "Estimado Usuario");
                    //mnsj.From = new MailAddress("*****@*****.**", "Binvenid@"+ "\n\nGracias por elegirnos");
                    mnsj.From = new MailAddress("*****@*****.**", "Sistema LAPA");

                    /* Si deseamos Adjuntar algún archivo*/
                    //mnsj.Attachments.Add(new Attachment("C:\\archivo.pdf"));

                    if (lang.Contains("es"))
                    {
                        mnsj.Body = "<html><head></head><body><div style='width:400px;background:; padding:20px 40px; margin:50px auto; background:#eee;border-radius:4px'><div style='font-size:large;font-weight:bolder'>Estimado Usuario</div>" +
                                    "<br>Gracias por elegir el sistema Lapa de Wasitec SAC. <br>" +
                                    "Para terminar el registro por favor ingrese el código mostrado en el enlace siguiente:<br><br>" +
                                    "Código de registro: " + Serial +
                                    "<br>Enlace de registro: https://lapa-tec.com/iRegistro/Confirmacion.aspx" +
                                    "<br><br>Si tuviera algún inconveniente para ingresar al servicio, por favor enviar un correo a:" + "<br>[email protected]" +
                                    "<br><br>Saludos Cordiales" + "<br>TEAM LAPA" +
                                    " </div><br></div>	</body></html>";
                    }
                    if (lang.Contains("en"))
                    {
                        mnsj.Body = "<html><head></head><body><div style='width:400px;background:; padding:20px 40px; margin:50px auto; background:#eee;border-radius:4px'><div style='font-size:large;font-weight:bolder'>Dear User</div>" +
                                    "<br>Thank you for choosing Wasitec Lapa SAC system. <br>" +
                                    "To complete the registration please enter the code shown in the following link: <br><br>" +
                                    "Registration code: " + Serial +
                                    "<br>Registration link : https://lapa-tec.com/iRegistro/Confirmacion.aspx" +
                                    "<br><br>If I had any objection to enter service, please send an email to :" + "<br>[email protected]" +
                                    "<br><br>Best Regards" + "<br>TEAM LAPA" +
                                    " </div><br></div>	</body></html>";
                    }

                    mnsj.IsBodyHtml = true;
                    /* Enviar */
                    Cr.MandarCorreo(mnsj);
                    Enviado = true;

                    string msj = msj_sendcode_1 + oENT_RegTemp.Correo + msj_sendcode_2;
                    ScriptManager.RegisterStartupScript(this, typeof(Page), "MostrarMensaje", "alert('" + msj + "');", true);
                    // MessageBox.Show("El Mail se ha Enviado Correctamente", "Listo!!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

                    txtRazonSocial.Text = "";
                    txtDominioCorreo.Text = "";
                    txtDominio.Text = "";
                    txtCorreo.Text = "";
                }
                catch (Exception ex)
                {
                    string msj = msj_error + ex.Message.ToString();
                    ScriptManager.RegisterStartupScript(this, typeof(Page), "MostrarMensaje", "alert('" + msj + "');", true);
                }

            }
            else
            {
                //MENSAJE
                return;
            }
        }