예제 #1
0
    protected void ibnDownExcel_Click(object sender, ImageClickEventArgs e)
    {
        Biz_Datas data  = new Biz_Datas();
        string    query = data.GetBiasQueryScript(COMP_ID
                                                  , EST_ID
                                                  , ESTTERM_REF_ID
                                                  , ESTTERM_SUB_ID
                                                  , ESTTERM_STEP_ID
                                                  , DataType.ToString()
                                                  , DEPT_VALUES);

        if (GraphType.Equals("Radar"))
        {
            BindRadarChart(Chart1
                           , query
                           , DataType
                           , ChartImageType.Flash);

            BindRadarChart(Chart2
                           , query
                           , DataType
                           , ChartImageType.Jpeg);
        }
        else if (GraphType.Equals("LowHigh"))
        {
            BindRangeColumnChart(Chart1
                                 , query
                                 , DataType
                                 , ChartImageType.Flash);

            BindRangeColumnChart(Chart2
                                 , query
                                 , DataType
                                 , ChartImageType.Jpeg);
        }

        string filePath = Server.MapPath("../_common/Temp/bias_graph.jpg");

        FileStream file = null;

        try
        {
            file = new FileStream(filePath
                                  , FileMode.Create
                                  , System.Security.AccessControl.FileSystemRights.CreateFiles
                                  , FileShare.ReadWrite
                                  , 8
                                  , FileOptions.None
                                  , null);

            if (File.Exists(filePath))
            {
                File.Delete(filePath);
            }

            Chart2.Save(file);
            file.Close();

            string fileName = "역량평가Bias조정.jpg";
            Response.AddHeader("content-disposition", "attachment;filename=" + HttpUtility.UrlEncode(fileName).Replace("+", "%20"));
            Response.ContentType = "application/unknown";
            Response.WriteFile(filePath);
        }
        catch (Exception ex)
        {
            ltrScript.Text = JSHelper.GetAlertScript(ex.Message);
            return;
        }
    }