예제 #1
0
 public int uspINS_RRHH_FORMATIVO_FICHA(BE_RRHH_FORMATIVO_FICHA obj)
 {
     object[] Parametros = new[] {
         (object)UC_FormWeb.mSQLFieldOrNull(obj.IDE_FICHA, tgSQLFieldType.NUMERIC),
         (object)UC_FormWeb.mSQLFieldOrNull(obj.APELLIDOS, tgSQLFieldType.TEXT),
         (object)UC_FormWeb.mSQLFieldOrNull(obj.NOMBRES, tgSQLFieldType.TEXT),
         (object)UC_FormWeb.mSQLFieldOrNull(obj.DNI, tgSQLFieldType.TEXT),
         (object)UC_FormWeb.mSQLFieldOrNull(obj.FECHA_NACIMIENTO, tgSQLFieldType.TEXT),
         (object)UC_FormWeb.mSQLFieldOrNull(obj.IDE_PROGRAMA, tgSQLFieldType.NUMERIC),
         (object)UC_FormWeb.mSQLFieldOrNull(obj.IDE_CARRERA, tgSQLFieldType.NUMERIC),
         (object)UC_FormWeb.mSQLFieldOrNull(obj.IDE_UNIVERSIDAD, tgSQLFieldType.NUMERIC),
         (object)UC_FormWeb.mSQLFieldOrNull(obj.IDE_NIVEL, tgSQLFieldType.NUMERIC),
         (object)UC_FormWeb.mSQLFieldOrNull(obj.NUM_COLEGIATURA, tgSQLFieldType.TEXT),
         (object)UC_FormWeb.mSQLFieldOrNull(obj.RESIDENCIA, tgSQLFieldType.TEXT),
         (object)UC_FormWeb.mSQLFieldOrNull(obj.ESTADO_CIVIL, tgSQLFieldType.NUMERIC),
         (object)UC_FormWeb.mSQLFieldOrNull(obj.TUTOR, tgSQLFieldType.TEXT),
         (object)UC_FormWeb.mSQLFieldOrNull(obj.TUTOR_CORREO, tgSQLFieldType.TEXT),
         (object)UC_FormWeb.mSQLFieldOrNull(obj.CARGO_TUTOR, tgSQLFieldType.TEXT),
         (object)UC_FormWeb.mSQLFieldOrNull(obj.INT_SEGMENTACION, tgSQLFieldType.TEXT),
         (object)UC_FormWeb.mSQLFieldOrNull(obj.FIN_CONTRATO, tgSQLFieldType.TEXT),
         (object)UC_FormWeb.mSQLFieldOrNull(obj.FORTALEZA, tgSQLFieldType.TEXT),
         (object)UC_FormWeb.mSQLFieldOrNull(obj.OPORTUNIDAD, tgSQLFieldType.TEXT),
         (object)UC_FormWeb.mSQLFieldOrNull(obj.USER_REGISTRO, tgSQLFieldType.TEXT),
         (object)UC_FormWeb.mSQLFieldOrNull(obj.FOTO_RUTA, tgSQLFieldType.TEXT),
         (object)UC_FormWeb.mSQLFieldOrNull(obj.FOTO, tgSQLFieldType.TEXT),
         (object)UC_FormWeb.mSQLFieldOrNull(obj.CORREO, tgSQLFieldType.TEXT),
         (object)UC_FormWeb.mSQLFieldOrNull(obj.TELEFONO, tgSQLFieldType.TEXT),
     };
     return(Convert.ToInt32(new Utilitarios().ExecuteScalar("uspINS_RRHH_FORMATIVO_FICHA", Parametros)));
 }
 public int uspINS_RRHH_FORMATIVO_FICHA(BE_RRHH_FORMATIVO_FICHA obj)
 {
     try
     {
         return(new DA_RRHH_FORMATIVO_FICHA().uspINS_RRHH_FORMATIVO_FICHA(obj));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
    protected void capturarDatos()
    {
        string cleanMessage = string.Empty;

        if (txtApellidos.Text == string.Empty)
        {
            cleanMessage = "Ingresar apellidos";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
        else if (txtNombres.Text == string.Empty)
        {
            cleanMessage = "Ingresar nombres";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
        else if (txtDni.Text == string.Empty)
        {
            cleanMessage = "Ingresar número de DNI";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
        else if (txtFecNacimiento.Text == string.Empty)
        {
            cleanMessage = "Ingresar fecha de nacimiento";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
        else if (ddlPrograma.SelectedIndex < 1)
        {
            cleanMessage = "Seleccionar programa";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
        else if (ddlcarrera.SelectedIndex < 1)
        {
            cleanMessage = "Seleccionar carrera";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
        else if (ddluniversidad.SelectedIndex < 1)
        {
            cleanMessage = "Seleccionar universidad";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
        else if (ddlNivel.SelectedIndex < 1)
        {
            cleanMessage = "Seleccionar segmentación";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
        //else if (txtcolegiatura.Text == string.Empty)
        //{
        //    cleanMessage = "Ingresar número de colegiatura";
        //    ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        //}
        else if (txtdireccion.Text == string.Empty)
        {
            cleanMessage = "Ingresar dirección";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
        else if (ddlcivil.SelectedIndex < 1)
        {
            cleanMessage = "Seleccionar estado civil";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
        else if (txtTutor.Text == string.Empty)
        {
            cleanMessage = "Ingresar tutor";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
        else if (txtTutorCorreo.Text == string.Empty)
        {
            cleanMessage = "Ingresar correo tutor";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }

        else if (txtCargo.Text == string.Empty)
        {
            cleanMessage = "Ingresar cargo";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
        else if (ddlsegmentacion.SelectedIndex < 1)
        {
            cleanMessage = "Seleccionar segmentación";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
        else if (txtFin.Text == string.Empty)
        {
            cleanMessage = "Ingresar fecha fin de contrato";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
        else if (txtFortalezas.Text == string.Empty)
        {
            cleanMessage = "Ingresar fortalezas";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
        else if (txtoportunidades.Text == string.Empty)
        {
            cleanMessage = "Ingresar oportunidades de mejora";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
        else if (txtCorreo.Text == string.Empty)
        {
            cleanMessage = "Ingresar correo institucional";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
        else
        {
            Boolean correo = email_bien_escrito(txtCorreo.Text);

            if (correo == true)
            {
                BE_RRHH_FORMATIVO_FICHA obj = new BE_RRHH_FORMATIVO_FICHA();
                obj.IDE_FICHA        = Convert.ToInt32(string.IsNullOrEmpty(lblCodigoFicha.Text) ? "0" : lblCodigoFicha.Text);
                obj.APELLIDOS        = txtApellidos.Text;
                obj.NOMBRES          = txtNombres.Text;
                obj.DNI              = txtDni.Text;
                obj.FECHA_NACIMIENTO = txtFecNacimiento.Text;
                obj.IDE_PROGRAMA     = Convert.ToInt32(ddlPrograma.SelectedValue);
                obj.IDE_CARRERA      = Convert.ToInt32(ddlcarrera.SelectedValue);
                obj.IDE_UNIVERSIDAD  = Convert.ToInt32(ddluniversidad.SelectedValue);
                obj.IDE_NIVEL        = Convert.ToInt32(ddlNivel.SelectedValue);
                obj.NUM_COLEGIATURA  = txtcolegiatura.Text;
                obj.RESIDENCIA       = txtdireccion.Text.Trim();
                obj.ESTADO_CIVIL     = Convert.ToInt32(ddlcivil.SelectedValue);
                obj.TUTOR            = txtTutor.Text;
                obj.TUTOR_CORREO     = txtTutorCorreo.Text.Trim();
                obj.CARGO_TUTOR      = txtCargo.Text;
                obj.INT_SEGMENTACION = Convert.ToInt32(ddlsegmentacion.SelectedValue);
                obj.FIN_CONTRATO     = txtFin.Text;
                obj.FORTALEZA        = txtFortalezas.Text.Trim();
                obj.OPORTUNIDAD      = txtoportunidades.Text.Trim();
                obj.USER_REGISTRO    = Session["IDE_USUARIO"].ToString();
                obj.CORREO           = txtCorreo.Text.Trim();
                obj.TELEFONO         = txtfono.Text.Trim();

                Boolean fileOK = false;
                String  path   = Server.MapPath(FolderTrainee);
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }

                if (FileUpload1.HasFile)
                {
                    String fileExtension = Path.GetExtension(FileUpload1.PostedFile.FileName);

                    String[] allowedExtensions = { ".gif", ".png", ".jpeg", ".jpg" };
                    for (int i = 0; i < allowedExtensions.Length; i++)
                    {
                        if (fileExtension == allowedExtensions[i])
                        {
                            fileOK = true;
                        }
                    }
                }

                if (fileOK)
                {
                    try
                    {
                        string archivo = txtDni.Text.Trim() + Path.GetExtension(FileUpload1.PostedFile.FileName);
                        FileUpload1.PostedFile.SaveAs(path + archivo);
                        obj.FOTO_RUTA = path + archivo;
                        obj.FOTO      = archivo;
                    }
                    catch (Exception ex)
                    {
                        string mensajeUpl = "File could not be uploaded.";
                    }
                }
                else
                {
                    obj.FOTO_RUTA = string.Empty;
                    obj.FOTO      = string.Empty;
                }


                int rpta = 0;
                rpta = new BL_RRHH_FORMATIVO_FICHA().uspINS_RRHH_FORMATIVO_FICHA(obj);
                if (rpta > 0)
                {
                    lblCodigoFicha.Text = rpta.ToString();
                    datosFicha(Convert.ToInt32(lblCodigoFicha.Text));
                    cleanMessage = "registro satisfactorio";
                    ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
                }
            }
            else
            {
                cleanMessage = "Correo no permitido, verificar";
                ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
            }
        }
    }