-
Notifications
You must be signed in to change notification settings - Fork 0
/
congreso-cpi2013.aspx.cs
178 lines (150 loc) · 7.22 KB
/
congreso-cpi2013.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class congreso_cpi2013 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnContinuar_Click(object sender, EventArgs e)
{
Session["mensajeConfirmacion"] =
"-----------------------------------------------------------------------------" + '\n' +
'\n' +
lblNombres.Text + " " + txtNombres.Text + '\n' +
lblApellidos.Text + " " + txtApellidos.Text + '\n' +
lblCorreo.Text + " " + txtCorreo.Text + '\n' +
lblTelefono.Text + " " + txtTelefono.Text + '\n' +
lblInstitucion.Text + " " + txtInstitucion.Text + '\n' +
'\n' +
'\n' +
"- " + lblInformacionAdicional.Text + '\n' +
"-----------------------------------------------------------------------------" + '\n' +
'\n' +
"++ Itinerario de vuelo de salida ++" + '\n' +
lblSalidaCiudad1.Text + txtSalidaCiudad1.Text + ", " + lblSalidaAerolinea1.Text + txtSalidaAerolinea1.Text + ", " +
lblSalidaNoVuelo1.Text + txtSalidaNoVuelo1.Text + ", " + lblSalidaFecha1.Text + txtSalidaFecha1.Text + ", " +
lblSalidaHora1.Text + txtSalidaHora1.Text + '\n' +
lblSalidaCiudad2.Text + txtSalidaCiudad2.Text + ", " + lblSalidaAerolinea2.Text + txtSalidaAerolinea2.Text + ", " +
lblSalidaNoVuelo2.Text + txtSalidaNoVuelo2.Text + ", " + lblSalidaFecha2.Text + txtSalidaFecha2.Text + ", " +
lblSalidaHora2.Text + txtSalidaHora2.Text + '\n' +
'\n' +
"++ Itinerario de vuelo de regreso ++" + '\n' +
lblRegresoCiudad1.Text + txtRegresoCiudad1.Text + ", " + lblRegresoAerolinea1.Text + txtRegresoAerolinea1.Text + ", " +
lblRegresoNoVuelo1.Text + txtRegresoNoVuelo1.Text + ", " + lblRegresoFecha1.Text + txtRegresoFecha1.Text + ", " +
lblRegresoHora1.Text + txtRegresoHora1.Text + '\n' +
lblRegresoCiudad2.Text + txtRegresoCiudad2.Text + ", " + lblRegresoAerolinea2.Text + txtRegresoAerolinea2.Text + ", " +
lblRegresoNoVuelo2.Text + txtRegresoNoVuelo2.Text + ", " + lblRegresoFecha2.Text + txtRegresoFecha2.Text + ", " +
lblRegresoHora2.Text + txtRegresoHora2.Text + '\n' +
'\n' +
'\n' +
"Hotel donde se hospeda: " + txtHotel.Text + '\n' +
'\n' +
lblCoctel.Text + " " + rblCoctel.SelectedValue + '\n' +
lblCena.Text + " " + rblCena.SelectedValue + '\n' +
lblFamilia.Text + " " + rblFamilia.SelectedValue + '\n' +
lblFamiliaCantidad.Text + " " + txtFamiliaCantidad.Text + '\n' +
lblFamiliaEdades.Text + " " + txtFamiliaEdades.Text + '\n' +
'\n' +
lblComentarios.Text + " " + txtComentarios.Text;
//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 />");
Session["mensajeConfirmacion"] = lblConfirmacion.Text;
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)
{
SqlDScongresocpi2013.InsertCommand = "INSERT INTO CongresoCPI2013 VALUES ('" + txtNombres.Text +
"', '" + txtApellidos.Text +
"', '" + txtCorreo.Text +
"', '" + txtTelefono.Text +
"', '" + txtInstitucion.Text +
"', '" + txtSalidaCiudad1.Text +
"', '" + txtSalidaAerolinea1.Text +
"', '" + txtSalidaNoVuelo1.Text +
"', '" + txtSalidaFecha1.Text +
"', '" + txtSalidaHora1.Text +
"', '" + txtSalidaCiudad2.Text +
"', '" + txtSalidaAerolinea2.Text +
"', '" + txtSalidaNoVuelo2.Text +
"', '" + txtSalidaFecha2.Text +
"', '" + txtSalidaHora2.Text +
"', '" + txtRegresoCiudad1.Text +
"', '" + txtRegresoAerolinea1.Text +
"', '" + txtRegresoNoVuelo1.Text +
"', '" + txtRegresoFecha1.Text +
"', '" + txtRegresoHora1.Text +
"', '" + txtRegresoCiudad2.Text +
"', '" + txtRegresoAerolinea2.Text +
"', '" + txtRegresoNoVuelo2.Text +
"', '" + txtRegresoFecha2.Text +
"', '" + txtRegresoHora2.Text +
"', '" + txtHotel.Text +
"', '" + rblCoctel.SelectedValue +
"', '" + rblCena.SelectedValue +
"', '" + rblFamilia.SelectedValue +
"', '" + txtFamiliaCantidad.Text +
"', '" + txtFamiliaEdades.Text +
"', '" + txtComentarios.Text +
"')";
SqlDScongresocpi2013.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.";
mensaje = mensaje.Replace("\n", "<br />");
//Mandamos el correo(de, para, copia oculta, asunto, mensaje)
enviarCorreo("congreso-cpi2013@cibnor.mx", txtCorreo.Text, "congreso-cpi2013@cibnor.mx", "Registro en Linea - Congreso CPIs 2013", mensaje);
Response.Redirect("~/RegistroOk.aspx?evento=congreso-cpi2013");
}
protected void rblFamilia_SelectedIndexChanged(object sender, EventArgs e)
{
if (rblFamilia.SelectedValue != "No")
{
pnlFamilia.Visible = true;
txtFamiliaCantidad.Text = "";
txtFamiliaEdades.Text = "";
}
else
{
pnlFamilia.Visible = false;
txtFamiliaCantidad.Text = "--";
txtFamiliaEdades.Text = "--";
}
}
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 = true;
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)
{
lblStatus.Text = "El registro no ha podido ser entregado, intentelo de nuevo mas tarde.";
enviarCorreo(origen, "jcollins@cibnor.mx", "-", origen + ex.Message, Convert.ToString(Session["mensajeConfirmacion"]));
}
}
}