protected void btnGuardar_Click(object sender, EventArgs e) { try { int vooleano; if (db.validaNumeroSinEspacio(txtnombre.Text)) { //txtDescripcion if (db.NumeroLetraConEspacio(txtDescripcion.Text)) { match = Regex.Match(txtFechaInicio.Text, @"^(0[1-9]|[12][0-9]|3[01])[/](0[1-9]|1[012])[/](19|20)\d\d$"); if (match.Success) { match = Regex.Match(txtFechaFin.Text, @"^(0[1-9]|[12][0-9]|3[01])[/](0[1-9]|1[012])[/](19|20)\d\d$"); if (match.Success) { if (Convert.ToDateTime(txtFechaInicio.Text) <= Convert.ToDateTime(txtFechaFin.Text)) { if (chkactivo.Checked) { vooleano = 1; } else { vooleano = 0; } //txtDescripcion.Text = Regex.Replace(txtDescripcion.Text, @"[^\w\s\.@-]", ""); //txtFechaInicio.Text = Regex.Replace(txtFechaInicio.Text, @"[^\/\d]", ""); //txtFechaFin.Text = Regex.Replace(txtFechaFin.Text, @"[^\/\d]", ""); query = "exec sp_crear_periodo_academico '" + txtnombre.Text + "','" + db.convertirFecha(txtFechaInicio.Text) + "','" + db.convertirFecha(txtFechaFin.Text) + "','" + Session["usuario"].ToString() + "','" + txtDescripcion.Text + "'," + vooleano + ""; dt = db.getQuery(conexionBecarios, query); if (dt.Rows.Count > 0) { if (dt.Rows[0]["Mensaje"].ToString() == "Ok") { verModal("Éxito", "Se creó correctamente el periodo"); pnlGridview.Visible = true; llenarGrid(); } else { verModal("Error", dt.Rows[0]["Mensaje"].ToString()); } } } else { verModal("Error", "La fecha incio es mayor que la fecha fin"); } } else { verModal("Error", "La fecha fin no tiene el formato dd/mm/aaaa"); } } else { verModal("Error", "Fecha inicio no tiene el formato dd/mm/aaaa"); } } else { verModal("Error", "El campo descrición no tiene el formato correcto"); } } else { verModal("Error", "El campo código no tiene el formato correcto"); } }catch (Exception es) { verModal("Error", es.Message.ToString()); } }