Пример #1
0
        protected void UploadClick(object sender, DirectEventArgs e)
        {
            try
            {
                if (this.FileUploadField1.HasFile)
                {
                    string loggedUsr = Session["username"] as string;

                    COCASJOL.LOGIC.Utiles.ImportarExcelLogic excelImport = new LOGIC.Utiles.ImportarExcelLogic();

                    string extension = Path.GetExtension(this.FileUploadField1.FileName);

                    string uploadSavePath   = System.Configuration.ConfigurationManager.AppSettings.Get("uploadSavePath");
                    string uploadNameSocios = System.Configuration.ConfigurationManager.AppSettings.Get("uploadNameSocios");

                    string savePath = Server.MapPath(uploadSavePath) + uploadNameSocios + extension;

                    string msg = "";

                    lock (lockObj)
                    {
                        this.FileUploadField1.PostedFile.SaveAs(savePath);
                        msg = excelImport.SociosCargarDatos(savePath, loggedUsr);
                    }
                    this.BasicForm.Reset();
                    X.Msg.Alert("Importar Socios", msg).Show();
                    this.SociosSt_Reload(null, null);
                }
            }
            catch (Exception ex)
            {
                log.Fatal("Error fatal al guardar archivo subido.", ex);
                throw;
            }
        }
Пример #2
0
        protected void UploadClick(object sender, DirectEventArgs e)
        {
            try
            {
                if (this.FileUploadField1.HasFile)
                {
                    string loggedUsr = Session["username"] as string;

                    COCASJOL.LOGIC.Utiles.ImportarExcelLogic excelImport = new LOGIC.Utiles.ImportarExcelLogic();

                    string extension = Path.GetExtension(this.FileUploadField1.FileName);

                    string uploadSavePath = System.Configuration.ConfigurationManager.AppSettings.Get("uploadSavePath");
                    string uploadNameSocios = System.Configuration.ConfigurationManager.AppSettings.Get("uploadNameSocios");

                    string savePath = Server.MapPath(uploadSavePath) + uploadNameSocios + extension;

                    string msg = "";

                    lock (lockObj)
                    {
                        this.FileUploadField1.PostedFile.SaveAs(savePath);
                         msg = excelImport.SociosCargarDatos(savePath, loggedUsr);
                    }
                    this.BasicForm.Reset();
                    X.Msg.Alert("Importar Socios", msg).Show();
                    this.SociosSt_Reload(null, null);
                }
            }
            catch (Exception ex)
            {
                log.Fatal("Error fatal al guardar archivo subido.", ex);
                throw;
            }
        }