예제 #1
0
 public static void FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e)
 {
     if (e.UploadedFile.IsValid)
     {
         // Save uploaded file to some location
     }
 }
예제 #2
0
 public static void FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e)
 {
     if (e.UploadedFile.IsValid)
     {
         pr_imagen = e.UploadedFile.FileBytes;
     }
 }
 public static void FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e)
 {
     if (e.UploadedFile.IsValid)
     {
         seguimiento_foto = e.UploadedFile.FileBytes;
     }
 }
 public static void FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e)
 {
     if (e.UploadedFile.IsValid)
     {
         // Save uploaded file to some location
         HttpContext.Current.Session["UploadedFile"] = e.UploadedFile;
     }
 }
예제 #5
0
 protected void UploadControl_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e)
 {
     if (e.IsValid)
     {
         Session[SessionKey] = e.UploadedFile.FileBytes;
         e.CallbackData      = e.UploadedFile.FileName;
     }
 }
예제 #6
0
        protected void txtUpload_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e)
        {
            e.CallbackData = SavePostedFile(e.UploadedFile);

            txtUpload.Visible = true;

            UpdatePanelProfile.Update();
        }
예제 #7
0
 public static void FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e)
 {
     if (e.UploadedFile.IsValid)
     {
         HttpContext.Current.Session["video"]     = e.UploadedFile.FileBytes;
         HttpContext.Current.Session["extension"] = System.IO.Path.GetExtension(e.UploadedFile.FileName);
         // Save uploaded file to some location
     }
 }
 protected void uplImage_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs args)
 {
     try {
         args.CallbackData = SaveUploadFile();
     } catch (Exception e) {
         args.IsValid   = false;
         args.ErrorText = e.Message;
     }
 }
예제 #9
0
 public static void FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e)
 {
     if (e.UploadedFile.IsValid)
     {
         em_foto = e.UploadedFile.FileBytes;
         //var filename = Path.GetFileName(e.UploadedFile.FileName);
         //e.UploadedFile.SaveAs("~/Content/imagenes/"+e.UploadedFile.FileName, true);
     }
 }
