-
Notifications
You must be signed in to change notification settings - Fork 0
/
consultivo.aspx.cs
142 lines (121 loc) · 6.04 KB
/
consultivo.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class consultivo : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnContinuar_Click(object sender, EventArgs e)
{
Session["mensajeConfirmacion"] =
"-----------------------------------------------------------------------------" + '\n' +
'\n' +
"Nombre(s) ...........: " + txtNombres.Text + '\n' +
"Apellido(s) .........: " + txtApellidos.Text + '\n' +
"Correo electrónico ..: " + txtCorreo.Text + '\n' +
"Telefono ............: " + txtTelefono.Text + '\n' +
"Institucion .........: " + txtInstitucion.Text + '\n' +
'\n' +
'\n' +
"- INFORMACION ADICIONAL" + '\n' +
"-----------------------------------------------------------------------------" + '\n' +
"++ Itinerario de vuelo (llegada) ++" + '\n' +
"---> Aerolinea: " + txtLlegadaLinea.Text + ", No. de vuelo: " + txtLlegadaVuelo.Text + '\n' +
"---> Fecha: " + txtLlegadaFecha.Text + ", Hora: " + txtLlegadaHora.Text + '\n' +
'\n' +
"++ Itinerario de vuelo (salida) ++" + '\n' +
"---> Aerolinea: " + txtSalidaLinea.Text + ", No. de vuelo: " + txtSalidaVuelo.Text + '\n' +
"---> Fecha: " + txtSalidaFecha.Text + ", Hora: " + txtSalidaHora.Text + '\n' +
'\n' +
"Hotel donde se hospeda: " + txtHotel.Text + '\n' +
"Actividad extramuros..: " + ddlExtramuros.SelectedValue + '\n' +
"Comentario adicional..: " + txtComentarios.Text + '\n' +
'\n' +
'\n';
//metemos el mensaje en una label y confirmamos el mensaje
lblConfirmacion.Text = Convert.ToString(Session["mensajeConfirmacion"]).Replace("'", "´");
lblConfirmacion.Text = Convert.ToString(Session["mensajeConfirmacion"]).Replace("\n", "<br />");
pnlDatos.Visible = false;
pnlConfirmacion.Visible = true;
}
protected void btnRegresar_Click(object sender, EventArgs e)
{
pnlDatos.Visible = true;
pnlConfirmacion.Visible = false;
}
protected void btnEnviar_Click(object sender, EventArgs e)
{
//Crear el comando para el UPDATE
SqlDSconsultivo.InsertParameters.Add("@nombres", txtNombres.Text);
SqlDSconsultivo.InsertParameters.Add("@apellidos", txtApellidos.Text);
SqlDSconsultivo.InsertParameters.Add("@correo", txtCorreo.Text);
SqlDSconsultivo.InsertParameters.Add("@telefono", txtTelefono.Text);
SqlDSconsultivo.InsertParameters.Add("@institucion", txtInstitucion.Text);
SqlDSconsultivo.InsertParameters.Add("@llegalinea", txtLlegadaLinea.Text);
SqlDSconsultivo.InsertParameters.Add("@llegavuelo", txtLlegadaVuelo.Text);
SqlDSconsultivo.InsertParameters.Add("@llegafecha", txtLlegadaFecha.Text);
SqlDSconsultivo.InsertParameters.Add("@llegahora", txtLlegadaHora.Text);
SqlDSconsultivo.InsertParameters.Add("@salelinea", txtSalidaLinea.Text);
SqlDSconsultivo.InsertParameters.Add("@salevuelo", txtSalidaVuelo.Text);
SqlDSconsultivo.InsertParameters.Add("@salefecha", txtSalidaFecha.Text);
SqlDSconsultivo.InsertParameters.Add("@salehora", txtSalidaHora.Text);
SqlDSconsultivo.InsertParameters.Add("@hotel", txtHotel.Text);
SqlDSconsultivo.InsertParameters.Add("@extramuros", ddlExtramuros.SelectedValue);
SqlDSconsultivo.InsertParameters.Add("@comentarios", txtComentarios.Text);
//Aqui hay que cambiar el nombre de la tabla
SqlDSconsultivo.InsertCommand = "INSERT INTO Consultivo VALUES ('" + txtNombres.Text +
"', '" + txtApellidos.Text +
"', '" + txtCorreo.Text +
"', '" + txtTelefono.Text +
"', '" + txtInstitucion.Text +
"', '" + txtLlegadaLinea.Text +
"', '" + txtLlegadaVuelo.Text +
"', '" + txtLlegadaFecha.Text +
"', '" + txtLlegadaHora.Text +
"', '" + txtSalidaLinea.Text +
"', '" + txtSalidaVuelo.Text +
"', '" + txtSalidaFecha.Text +
"', '" + txtSalidaHora.Text +
"', '" + txtHotel.Text +
"', '" + ddlExtramuros.SelectedValue +
"', '" + txtComentarios.Text +
"')";
SqlDSconsultivo.Insert();
//ARMAR CUERPO DEL MENSAJE
string mensaje = "Estimado(a) " + txtNombres.Text + ", usted ha sido registrado(a)." + '\n' +
'\n' +
Session["mensajeConfirmacion"] +
"Gracias," + '\n' + "Comite Organizador" + '\n' + "CIBNOR, S.C.";
// FALTA AGREGAR COPIA OCULTA
//Mandamos el correo(de, para, copia oculta, asunto, mensaje)
enviarCorreo("consultivo2013@cibnor.mx", txtCorreo.Text, "consultivo2013@cibnor.mx", "CIBNOR, Registro en Linea - Consejo Consultivo", mensaje);
Response.Redirect("~/RegistroOk.aspx?evento=consultivo2013");
}
protected void enviarCorreo(string origen, string destino, string copiaoculta, string asunto, string mensaje)
{
System.Net.Mail.MailMessage correo = new System.Net.Mail.MailMessage();
correo.From = new System.Net.Mail.MailAddress(origen);
correo.To.Add(destino);
if (copiaoculta != "-")
{ correo.Bcc.Add(copiaoculta); }
correo.Subject = asunto;
correo.Body = mensaje;
correo.IsBodyHtml = false;
correo.Priority = System.Net.Mail.MailPriority.Normal;
correo.BodyEncoding = System.Text.Encoding.UTF8;
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient();
smtp.Host = "smtp.cibnor.mx";
try
{
smtp.Send(correo);
}
catch (Exception ex)
{
Session["mensaje"] = "El mensaje no ha podido ser entregado, intentelo de nuevo mas tarde. " + ex.Message;
}
}
}