Exemple #1
0
        private void btnUpFile_Click(object sender, EventArgs e)
        {
            try
            {
                OpenFileDialog openFileDialog = new OpenFileDialog();
                openFileDialog.Filter           = "Archivo PDF |*.pdf";
                openFileDialog.RestoreDirectory = true;

                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    byte[] File   = null;
                    Stream stream = openFileDialog.OpenFile();
                    using (MemoryStream ms = new MemoryStream())
                    {
                        stream.CopyTo(ms);
                        File = ms.ToArray();
                    }

                    asignaciones.AgregarDocumentoDevolucion(new CEAsignaciones
                    {
                        id      = Convert.ToInt32(tblDevolucionesFilter.CurrentRow.Cells[0].Value),
                        archivo = File
                    });
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }