Exemplo n.º 1
0
        public void ProcessRequest(HttpContext context)
        {
            //context.Response.ContentType = "text/plain";
            //context.Response.Write("Hello World");

            if (context != null &&  context.Request != null &&   context.Response != null &&  context.Request.HttpMethod == "POST")
            {
                HttpRequest request = context.Request;
                // Get HTTP POST form variables, ensuring they are not null.
                string filename = request.Form["filename"];
                string type = request.Form["type"];
                int width = 0;
                string svg = request.Form["svg"];

                if (filename != null &&
                    type != null &&
                    Int32.TryParse(request.Form["width"], out width) &&
                    svg != null)
                {
                    // Create a new chart export object using form variables.
               //     type = "image/jpeg";
                    Exporter export = new Exporter(filename, type, width, svg);
                    // Write the exported chart to the HTTP Response object.
                    //  export.WriteToHttpResponse(context.Response);

                    // Short-circuit this ASP.NET request and end. Short-circuiting
                    // prevents other modules from adding/interfering with the output.
                    //HttpContext.Current.ApplicationInstance.CompleteRequest();
                    //context.Response.End();
                    var imgHeight = 0;
                    var imgWidth = 0;
                    var imgbytes = export.GetReportImg(out imgHeight, out imgWidth);
                    var xls=new   ExportXls();
                    xls.ExportImg2Xls(context.Response, imgbytes, "课程满意度分布",imgHeight,imgWidth);

                }
            }
        }
Exemplo n.º 2
0
        private void ExportStuInfo(HttpContext context)
        {
            var exXls = new ExportXls();
            var fieldsNames = new List<string>();
            fieldsNames.Add("姓名");
            fieldsNames.Add("性别");
            fieldsNames.Add("身份证号");
            fieldsNames.Add("所在单位");
            fieldsNames.Add("职务");
            fieldsNames.Add("联系电话");
            fieldsNames.Add("出生日期");
            fieldsNames.Add("民族");
            fieldsNames.Add("全日制学历");
            fieldsNames.Add("全日制学校");
            fieldsNames.Add("在职学历");
            fieldsNames.Add("在职学校");
            fieldsNames.Add("政治面貌");
            fieldsNames.Add("职称");
            fieldsNames.Add("现任级别");
            fieldsNames.Add("任现任级别时间");
            fieldsNames.Add("现任职务");
            fieldsNames.Add("任职时间");
            fieldsNames.Add("手机号");
            fieldsNames.Add("学时");
            fieldsNames.Add("描述");
            fieldsNames.Add("继教号");

            var ds = QueryDataResultForExp(context);
            var filename =DateTime.Now.ToString("yyyy-MM-dd")+ "-学员信息.xls";

            if (ds != null && ds.Tables.Count > 0)
            {
                exXls.ExportToXls(context.Response, fieldsNames, ds.Tables[0], filename);
            }
        }
Exemplo n.º 3
0
        private void ExportCourseInfo(HttpContext context)
        {
            var exXls = new ExportXls();
            var fieldsNames = new List<string>();
            fieldsNames.Add("课程名称");
            fieldsNames.Add("授课教师");
            fieldsNames.Add("授课地点");
            fieldsNames.Add("授课时间");

            var ds = QueryDataResultForExp(context);
            var filename = DateTime.Now.ToString("yyyy-MM-dd") + "-课程信息.xls";

            if (ds != null && ds.Tables.Count > 0)
            {
                exXls.ExportToXls(context.Response, fieldsNames, ds.Tables[0], filename);
            }
        }
Exemplo n.º 4
0
        private void ExportTeacherInfo(HttpContext context)
        {
            var exXls = new ExportXls();
            var fieldsNames = new List<string>();
            fieldsNames.Add("姓名");
            fieldsNames.Add("性别");
            fieldsNames.Add("身份证号");
            fieldsNames.Add("所在单位");
            fieldsNames.Add("职称");
            fieldsNames.Add("职务");
            fieldsNames.Add("研究方向");
            fieldsNames.Add("手机号");
            fieldsNames.Add("描述");

            var ds = QueryDataResultForExp(context);
            var filename = DateTime.Now.ToString("yyyy-MM-dd") + "-教师信息.xls";

            if (ds != null && ds.Tables.Count > 0)
            {
                exXls.ExportToXls(context.Response, fieldsNames, ds.Tables[0], filename);
            }
        }