예제 #10
0
        protected void FileDPRBrowse_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e)
        {
            filePath       = string.Empty;
            fileName       = string.Empty;
            FileLabel.Text = string.Empty;
            prodMonth      = hdnProdMonth.Value;

            try
            {
                if (e.IsValid)
                {
                    //directory check
                    string path = AppConfiguration.UPLOAD_DIR + "/" + folderDPR + "/" + prodMonth;

                    if (!Directory.Exists(Server.MapPath(path)))
                    {
                        Directory.CreateDirectory(Server.MapPath(path));
                    }

                    string UploadDir = path + "/";

                    FileInfo fileInfo    = new FileInfo(e.UploadedFile.FileName);
                    String   fileNameOri = e.UploadedFile.FileName.ToString().Replace(" ", "_");
                    String   ext         = System.IO.Path.GetExtension(e.UploadedFile.FileName);

                    if ((fileNameOri.Length - ext.Length) > 45)
                    {
                        fileNameOri = fileNameOri + ext;
                        fileNameOri = fileNameOri.Substring(0, 16).ToLower() + ext;
                    }

                    fileName = fileNameOri;

                    //SaveFile
                    if (!File.Exists(UploadDir + fileName))
                    {
                        filePath = Server.MapPath(UploadDir + fileName);
                        e.UploadedFile.SaveAs(filePath);
                    }

                    e.CallbackData = fileName;
                }
                else
                {
                    throw new Exception("No file to upload");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error occured : {0}", ex.Message);

                filePath       = string.Empty;
                fileName       = string.Empty;
                e.CallbackData = string.Empty;
            }
        }
        public static void FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e)
        {
            #region Variables
            List <in_Ing_Egr_Inven_det_Info> Lista_IngresoInventarioDet = new List <in_Ing_Egr_Inven_det_Info>();
            in_Ing_Egr_Inven_det_List        ListaIngresoInventario     = new in_Ing_Egr_Inven_det_List();
            in_Producto_Bus bus_producto         = new in_Producto_Bus();
            int             cont                 = 0;
            decimal         IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual);
            int             IdEmpresa            = Convert.ToInt32(SessionFixed.IdEmpresa);
            tb_sucursal_Bus bus_sucursal         = new tb_sucursal_Bus();

            #endregion

            Stream stream = new MemoryStream(e.UploadedFile.FileBytes);
            if (stream.Length > 0)
            {
                IExcelDataReader reader = null;
                reader = ExcelReaderFactory.CreateOpenXmlReader(stream);

                #region Ingreso Inventario
                var lst_producto = bus_producto.get_list(IdEmpresa, false);
                while (reader.Read())
                {
                    if (!reader.IsDBNull(0) && cont > 0)
                    {
                        var pr_codigo_producto = Convert.ToString(reader.GetValue(3));
                        var IdUnidadMedida     = Convert.ToString(reader.GetValue(2));
                        var costo_total        = Convert.ToDouble(reader.GetValue(6));
                        var cantidad           = Convert.ToDouble(reader.GetValue(5));
                        var info_producto      = lst_producto.Where(q => q.pr_codigo == pr_codigo_producto).FirstOrDefault();

                        if ((info_producto != null && info_producto.IdProducto != 0) && (costo_total > 0 && cantidad > 0))
                        {
                            in_Ing_Egr_Inven_det_Info info_detalle = new in_Ing_Egr_Inven_det_Info
                            {
                                Secuencia      = cont++,
                                IdEmpresa      = IdEmpresa,
                                IdProducto     = info_producto.IdProducto,
                                pr_descripcion = info_producto.pr_descripcion,
                                IdUnidadMedida_sinConversion = string.IsNullOrEmpty(IdUnidadMedida) ? info_producto.IdUnidadMedida_Consumo : IdUnidadMedida,
                                dm_cantidad_sinConversion    = cantidad,
                                mv_costo_sinConversion       = costo_total / cantidad,
                            };

                            Lista_IngresoInventarioDet.Add(info_detalle);
                        }
                    }
                    else
                    {
                        cont++;
                    }
                }
                ListaIngresoInventario.set_list(Lista_IngresoInventarioDet, IdTransaccionSession);
                #endregion
            }
        }
예제 #12
0
        protected void UploadControl5_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e)
        {
            string name            = e.UploadedFile.FileName;
            string url5            = GetImageUrl(e.UploadedFile.FileNameInStorage);
            long   sizeInKilobytes = e.UploadedFile.ContentLength / 1024;
            string sizeText        = sizeInKilobytes.ToString() + " KB";

            e.CallbackData  = name + "|" + url5 + "|" + sizeText;
            Session["url5"] = url5;
        }
예제 #13
0
        protected void ASPxUploadControl1_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e)
        {
            ASPxUploadControl control = sender as ASPxUploadControl;
            CustomAppointmentFormTemplateContainer container = (CustomAppointmentFormTemplateContainer)Parent;
            string callback = SavePostedFiles(e.UploadedFile);

            container.Appointment.CustomFields["AppointmentAttachment"]         = e.UploadedFile.FileBytes;
            container.Appointment.CustomFields["AppointmentAttachmentFileName"] = callback;
            e.CallbackData = callback;
        }
예제 #14
0
 protected void DocumentsUploadControl_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e)
 {
     try
     {
         Session["LlaveCriptograficap12"] = e.UploadedFile.FileBytes;
     }
     catch (Exception ex)
     {
         throw new Exception(Utilidades.validarExepcionSQL(ex), ex.InnerException);
     }
 }
예제 #15
0
 protected void uploadcontrolAddAttachment_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e)
 {
     if (!e.IsValid)
     {
         return;
     }
     Session["FILE"] = pdfDocumentProcessor.AppendDocument(e.UploadedFile.FileBytes);
     //Session["FILE"] = e.UploadedFile.FileBytes;
     Session["FILENAME"] = e.UploadedFile.FileName;
     e.CallbackData      = e.UploadedFile.FileName;
 }
