// -----------------------------------------------------------------------------------------------------------

        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            int idInvestigador = SubSonic.Sugar.Web.QueryString <int>("idInvestigador");

            RisInvestigadore oInvestigador = new RisInvestigadore(int.Parse(Request["idInvestigador"].ToString()));

            oInvestigador.Apellido = txtApellidoInvestigador.Text.Trim();
            oInvestigador.Nombre   = txtNombreInvestigador.Text.Trim();

            oInvestigador.IdProfesion = int.Parse(ddlProfesionInvestigador.SelectedValue.ToString());

            oInvestigador.NumeroMatricula = txtNumeroMatricula.Text.Trim();

            oInvestigador.IdEntidad = int.Parse(ddlEntidad.SelectedValue.ToString());

            oInvestigador.Save();

            // -----------------------------------------------------
            // Cargo los datos en la tabla "RIS_EstudioInvestigador"
            // -----------------------------------------------------

            DataTable dtEstudioInvestigador = new DataTable();

            dtEstudioInvestigador = SPs.RisVerificarSiExisteEstudioInvestigador(int.Parse(Request["idEstudio"].ToString()),
                                                                                int.Parse(Request["idInvestigador"].ToString())).GetDataSet().Tables[0];

            if (dtEstudioInvestigador.Rows.Count == 0) // No existe !
            {
                RisEstudioInvestigador oEstudioInvestigador = new RisEstudioInvestigador();
                oEstudioInvestigador.IdEstudio           = int.Parse(Request["idEstudio"].ToString().Trim());
                oEstudioInvestigador.IdInvestigador      = oInvestigador.IdInvestigador;
                oEstudioInvestigador.IdFuncionEnElEquipo = int.Parse(ddlFuncionEnElEquipo.SelectedValue.ToString());

                oEstudioInvestigador.Save();
            }
            else
            {
                // ,nota: Forma de ejecutar un sp que no devuelve valores, solo modifica registros en la base
                SPs.RisModificarFuncionEnElEquipo(int.Parse(Request["idEstudio"].ToString().Trim()),
                                                  int.Parse(Request["idInvestigador"].ToString()),
                                                  int.Parse(ddlFuncionEnElEquipo.SelectedValue)).Execute();
            }

            RisEstudio oEstudio = new RisEstudio(int.Parse(Request["idEstudio"].ToString()));
            string     url      = "EstudioEdit.aspx?idEstudio=" + Request["idEstudio"].ToString().Trim() + "&TipoDeEstudio=" + oEstudio.TipoEstudio.ToString().Trim() + "#marcaInvestigadoresMiembros";

            Response.Redirect(url, false);
        }
        // -----------------------------------------------------------------------------------------------------------

        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            int idInvestigador = SubSonic.Sugar.Web.QueryString <int>("idInvestigador");

            RisInvestigadore oInvestigador = new RisInvestigadore(int.Parse(Request["idInvestigador"].ToString()));

            oInvestigador.Apellido = txtApellidoInvestigador.Text.Trim();
            oInvestigador.Nombre   = txtNombreInvestigador.Text.Trim();
            oInvestigador.Sexo     = ddlSexoInvestigador.SelectedValue;

            if (inputFechaNacimiento.Value.ToString() != "")
            {
                oInvestigador.FechaNacimiento = DateTime.Parse(inputFechaNacimiento.Value.ToString());
            }

            oInvestigador.IdTipoDocumento = int.Parse(ddlTipoDocumentoInvestigador.SelectedValue.ToString());

            string cadena = txtNumeroDocumento.Text.Trim();

            if (verificarExpresionRegular("Numerica", cadena) && (cadena.Length <= 8))
            {
                oInvestigador.NumeroDocumento = txtNumeroDocumento.Text.Trim();
                hayError = "NO";
            }
            else
            {
                hayError = "SI";
                Response.Write("<script language=javascript>alert('El campo Documento solo permite números (máximo 8 caracteres, sin puntos)');</script>");
            }

            oInvestigador.IdProfesion = int.Parse(ddlProfesionInvestigador.SelectedValue.ToString());

            oInvestigador.NumeroMatricula = txtNumeroMatricula.Text.Trim();

            oInvestigador.DomicilioLaboral   = txtDomicilioLaboral.Text.Trim();
            oInvestigador.CpDomicilioLaboral = txtCPDomicilioLaboral.Text.Trim();

            oInvestigador.DomicilioParticular   = txtDomicilioParticular.Text.Trim();
            oInvestigador.CpDomicilioParticular = txtCPDomicilioParticular.Text.Trim();

            oInvestigador.IdTipoTelLaboral = int.Parse(ddlTipoTelefonoLaboralInvestigador.SelectedValue.ToString());
            oInvestigador.TelefonoLaboral  = txtNumeroTelefonoInvestigadorLaboral.Text.Trim();

            oInvestigador.IdTipoTelParticular = int.Parse(ddlTipoTelefonoParticularInvestigador.SelectedValue.ToString());
            oInvestigador.TelefonoParticular  = txtNumeroTelefonoInvestigadorParticular.Text.Trim();

            oInvestigador.EmailLaboral    = txtMailInvestigadorLaboral.Text.Trim();
            oInvestigador.EmailParticular = txtMailInvestigadorParticular.Text.Trim();

            oInvestigador.IdEntidad = int.Parse(ddlEntidad.SelectedValue.ToString());

            if (hayError == "NO")
            {
                oInvestigador.Save();

                // -----------------------------------------------------
                // Cargo los datos en la tabla "RIS_EstudioInvestigador"
                // -----------------------------------------------------

                if (Request["numeroDocumentoInvestigador"].ToString() != "0")
                {
                    DataTable dtInvestigador = new DataTable();
                    dtInvestigador = SPs.RisVerificarSiExisteInvestigador(int.Parse(Request["numeroDocumentoInvestigador"].ToString().Trim())).GetDataSet().Tables[0];

                    // Cargo los datos en la tabla "RIS_EstudioInvestigador"
                    RisEstudioInvestigador oEstudioInvestigador = new RisEstudioInvestigador();
                    oEstudioInvestigador.IdEstudio = int.Parse(Request["idEstudio"].ToString().Trim());

                    if (dtInvestigador.Rows.Count != 0)
                    {
                        oEstudioInvestigador.IdInvestigador = int.Parse(dtInvestigador.Rows[0][0].ToString().Trim());
                    }
                    else
                    {
                        oEstudioInvestigador.IdInvestigador = oInvestigador.IdInvestigador;
                    }

                    oEstudioInvestigador.Save();
                }

                // ,nota: Forma de ejecutar un sp que no devuelve valores, solo modifica registros en la base
                SPs.RisModificarFuncionEnElEquipo(int.Parse(Request["idEstudio"].ToString().Trim()),
                                                  oInvestigador.IdInvestigador,
                                                  int.Parse(ddlFuncionEnElEquipo.SelectedValue)).Execute();

                RisEstudio oEstudio = new RisEstudio(int.Parse(Request["idEstudio"].ToString()));
                string     url      = "EstudioEdit.aspx?idEstudio=" + Request["idEstudio"].ToString().Trim() + "&TipoDeEstudio=" + oEstudio.TipoEstudio.ToString().Trim() + "#marcaInvestigadoresMiembros";
                Response.Redirect(url, false);
            }
        }