Esempio n. 1
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            csv              csvFile                    = new csv();
            String           fileName                   = DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss") + ".csv";
            String           thisDayDir                 = Server.MapPath("~") + "csvFiles\\" + DateTime.Now.ToString("yyyy_MM_dd");
            String           excellFilePath             = thisDayDir + "\\" + fileName;
            DataTable        genikoSinoloStatsDataTable = (DataTable)this.Session["genikoSinoloStatsDataTable"];
            DataTable        genikoSinoloStatsRights    = (DataTable)this.Session["genikoSinoloStatsRights"];
            List <DataTable> tables = new List <DataTable>()
            {
                genikoSinoloStatsRights, genikoSinoloStatsDataTable
            };

            csvFile.writeToCsvFile(excellFilePath, tables);

            Response.Write("<script>");
            Response.Write("window.open('downloadFile.aspx?fileName=" + fileName + "&excellFilePath=" + excellFilePath.Replace('\\', '*') + "' ,'_blank')");
            Response.Write("</script>");

            //Response.Write("<script>window.open ('~/statistika/downloadFile.aspx?fileName=" + fileName + "&excellFilePath=" + excellFilePath + ",'_blank');</script>");

            /*System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
             * response.ClearContent();
             * response.Clear();
             * response.ContentType = "text/plain";
             * response.AddHeader("Content-Disposition", "attachment; filename=" + fileName + ";");
             * response.TransmitFile(excellFilePath);
             * response.Flush();
             * response.End();*/
        }
Esempio n. 2
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            csv              csvFile                 = new csv();
            String           fileName                = DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss") + ".csv";
            String           thisDayDir              = Server.MapPath("~") + "\\csvFiles\\" + DateTime.Now.ToString("yyyy_MM_dd");
            String           excellFilePath          = thisDayDir + "\\" + fileName;
            DataTable        dtsqlDikaiomataAnaUser  = (DataTable)this.Session["dtsqlDikaiomataAnaUser"];
            DataTable        dtKaekKaekAnaUserXoriki = (DataTable)this.Session["dtKaekKaekAnaUserXoriki"];
            List <DataTable> tables = new List <DataTable>()
            {
                dtKaekKaekAnaUserXoriki, dtsqlDikaiomataAnaUser
            };

            csvFile.writeToCsvFile(excellFilePath, tables);
            Response.Write("<script>");
            Response.Write("window.open('downloadFile.aspx?fileName=" + fileName + "&excellFilePath=" + excellFilePath.Replace('\\', '*') + "' ,'_blank')");
            Response.Write("</script>");
        }
Esempio n. 3
0
        protected void Button2_Click1(object sender, EventArgs e)
        {
            csv       excell             = new csv();
            String    projectDirPath     = Server.MapPath("~");
            String    fileName           = DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss") + ".csv";
            String    thisDayDir         = Server.MapPath("~") + "\\csvFiles\\" + DateTime.Now.ToString("yyyy_MM_dd");
            String    excellFilePath     = thisDayDir + "\\" + fileName;
            DataTable generalStatsSorted = (DataTable)this.Session["generalStatsSorted"];

            excell.writeToCsvFile(excellFilePath, generalStatsSorted);
            Response.Write("<script>");
            Response.Write("window.open('downloadFile.aspx?fileName=" + fileName + "&excellFilePath=" + excellFilePath.Replace('\\', '*') + "' ,'_blank')");
            Response.Write("</script>");

            /*System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
             * response.ClearContent();
             * response.Clear();
             * response.ContentType = "text/plain";
             * response.AddHeader("Content-Disposition", "attachment; filename=" + fileName + ";");
             * response.TransmitFile(excellFilePath);
             * response.Flush();
             * response.End();*/
        }