예제 #16
0
 public static void FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e)
 {
     if (e.UploadedFile.IsValid)
     {
         // Save uploaded file to some location
         string file_name      = Guid.NewGuid().ToString("N") + Path.GetExtension(e.UploadedFile.FileName);
         string file_path      = HttpContext.Current.Server.MapPath("~/Content/UploadImages/");
         string file_full_path = file_path + file_name;
         e.UploadedFile.SaveAs(file_full_path, false);
         e.CallbackData = file_name;
     }
 }
예제 #17
0
    protected void ASPxUploadControl1_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e)
    {
        string path = "/Images/" + e.UploadedFile.FileName;

        using (var fileStream = File.Create(Server.MapPath(path)))
        {
            e.UploadedFile.FileContent.Seek(0, SeekOrigin.Begin);
            e.UploadedFile.FileContent.CopyTo(fileStream);
        }
        e.CallbackData = path;
        Session["lastUploadedFilePAth"] = path;
    }
        public static void FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e)
        {
            if (e.UploadedFile.IsValid)
            {
                // Save uploaded file to some location

                var fileName = HttpContext.Current.
                               Server.MapPath(System.IO.Path.Combine("~/content/excel", Guid.NewGuid().ToString() + ".xlsx"));
                e.UploadedFile.SaveFile();
                HttpContext.Current.Session["excelFilePath"] = fileName;
            }
        }
예제 #19
0
        public static void FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e)
        {
            #region Variables
            ct_plancta_Bus              bus_ctacble = new ct_plancta_Bus();
            ct_cbtecble_det_List        ListaDet    = new ct_cbtecble_det_List();
            List <ct_cbtecble_det_Info> Lista_Det   = new List <ct_cbtecble_det_Info>();

            int     cont = 0;
            decimal IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual);
            int     IdEmpresa            = Convert.ToInt32(SessionFixed.IdEmpresa);
            #endregion


            Stream stream = new MemoryStream(e.UploadedFile.FileBytes);
            if (stream.Length > 0)
            {
                IExcelDataReader reader = null;
                reader = ExcelReaderFactory.CreateOpenXmlReader(stream);

                var SecDet = 1;
                #region Presupuesto
                while (reader.Read())
                {
                    if (!reader.IsDBNull(0) && cont > 0)
                    {
                        var             IdCtaCble   = Convert.ToString(reader.GetValue(1));
                        ct_plancta_Info infoCtaCble = bus_ctacble.get_info(IdEmpresa, IdCtaCble);

                        if (infoCtaCble != null)
                        {
                            ct_cbtecble_det_Info info = new ct_cbtecble_det_Info
                            {
                                IdEmpresa      = IdEmpresa,
                                secuencia      = SecDet++,
                                IdCtaCble      = IdCtaCble,
                                Descripcion    = infoCtaCble.pc_Cuenta,
                                dc_Valor       = Convert.ToDouble(reader.GetValue(2)) > 0 ? Convert.ToDouble(reader.GetValue(2)) : (Convert.ToDouble(reader.GetValue(3)) * -1),
                                dc_Valor_debe  = Convert.ToDouble(reader.GetValue(2)),
                                dc_Valor_haber = Convert.ToDouble(reader.GetValue(3))
                            };
                            Lista_Det.Add(info);
                        }
                    }
                    else
                    {
                        cont++;
                    }
                }
                ListaDet.set_list(Lista_Det, IdTransaccionSession);
                #endregion
            }
        }
예제 #20
0
 // Contact upload complete
 public static void ContactUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e)
 {
     const string UploadDirectory = "~/Content/Images/";
     if (e.UploadedFile.IsValid)
     {
         // Save uploaded file to some location
         MemoryStream ms = new MemoryStream();
         string resultExtension = Path.GetExtension(e.UploadedFile.FileName);
         string resultFileName = Path.ChangeExtension(Path.GetRandomFileName(), resultExtension);
         string resultFileUrl = UploadDirectory + resultFileName;
         string resultFilePath = System.Web.HttpContext.Current.Server.MapPath("~/Content/Images/") + "bothdatesposter2.jpg";
         e.UploadedFile.SaveAs(resultFilePath);
         e.CallbackData = resultFilePath;
     }
 }
