protected void Button_Export_Click(object sender, EventArgs e)
        {
            string        exception     = "";
            string        evaluatedID   = Request.QueryString["id"];
            EvaluateTable evaluateTable = new EvaluateTable();

            if (EvaluateTableManagementCtrl.GetEvaluateTable(evaluatedID, ref evaluateTable, ref exception))
            {
                string filename = "";
                if (ExportManagementCtrl.ExportEvaluateTable(ref filename, evaluateTable, ref exception))
                {
                    Response.ClearContent();
                    Response.ContentType = "application/excel";
                    Response.AddHeader("content-disposition", "attachment;filename=" + Server.UrlEncode(filename));
                    string path = Server.MapPath("..\\..\\downloadfiles\\" + filename);
                    Response.TransmitFile(path);
                }
                else
                {
                    Alert.ShowInTop("导出失败!\n原因:" + exception, MessageBoxIcon.Error);
                }
            }
            else
            {
                Alert.ShowInTop("导出失败!\n原因:" + exception, MessageBoxIcon.Error);
            }
        }
Exemple #2
0
        protected void Button_Export_Click(object sender, EventArgs e)
        {
            string    exception = "";
            string    depart = DropDownList_Depart.SelectedValue;
            int       year = Convert.ToInt32(DropDownList_Year.SelectedValue);
            DataTable table = new DataTable();
            string    startTime = "", stopTime = "", evaluationDate = "";

            if (EvaluationManagementCtrl.GetEvaluationResultByDepartAndEvaluation(ref table, depart, year, ref startTime, ref stopTime, ref evaluationDate, ref exception))
            {
                string filename = "";
                if (ExportManagementCtrl.ExportEvaluationResultForDepart(ref filename, depart, table, startTime, stopTime, evaluationDate, ref exception))
                {
                    Response.ClearContent();
                    Response.ContentType = "application/excel";
                    Response.AddHeader("content-disposition", "attachment;filename=" + Server.UrlEncode(filename));
                    string path = Server.MapPath("..\\..\\downloadfiles\\" + filename);
                    Response.TransmitFile(path);
                }
            }
            else
            {
                Alert.ShowInTop("导出失败!\n原因:" + exception, MessageBoxIcon.Error);
            }
        }
        protected void Button_Export_Click(object sender, EventArgs e)
        {
            string           exception     = "";
            string           evaluatedID   = Request.QueryString["id"];
            string           evaluatedName = Request.QueryString["name"];
            EvaluationResult evaluationResult;

            if (EvaluationManagementCtrl.GetEvaluationResultByEvaluatedAndYear(out evaluationResult, evaluatedID, DropDownList_Year.SelectedValue, ref exception))
            {
                string filename = "";
                if (ExportManagementCtrl.ExportEvaluationResultForIndividual(ref filename, evaluatedName, evaluationResult, ref exception))
                {
                    Response.ClearContent();
                    Response.ContentType = "application/excel";
                    Response.AddHeader("content-disposition", "attachment;filename=" + Server.UrlEncode(filename));
                    string path = Server.MapPath("..\\..\\downloadfiles\\" + filename);
                    Response.TransmitFile(path);
                }
            }
            else
            {
                Alert.ShowInTop("导出失败!\n原因:" + exception, MessageBoxIcon.Error);
            }
        }
        protected void Button_ExportPDF_Click(object sender, EventArgs e)
        {
            string   exception     = "";
            string   evaluatedID   = Request.QueryString["id"];
            string   evaluatedName = Request.QueryString["name"];
            PostBook postBook      = new PostBook();

            if (PostBookManagementCtrl.GetPostBook(ref postBook, evaluatedID, ref exception))
            {
                string sourceName = "";
                if (ExportManagementCtrl.ExportPostBook(ref sourceName, evaluatedName, postBook, ref exception))
                {
                    string targetName = "";
                    if (ExportManagementCtrl.ConvertWordToPDF(ref targetName, sourceName, ref exception))
                    {
                        Response.ClearContent();
                        Response.ContentType = "application/pdf";
                        Response.AddHeader("content-disposition", "attachment;filename=" + Server.UrlEncode(targetName));
                        string path = Server.MapPath("..\\..\\downloadfiles\\" + targetName);
                        Response.TransmitFile(path);
                    }
                    else
                    {
                        Alert.ShowInTop("导出失败!\n原因:" + exception, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    Alert.ShowInTop("导出失败!\n原因:" + exception, MessageBoxIcon.Error);
                }
            }
            else
            {
                Alert.ShowInTop("导出失败!\n原因:" + exception, MessageBoxIcon.Error);
            }
        }