Exemplo n.º 5
0
        private void ExportTotalReport(HttpContext context)
        {
            var exXls = new ExportXls();
            var fieldsNames = new List<string>();
            fieldsNames.Add("课程名称");
            fieldsNames.Add("授课教师");
            fieldsNames.Add("总平均分(满分52分)");
            fieldsNames.Add("总体满意度");
            fieldsNames.Add("评估等级");
            fieldsNames.Add("课程内容满意度");
            fieldsNames.Add("培训讲师满意度");
            fieldsNames.Add("培训组织和管理满意度");
            fieldsNames.Add("实评人数");
            fieldsNames.Add("培训时间");

            var quesBll = new BLL.Questionnaire();
            var dt = quesBll.GetTotalReport();
            dt.Columns.Remove("CourseId");
             dt.AcceptChanges();

             var filename = "课程评估总体情况统计表.xls";
             exXls.ExportTotalReportToxls(context.Response, fieldsNames, dt, filename);
        }
Exemplo n.º 6
0
        private void ExportTeacherReport(HttpContext context)
        {
            var exXls = new ExportXls();
            var fieldsNames = new List<string>();
            fieldsNames.Add("课程名称");
            fieldsNames.Add("讲师准备比较充分");
            fieldsNames.Add("语言表达清晰,态度端正");
            fieldsNames.Add("仪表仪容端庄大方,有亲和力");
            fieldsNames.Add("培训方式多样,生动有趣");
            fieldsNames.Add("与学员沟通和互动有效");
            var quesBll = new BLL.Questionnaire();
            var dt = quesBll.GetTeacherReport();
            dt.Columns.Remove("CourseId");
            dt.Columns.Remove("TeacherName");
            dt.Columns.Remove("TeachTime");
            dt.Columns.Remove("TeacherBearing");
            dt.Columns.Remove("TeacherCommunication");
            dt.Columns.Remove("TeacherLanguage");
            dt.Columns.Remove("TeacherPrepare");
            dt.Columns.Remove("TeacherStyle");
            dt.Columns.Remove("TotalDone");
            dt.Columns.Remove("TotalTeacher");
            dt.AcceptChanges();

            var filename = "培训讲师各指标满意度分布表.xls";
            exXls.ExportTeacherReportToxls(context.Response, fieldsNames, dt, filename);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 导出意见
        /// </summary>
        private void ExportSuggestionInfo(HttpContext context, string id)
        {
            var exXls = new ExportXls();
            var fieldsNames = new List<string>();
            fieldsNames.Add("学员姓名");
            fieldsNames.Add("建议");
            var quesBll = new BLL.Questionnaire();
            var ds = quesBll.GetSuggestion(id);

            var courseBll = new BLL.Course();
            var courseModel = courseBll.GetModel(new Guid(id));

            var filename = courseModel.CourseName + "--学员建议.xls";

            if (ds != null && ds.Tables.Count > 0)
            {
                exXls.ExportToXls(context.Response, fieldsNames, ds.Tables[0], filename);
            }
        }
Exemplo n.º 8
0
        private void ExportStuNoFinish(HttpContext context, string id)
        {
            var exXls = new ExportXls();
            var fieldsNames = new List<string>();
            fieldsNames.Add("学员姓名");
            fieldsNames.Add("所在学校");
            fieldsNames.Add("联系电话");
            var quesBll = new BLL.Questionnaire();
            var ds = quesBll.GetNofinishedStu(id);

            var courseBll = new BLL.Course();
            var courseModel = courseBll.GetModel(new Guid(id));

            var filename = courseModel.CourseName + "--未完成学员.xls";

            if (ds != null && ds.Tables.Count > 0)
            {
                exXls.ExportToXls(context.Response, fieldsNames, ds.Tables[0], filename);
            }
        }
Exemplo n.º 9
0
        private void ExportStuInfo(HttpContext context, string id)
        {
            var exXls = new ExportXls();
            var fieldsNames = new List<string>();
            fieldsNames.Add("学员姓名");
            fieldsNames.Add("登录名");
            fieldsNames.Add("密码");
            fieldsNames.Add("所属学校");

            var quesBll = new BLL.Questionnaire();
            var dt = quesBll.GetStuInfoofCourse(id);

            var courseBll = new BLL.Course();
            var courseModel = courseBll.GetModel(new Guid(id));

            var filename = courseModel.CourseName + "--学员信息.xls";

            exXls.ExportToXls(context.Response, fieldsNames, dt, filename);
        }
Exemplo n.º 10
0
        private void ExportOrgReport(HttpContext context)
        {
            var exXls = new ExportXls();
            var fieldsNames = new List<string>();
            fieldsNames.Add("课程名称");
            fieldsNames.Add("培训服务周到细致");
            fieldsNames.Add("培训时间安排和控制合理");
            fieldsNames.Add("培训场所、设备安排到位");
            var quesBll = new BLL.Questionnaire();
            var dt = quesBll.GetOrgReport();
            dt.Columns.Remove("CourseId");
            dt.Columns.Remove("OrgArrange");
            dt.Columns.Remove("OrgService");
            dt.Columns.Remove("OrgTime");
            dt.Columns.Remove("TotalDone");
            dt.Columns.Remove("TotalOrg");
            dt.AcceptChanges();

            var filename = "培训组织和管理满意度分布表.xls";
            exXls.ExportOrgReportToxls(context.Response, fieldsNames, dt, filename);
        }
Exemplo n.º 11
0
 private void ExportEvReportToxls(HttpContext context, string coursId)
 {
     var coid = new Guid(coursId);
     var couBll = new BLL.Course();
     var courseModel = couBll.GetModel(coid);
     var courseName = courseModel.CourseName;
     var exXls = new ExportXls();
     var filename = courseName + "-评估报告单.xls";
     exXls.ExportEvReportToxls(context.Response, filename, coid);
 }
Exemplo n.º 12
0
        private void ExportCourseReport(HttpContext context)
        {
            var exXls = new ExportXls();
            var fieldsNames = new List<string>();
            fieldsNames.Add("课程名称");
            fieldsNames.Add("课程主题清晰明确");
            fieldsNames.Add("课程内容丰富、能吸引人");
            fieldsNames.Add("课程内容切合实际,能指导实践");
            fieldsNames.Add("课程内容重点突出,易于理解");
            fieldsNames.Add("课程内容有助于个人发展");
            var quesBll = new BLL.Questionnaire();
            var dt = quesBll.GetCourseReport();
            dt.Columns.Remove("CourseId");
            dt.Columns.Remove("CourseSubject");
            dt.Columns.Remove("CourseDevelop");
            dt.Columns.Remove("CourseKey");
            dt.Columns.Remove("CoursePractical");
            dt.Columns.Remove("CourseRich");
            dt.Columns.Remove("TotalDone");
            dt.Columns.Remove("TotalCourse");
             dt.AcceptChanges();

             var filename = "课程内容满意度分布表.xls";
             exXls.ExportCourseReportToxls(context.Response, fieldsNames, dt, filename);
        }
Exemplo n.º 13
0
        /// <summary>
        /// 上传
        /// </summary>
        /// <param name="context"></param>
        /// <param name="dtype"></param>
        /// <returns></returns>
        private string Upload(HttpContext context, string dtype)
        {
            var filename = "";
            var basePath = HttpContext.Current.Server.MapPath("UploadTemplate/");

            switch (dtype)
            {
                case "stu":
                    filename = Guid.NewGuid() + "stu.xls";
                    break;
                case "tch":
                    filename = Guid.NewGuid() + "tch.xls";
                    break;
                case "cor":
                    filename = Guid.NewGuid() + "cor.xls";
                    break;
                default:
                    break;
            }
            try
            {
                if (!string.IsNullOrEmpty(filename) && context.Request.Files["Filedata"] != null)
                {
                    HttpPostedFile myFile = context.Request.Files["Filedata"];
                    int nFileLen = myFile.ContentLength;
                    byte[] myData = new byte[nFileLen];
                    myFile.InputStream.Read(myData, 0, nFileLen);
                    System.IO.FileStream newFile = new System.IO.FileStream(basePath + filename,
                        System.IO.FileMode.Create);
                    newFile.Write(myData, 0, myData.Length);
                    newFile.Close();
                    var exp = new ExportXls();
                    var dt = exp.ExcelToDataTable("", true, basePath + filename);

                    var msg = "";
                    var result = false;
                    if (dtype == "stu")
                    {
                        result = StudentImport(dt, out msg, filename);
                    }
                    else if (dtype == "tch")
                    {
                        result = TeacherImport(dt, out msg, filename);
                    }
                    else if (dtype == "cor")
                    {
                        result =  CourseImport(dt, out msg, filename);
                    }

                    if (result)
                    {
                        return "1";
                    }
                    else
                    {
                        return msg;
                    }
                }
                else
                {
                    return "0";
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteFileLog(ex.Message + ex);
                return "2";
            }
        }