예제 #21
0
 public static void FormUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e)
 {
     const string UploadDirectory = "~/Content/UploadedFiles/";
     if (e.UploadedFile.IsValid)
     {
         MemoryStream ms = new MemoryStream();
         string resultExtension = Path.GetExtension(e.UploadedFile.FileName);
         string resultFileName = Path.ChangeExtension(Path.GetRandomFileName(), resultExtension);
         string resultFileUrl = UploadDirectory + resultFileName;
         string resultFilePath = System.Web.HttpContext.Current.Server.MapPath("~/Content/UploadedFiles/") + e.UploadedFile.FileName;
         e.UploadedFile.SaveAs(resultFilePath);
         e.CallbackData = resultFilePath;
     }
     UploadExcel(e.UploadedFile);
 }
예제 #22
0
        public static void FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e)
        {
            int cont = 0;
            ro_rubro_tipo_Bus                 bus_rubro                   = new ro_rubro_tipo_Bus();
            ro_empleado_info_list             empleado_info_list          = new ro_empleado_info_list();
            ro_PrestamoMasivo_Det_List        ListaDetalle_PrestamoMasivo = new ro_PrestamoMasivo_Det_List();
            List <ro_PrestamoMasivo_Det_Info> PrestamoMasivo_Det          = new List <ro_PrestamoMasivo_Det_Info>();
            var    IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSession);
            int    Secuencia            = 1;
            Stream stream = new MemoryStream(e.UploadedFile.FileBytes);

            if (stream.Length > 0)
            {
                IExcelDataReader reader = null;
                reader = ExcelReaderFactory.CreateOpenXmlReader(stream);
                while (reader.Read())
                {
                    if (!reader.IsDBNull(0))
                    {
                        if (cont != 0)
                        {
                            int    IdEmpresa  = Convert.ToInt32(SessionFixed.IdEmpresa);
                            string cedula     = reader.GetString(0);
                            var    empleado   = empleado_info_list.get_list(IdTransaccionSession).Where(v => v.pe_cedulaRuc == cedula).FirstOrDefault();
                            var    CodRubro   = Convert.ToString(reader.GetValue(2));
                            var    info_rubro = bus_rubro.get_info_x_codigo(IdEmpresa, CodRubro);
                            if (empleado != null)
                            {
                                ro_PrestamoMasivo_Det_Info info = new ro_PrestamoMasivo_Det_Info
                                {
                                    Secuencia         = Secuencia++,
                                    IdEmpleado        = (empleado == null ? 0 : empleado.IdEmpleado),
                                    IdRubro           = (info_rubro == null ? null : info_rubro.IdRubro),
                                    Monto             = Convert.ToDouble(reader.GetValue(3)),
                                    NumCuotas         = Convert.ToInt32(reader.GetValue(4)),
                                    ru_descripcion    = (info_rubro == null ? "" : info_rubro.ru_descripcion),
                                    pe_nombreCompleto = (empleado == null ? "" : empleado.Empleado)
                                };
                                PrestamoMasivo_Det.Add(info);
                            }
                        }
                        cont++;
                    }
                }
                ListaDetalle_PrestamoMasivo.set_list(PrestamoMasivo_Det, IdTransaccionSession);
            }
        }
예제 #23
0
        public static void FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e)
        {
            #region Variables
            pre_rubro_Bus                  bus_rubro = new pre_rubro_Bus();
            pre_PresupuestoDet_List        ListaDet  = new pre_PresupuestoDet_List();
            List <pre_PresupuestoDet_Info> Lista_Det = new List <pre_PresupuestoDet_Info>();

            int     cont = 0;
            decimal IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual);
            int     IdEmpresa            = Convert.ToInt32(SessionFixed.IdEmpresa);
            #endregion


            Stream stream = new MemoryStream(e.UploadedFile.FileBytes);
            if (stream.Length > 0)
            {
                IExcelDataReader reader = null;
                reader = ExcelReaderFactory.CreateOpenXmlReader(stream);

                var SecDet = 1;
                #region Presupuesto
                while (reader.Read())
                {
                    if (!reader.IsDBNull(0) && cont > 0)
                    {
                        var            IdRubroDet = Convert.ToInt32(reader.GetValue(0));
                        pre_rubro_Info infoRubro  = bus_rubro.GetInfo(IdEmpresa, IdRubroDet);

                        pre_PresupuestoDet_Info info = new pre_PresupuestoDet_Info
                        {
                            IdEmpresa   = IdEmpresa,
                            Secuencia   = SecDet++,
                            IdRubro     = IdRubroDet,
                            Descripcion = infoRubro.Descripcion,
                            Monto       = Convert.ToDouble(reader.GetValue(1)),
                        };
                        Lista_Det.Add(info);
                    }
                    else
                    {
                        cont++;
                    }
                }
                ListaDet.set_list(Lista_Det, IdTransaccionSession);
                #endregion
            }
        }
예제 #24
0
        protected void ASPxUploadControl1_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e)
        {
            string UploadDirectory = "~/file/";
            string resultExtension = Path.GetExtension(e.UploadedFile.FileName);
            string resultName      = Path.GetFileName(e.UploadedFile.FileName);
            string resultFileName  = Path.ChangeExtension(Path.GetRandomFileName() + "_" + resultName, resultExtension);
            string resultFileUrl   = UploadDirectory + resultFileName;
            string resultFilePath  = MapPath(resultFileUrl);

            e.UploadedFile.SaveAs(resultFilePath);
            string abc = e.UploadedFile.FileName;

            if (e.IsValid)
            {
                e.CallbackData = resultFileName;
            }
        }
        protected void uplLogotipo_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e)
        {
            UploadedFile uploadedFile = e.UploadedFile;

            vbLogo = uploadedFile.FileBytes;
            //string fileName = uploadedFile.FileName;
            //string resultExtension = Path.GetExtension(fileName);
            //string resultFileName = Path.ChangeExtension(Path.GetRandomFileName(), resultExtension);
            //string resultFileUrl = "~/Editors/UploadImages/" + resultFileName;
            //string resultFilePath = MapPath(resultFileUrl);
            //uploadedFile.SaveAs(resultFilePath);
            ////UploadingUtils.RemoveFileWithDelay(resultFileName, resultFilePath, 5);
            //string url = ResolveClientUrl(resultFileUrl);
            //var sizeInKilobytes = uploadedFile.ContentLength / 1024;
            //string sizeText = sizeInKilobytes.ToString() + " KB";
            //e.CallbackData = fileName + "|" + url + "|" + sizeText;
        }
    protected void ASPxUploadControl1_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e)
    {
        ASPxUploadControl uploadControl = (ASPxUploadControl)sender;
        UploadedFile      uploadedFile  = uploadControl.UploadedFiles[0];

        if (!IsFileNameCorrect(uploadedFile.FileName))
        {
            e.IsValid   = false;
            e.ErrorText = "Incorrect file type";
            return;
        }

        if (uploadedFile.IsValid)
        {
            Session["UploadedFile"] = GetBytes(uploadedFile.FileContent);
        }
    }
예제 #27
0
        protected void DocumentsUploadControl_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e)
        {
            bool isSubmissionExpired = false;

            if (UploadedFilesStorage == null)
            {
                isSubmissionExpired = true;
                UploadControlHelper.AddUploadedFilesStorage(SubmissionID);
            }
            UploadedFileInfo tempFileInfo = UploadControlHelper.AddUploadedFileInfo(SubmissionID, e.UploadedFile.FileName);

            e.UploadedFile.SaveAs(tempFileInfo.FilePath);

            if (e.IsValid)
            {
                e.CallbackData = tempFileInfo.UniqueFileName + "|" + isSubmissionExpired;
            }
        }
