Beispiel #1
0
    protected void btnEnvia_Click(object sender, EventArgs e)
    {
        string cleanMessage = string.Empty;

        if (txtRespuesta.Text.Trim() == string.Empty)
        {
            cleanMessage = "Ingresar comentarios";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
        else
        {
            BE_RRHH_DESEMPENIO_OBJETIVOS_MSG oBESol = new BE_RRHH_DESEMPENIO_OBJETIVOS_MSG();
            oBESol.IDE_MSG      = 0;// Convert.ToInt32(string.IsNullOrEmpty(lblCodigo.Text) ? "0" : lblCodigo.Text);
            oBESol.DNI_USER     = Session["IDE_USUARIO"].ToString();
            oBESol.IDE_OBJETIVO = Convert.ToInt32(lblCodigo.Text);
            oBESol.TIPO         = "RESPUESTA";
            oBESol.ANIO         = Convert.ToInt32(Session["ANIO"]);
            oBESol.ASUNTO       = String.Empty;
            oBESol.COMENTARIO   = txtRespuesta.Text.Trim();
            int dtrpta = 0;
            dtrpta = new BL_RRHH_DESEMPENIO_OBJETIVOS_MSG().uspINS_RRHH_DESEMPENIO_OBJETIVOS_MSG(oBESol);
            if (dtrpta > 0)
            {
                lblCodigo.Text    = string.Empty;
                txtRespuesta.Text = String.Empty;
                cleanMessage      = "Envio satisfactorio";
                ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
            }
        }
    }
Beispiel #2
0
 public int uspINS_RRHH_DESEMPENIO_OBJETIVOS_MSG(BE_RRHH_DESEMPENIO_OBJETIVOS_MSG oBE)
 {
     try
     {
         return(new DA_RRHH_DESEMPENIO_OBJETIVOS_MSG().uspINS_RRHH_DESEMPENIO_OBJETIVOS_MSG(oBE));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public int uspINS_RRHH_DESEMPENIO_OBJETIVOS_MSG(BE_RRHH_DESEMPENIO_OBJETIVOS_MSG oBE)
        {
            object[] Parametros = new[] {
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.IDE_MSG, tgSQLFieldType.NUMERIC),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.DNI_USER, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.IDE_OBJETIVO, tgSQLFieldType.NUMERIC),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.TIPO, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.ANIO, tgSQLFieldType.NUMERIC),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.ASUNTO, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.COMENTARIO, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.FILE, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.URL, tgSQLFieldType.TEXT),
            };

            return(Convert.ToInt32(new Utilitarios().ExecuteScalar("uspINS_RRHH_DESEMPENIO_OBJETIVOS_MSG", Parametros)));
        }
Beispiel #4
0
    protected void enviarComentario(object sender, ImageClickEventArgs e)
    {
        String      cleanMessage = String.Empty;
        ImageButton btn          = ((ImageButton)sender);

        int          item         = Convert.ToInt32(btn.CommandArgument);
        ListViewItem CommentItem  = btn.NamingContainer as ListViewItem;
        int          IDE_OBJETIVO = (int)ListView1.DataKeys[CommentItem.DisplayIndex].Values["IDE_OBJETIVO"];



        TextBox    txtComentarios = (TextBox)CommentItem.FindControl("txtComentarios");
        FileUpload FileUpload1    = (FileUpload)CommentItem.FindControl("FileUpload1");



        // Si el directorio no existe, crearlo
        if (!Directory.Exists(Server.MapPath(FolderDesemepenio)))
        {
            Directory.CreateDirectory(FolderDesemepenio);
        }

        String  fileExtension = string.Empty;
        Boolean fileOK        = false;
        string  fileArchivo   = string.Empty;

        if (FileUpload1.HasFile)
        {
            string fileName = FileUpload1.FileName;
            int    length   = FileUpload1.PostedFile.ContentLength;

            fileExtension = Path.GetExtension(FileUpload1.PostedFile.FileName);

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

        if (fileOK)
        {
            try
            {
                // Se carga la ruta física de la carpeta temp del sitio
                string ruta = Server.MapPath(FolderDesemepenio);

                // Si el directorio no existe, crearlo
                if (!Directory.Exists(ruta))
                {
                    Directory.CreateDirectory(ruta);
                }

                string archivo = String.Format("{0}\\{1}", ruta, FileUpload1.FileName);

                // Verificar que el archivo no exista
                if (File.Exists(archivo))
                {
                    fileArchivo = DateTime.UtcNow.ToFileTimeUtc() + Path.GetExtension(FileUpload1.PostedFile.FileName);
                    FileUpload1.SaveAs(ruta + fileArchivo);
                }

                else
                {
                    fileArchivo = FileUpload1.PostedFile.FileName;
                    FileUpload1.SaveAs(archivo);
                }
            }
            catch (Exception ex)
            {
                cleanMessage = "Archivo no puedo ser cargado";
                ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
            }
        }


        if (txtComentarios.Text.Trim() == String.Empty)
        {
            cleanMessage = "Ingresar comentarios";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
        else
        {
            BE_RRHH_DESEMPENIO_OBJETIVOS_MSG oBESol = new BE_RRHH_DESEMPENIO_OBJETIVOS_MSG();
            oBESol.IDE_MSG      = 0;// Convert.ToInt32(string.IsNullOrEmpty(lblCodigo.Text) ? "0" : lblCodigo.Text);
            oBESol.DNI_USER     = lblPersonal.Text;
            oBESol.IDE_OBJETIVO = IDE_OBJETIVO;
            oBESol.TIPO         = "OBSERVACION";
            oBESol.ANIO         = Convert.ToInt32(Session["ANIO"]);
            oBESol.ASUNTO       = String.Empty;
            oBESol.COMENTARIO   = txtComentarios.Text.Trim();
            oBESol.FILE         = fileArchivo;
            oBESol.URL          = FolderDesemepenio;

            int dtrpta = 0;
            dtrpta = new BL_RRHH_DESEMPENIO_OBJETIVOS_MSG().uspINS_RRHH_DESEMPENIO_OBJETIVOS_MSG(oBESol);
            if (dtrpta > 0)
            {
                txtComentarios.Text = String.Empty;
                cleanMessage        = "Envio satisfactorio";
                ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
                ListarObjetivos();
            }
        }
    }