예제 #28
0
 public static void FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e)
 {
     if (e.UploadedFile.IsValid)
     {
         var path = System.Web.HttpContext.Current.Request.MapPath(targetPath);
         if (!Directory.Exists(path))
         {
             Directory.CreateDirectory(path);
         }
         string resultFilePath = System.Web.HttpContext.Current.Request.MapPath(targetPath + e.UploadedFile.FileName);
         e.UploadedFile.SaveAs(resultFilePath, true);//Code Central Mode - Uncomment This Line
         IUrlResolutionService urlResolver = sender as IUrlResolutionService;
         if (urlResolver != null)
         {
             e.CallbackData = Path.GetFileName(resultFilePath);//urlResolver.ResolveClientUrl(resultFilePath);
         }
     }
 }
        public static void FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e)
        {
            int cont = 0;
            ro_empleado_info_list empleado_info_list = new ro_empleado_info_list();
            ro_EmpleadoNovedadCargaMasiva_detLis_Info     EmpleadoNovedadCargaMasiva_detLis_Info = new ro_EmpleadoNovedadCargaMasiva_detLis_Info();
            List <ro_EmpleadoNovedadCargaMasiva_det_Info> lista_novedades = new List <ro_EmpleadoNovedadCargaMasiva_det_Info>();
            decimal IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual);

            Stream stream = new MemoryStream(e.UploadedFile.FileBytes);

            if (stream.Length > 0)
            {
                IExcelDataReader reader = null;
                reader = ExcelReaderFactory.CreateOpenXmlReader(stream);
                while (reader.Read())
                {
                    if (!reader.IsDBNull(0))
                    {
                        if (cont != 0)
                        {
                            string cedua    = reader.GetString(0);
                            var    empleado = empleado_info_list.get_list(IdTransaccionSession).Where(v => v.pe_cedulaRuc == cedua).FirstOrDefault();
                            if (empleado != null)
                            {
                                ro_EmpleadoNovedadCargaMasiva_det_Info info = new ro_EmpleadoNovedadCargaMasiva_det_Info
                                {
                                    Valor         = Convert.ToDouble(reader.GetValue(3)),
                                    CantidadHoras = Convert.ToDouble(reader.GetValue(4)),

                                    pe_cedulaRuc = cedua,
                                    pe_apellido  = empleado.Empleado,
                                    em_codigo    = empleado.em_codigo,
                                    Secuancia    = cont,
                                    IdEmpleado   = empleado.IdEmpleado
                                };
                                lista_novedades.Add(info);
                            }
                        }
                        cont++;
                    }
                }
                EmpleadoNovedadCargaMasiva_detLis_Info.set_list(lista_novedades, IdTransaccionSession);
            }
        }
예제 #30
0
        protected void fileUP_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e)
        {
            //send back filename and filename in azurestorage to be handled client side, where a callback for storing the data
            // will  be called - this is because the fileuploader has its own callback for uploading the file, handled in this event

            // e.CallbackData = e.UploadedFile.FileName + "|" + e.UploadedFile.FileNameInStorage;

            //routine from pro_repository.aspx to extract text - both should be moved to rc_services
            string FileExtn = "", plainText = "";

            ASPxUploadControl ArtifactUploader = (ASPxUploadControl)sender;
            string            accountName      = ArtifactUploader.AzureSettings.AccountName;
            //string containerName =ArtifactUploader.AzureSettings.ContainerName; --does not work, even though blob is uploded to proper container
            string containerName               = Session["enterpriseID"].ToString().ToLower();
            string url = GetFileUrl(e.UploadedFile.FileNameInStorage, accountName, containerName, ref FileExtn);

            if (FileExtn == ".txt" || FileExtn == ".doc" || FileExtn == ".docx")
            {
                using (var client = new System.Net.WebClient())
                {
                    client.DownloadFile(url, Path.GetTempPath() + "\\" + e.UploadedFile.FileName);
                }

                RichEditDocumentServer richEditDocument = new RichEditDocumentServer();
                richEditDocument.LoadDocument(Path.GetTempPath() + "\\" + e.UploadedFile.FileName);
                plainText = richEditDocument.Text;
            }
            else if (FileExtn == ".pdf")
            {
                using (var client = new System.Net.WebClient())
                {
                    client.DownloadFile(url, Path.GetTempPath() + "\\" + e.UploadedFile.FileName);
                }

                using (PdfDocumentProcessor documentProcessor = new PdfDocumentProcessor())
                {
                    documentProcessor.LoadDocument(Path.GetTempPath() + "\\" + e.UploadedFile.FileName);
                    plainText = documentProcessor.Text;
                }
            }
            e.CallbackData = e.UploadedFile.FileName + "|" + e.UploadedFile.FileNameInStorage + "|" + plainText;
            paramUpload.Clear();
        }