protected void btnDelete_Click(object sender, EventArgs e) { DimensionBLL temp = new DimensionBLL(); int selectCount = 0; int dimension_id = 0; foreach (GridViewRow gr in grVDimensionManage.Rows) { CheckBox chk = (CheckBox)gr.Cells[0].FindControl("CB_Select"); if (chk.Checked) { dimension_id = int.Parse(grVDimensionManage. DataKeys[gr.RowIndex].Values[0].ToString().Trim()); temp.Delete(dimension_id); selectCount++; } } if (0 == selectCount) { MessageBox.Show("您好,请至少选择一个维度"); } temp = null; Response.Redirect(Request.Url.ToString()); }
protected void btnSave_Click(object sender, EventArgs e) { DimensionBLL dimensionBll = new DimensionBLL(); Dimension temp = new Dimension(); if (Request.QueryString["dimension_id"] != null) { temp.Dimension_id = int.Parse(Request.QueryString["dimension_id"]); } temp.Dimnm =txtbDimnm.Text.Trim(); temp.Dimension_descrip = txtbDescrip.Text.Trim(); temp.Dimension_classid=int.Parse(ddlType.SelectedValue); temp.Time_min = int.Parse(txtbTime.Text.Trim());//界面输入值为分,DB存储秒 temp.Linterval = float.Parse(txtbQ3.Text.Trim()); temp.Minterval = float.Parse(txtbQ2.Text.Trim()); temp.Sinterval = float.Parse(txtbQ1.Text.Trim()); temp.Dimension_2 = float.Parse(txtb2.Text.Trim()); temp.Dimension_8 = float.Parse(txtb8.Text.Trim()); temp.Dimension_17 = float.Parse(txtb17.Text.Trim()); temp.Dimension_32 = float.Parse(txtb32.Text.Trim()); temp.Dimension_50 = float.Parse(txtb50.Text.Trim()); temp.Dimension_68 = float.Parse(txtb68.Text.Trim()); temp.Dimension_83 = float.Parse(txtb83.Text.Trim()); temp.Dimension_92 = float.Parse(txtb92.Text.Trim()); temp.Dimension_98 = float.Parse(txtb98.Text.Trim()); //维度上限时间,下限时间 temp.Time_xiaxian = int.Parse(txtXiaXianTime.Text.Trim()); temp.Time_shangxian = int.Parse(txtShangXianTime.Text.Trim()); if (dimensionBll.Exists(temp.Dimension_id)) { int n = dimensionBll.Update(temp); if (n > 0) { MessageBox.ShowAndRedirect(this, "维度修改成功", "DimensionList.aspx"); } } else { if (dimensionBll.Add(temp) != -1) { MessageBox.ShowAndRedirect(this, "维度添加成功", "DimensionList.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["sn"] != null) { string strGUID = Request.QueryString["sn"].ToString(); if (!string.IsNullOrEmpty(strGUID)) { foreach (RenderingExtension extension in ReportViewer1.LocalReport.ListRenderingExtensions()) { if (extension.Name != "PDF" && extension.Name != "WORD") { ReflectivelySetVisibilityFalse(extension); } } RptBLL rptBLL = new RptBLL(); ActivityBLL aBLL = new ActivityBLL(); GuidBLL guidBLL = new GuidBLL(); CommentBLL cBLL = new CommentBLL(); DataTable dtTmp = rptBLL.GetDimensionScore(strGUID); dtTmp.DefaultView.Sort = "DIMCLASSID ASC"; DataTable dimTable = dtTmp.DefaultView.ToTable(); DataTable testerInfoTable = rptBLL.GetTesterInfo(strGUID); DimensionBLL dimbll = new DimensionBLL(); double totalMinutes = rptBLL.GetRefTotalTimeMinute(strGUID); double refMinMinutes = 0; double refMaxMinutes = 0; if (totalMinutes > 12.1) { refMinMinutes = totalMinutes - (double)12.1; } refMaxMinutes = totalMinutes + 12.1; string strREFtime = refMinMinutes.ToString("F1") + " ~ " + refMaxMinutes.ToString("F1"); string shcxxDENGJI = string.Empty; string shcxxPINGDING = string.Empty; string shcxxMIAOSHU = string.Empty; string cxbxPY = string.Empty;//诚信表现评语 int aID = guidBLL.GetActivityId(strGUID); int positionId = aBLL.GetPositionId(aID); Activity a = aBLL.GetModel(aID); int rptSettings = a.Activity_viewreport; bool p5Visible = true; bool p6Visible = true; if (rptSettings != 0 && rptSettings.ToString().Length > 1) { p5Visible = rptSettings.ToString().Substring(5, 1).Equals("1"); p6Visible = rptSettings.ToString().Substring(6, 1).Equals("1"); } ArrayList arGZZT_youshi = new ArrayList();//工作状况_优势 ArrayList arGZZT_lieshi = new ArrayList();//工作状况_劣势 string youshi = string.Empty; string lieshi = string.Empty; StringBuilder sbGZZT = new StringBuilder();//工作状况 StringBuilder sbTZMS = new StringBuilder();//特质描述 StringBuilder sbYRJY = new StringBuilder();//用人建议 StringBuilder sbGRFZ = new StringBuilder();//个人发展 //作答结果是否可信>>>>>>> bool b1 = false;//实际作答时间是否落在参考值区间 bool b2 = false;//社会称许性等级得分大于7.9 bool b3 = false;//作答一致性处于"较高"的等级 //作答结果是否可信<<<<<<< for (int i = 0; i < dimTable.Rows.Count; i++) { int dimID = Int32.Parse(dimTable.Rows[i][0].ToString());//维度ID int dimscore = Int32.Parse(dimTable.Rows[i][2].ToString());//维度原始分 Double dim_s = Double.Parse(dimTable.Rows[i][3].ToString());//维度参考区间开始分 Double dim_e = Double.Parse(dimTable.Rows[i][4].ToString());//维度参考区间结束分 //Double dimQ1 = Double.Parse(dimTable.Rows[i][9].ToString());//Q1 //Double dimQ2 = Double.Parse(dimTable.Rows[i][10].ToString());//Q2 //Double dimQ3 = Double.Parse(dimTable.Rows[i][11].ToString());//Q3 Double p17 = Double.Parse(dimTable.Rows[i][9].ToString()); Double p68 = Double.Parse(dimTable.Rows[i][10].ToString()); Double p92 = Double.Parse(dimTable.Rows[i][11].ToString()); if (dimscore <= p17) { dimTable.Rows[i][8] = "偏低"; } else if (dimscore > p17 && dimscore <= p68) { dimTable.Rows[i][8] = "稍低"; } else if (dimscore > p68 && dimscore < p92) { dimTable.Rows[i][8] = "适配"; } else if (dimscore >= p92) { dimTable.Rows[i][8] = "偏高"; } //维度内判断诚信等级>>>>>>>>>>>>>>>>>>>>>>>>>>>> if (dimTable.Rows[i][1].ToString().Trim().Equals("诚信")) { if (dimscore <= 58.7) { cxbxPY = "有待提高"; } else if (dimscore >= 67.1) { cxbxPY = "比较诚信"; } else if (dimscore > 58.7 && dimscore < 67.1) { cxbxPY = "中等"; } } //维度内判断诚信等级<<<<<<<<<<<<<<<<<<<<<<<<<<<< //获取评语>>>>>>>>>>>>>>>>>>>>>>>>>>>> for (int kk = 1; kk < 5; kk++) { if (dimTable.Rows[i][8].ToString().Trim().Equals("偏低")) { string c = cBLL.GetCommentByAll(positionId, dimID, kk, 4); if (kk == 1) { if (!string.IsNullOrEmpty(c)) { sbTZMS.Append((i + 1).ToString() + "、" + c + Environment.NewLine+Environment.NewLine); } } else if (kk == 2) { if (!string.IsNullOrEmpty(c)) { sbGZZT.Append((i + 1).ToString() + "、" + c + Environment.NewLine+Environment.NewLine); arGZZT_lieshi.Add(c + Environment.NewLine+Environment.NewLine); } } else if (kk == 3) { if (!string.IsNullOrEmpty(c)) { sbYRJY.Append(" * " + c + Environment.NewLine+Environment.NewLine); } } else if (kk == 4) { if (!string.IsNullOrEmpty(c)) { sbGRFZ.Append(" * " + c + Environment.NewLine+Environment.NewLine); } } dimTable.Rows[i][12] = cBLL.GetCommentByAll(positionId, dimID, 1, 4); } else if (dimTable.Rows[i][8].ToString().Trim().Equals("稍低")) { string c = cBLL.GetCommentByAll(positionId, dimID, kk, 3); if (kk == 1) { if (!string.IsNullOrEmpty(c)) { sbTZMS.Append((i + 1).ToString() + "、" + c + Environment.NewLine+Environment.NewLine); } } else if (kk == 2) { if (!string.IsNullOrEmpty(c)) { sbGZZT.Append((i + 1).ToString() + "、" + c + Environment.NewLine+Environment.NewLine); arGZZT_lieshi.Add(c + Environment.NewLine+Environment.NewLine); } } else if (kk == 3) { if (!string.IsNullOrEmpty(c)) { sbYRJY.Append(" * " + c + Environment.NewLine+Environment.NewLine); } } else if (kk == 4) { if (!string.IsNullOrEmpty(c)) { sbGRFZ.Append(" * " + c + Environment.NewLine+Environment.NewLine); } } dimTable.Rows[i][12] = cBLL.GetCommentByAll(positionId, dimID, 1, 3); } else if (dimTable.Rows[i][8].ToString().Trim().Equals("适配")) { string c = cBLL.GetCommentByAll(positionId, dimID, kk, 2); if (kk == 1) { if (!string.IsNullOrEmpty(c)) { sbTZMS.Append((i + 1).ToString() + "、" + c + Environment.NewLine+Environment.NewLine); } } else if (kk == 2) { if (!string.IsNullOrEmpty(c)) { sbGZZT.Append((i + 1).ToString() + "、" + c + Environment.NewLine+Environment.NewLine); arGZZT_youshi.Add(c + Environment.NewLine+Environment.NewLine); } } else if (kk == 3) { if (!string.IsNullOrEmpty(c)) { sbYRJY.Append(" * " + c + Environment.NewLine+Environment.NewLine); } } else if (kk == 4) { if (!string.IsNullOrEmpty(c)) { sbGRFZ.Append(" * " + c + Environment.NewLine+Environment.NewLine); } } dimTable.Rows[i][12] = cBLL.GetCommentByAll(positionId, dimID, 1, 2); } else if (dimTable.Rows[i][8].ToString().Trim().Equals("偏高")) { string c = cBLL.GetCommentByAll(positionId, dimID, kk, 1); if (kk == 1) { if (!string.IsNullOrEmpty(c)) { sbTZMS.Append((i + 1).ToString() + "、" + c + Environment.NewLine+Environment.NewLine); } } else if (kk == 2) { if (!string.IsNullOrEmpty(c)) { sbGZZT.Append((i + 1).ToString() + "、" + c + Environment.NewLine+Environment.NewLine); arGZZT_youshi.Add(c + Environment.NewLine+Environment.NewLine); } } else if (kk == 3) { if (!string.IsNullOrEmpty(c)) { sbYRJY.Append(" * " + c + Environment.NewLine+Environment.NewLine); } } else if (kk == 4) { if (!string.IsNullOrEmpty(c)) { sbGRFZ.Append(" * " + c + Environment.NewLine+Environment.NewLine); } } dimTable.Rows[i][12] = cBLL.GetCommentByAll(positionId, dimID, 1, 1); } } //获取评语<<<<<<<<<<<<<<<<<<<<<<<<<<<< //维度内判断社会称许性等级>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> if (dimTable.Rows[i][1].ToString().Trim().Equals("社会称许性")) { double score = double.Parse(dimTable.Rows[i][2].ToString()); if (score >= 0 && score <= 2.1) { shcxxDENGJI = "较高"; shcxxPINGDING = "倾向偏强"; shcxxMIAOSHU = "他(她)在本次答题时表现出较强的获取赞许的倾向,这种倾向可能是有意识的,也可能是无意识的,不能排除潜意识的影响"; } else if (score >= 2.2 && score <= 4.0) { shcxxDENGJI = "中等"; shcxxPINGDING = "可接受"; shcxxMIAOSHU = "他(她)在本次答题时表现出与大多数人相似的称许性倾向"; } else if (score >= 4.1 && score <= 16.0) { shcxxDENGJI = "较低"; shcxxPINGDING = "可接受"; shcxxMIAOSHU = "他(她)在本次答题中表现出较低的社会称许性倾向,通俗说,比起大多数人,他(她)有点不太在乎别人的评价,能够较客观的进行答题"; if (score > 7.9) { b2 = true; } } } //维度内判断社会称许性等级<<<<<<<<<<<<<<<<<<<<<<<<<<<< //原始分转化为标准分>>>>>>>>>>>>>>>>>>>>>> if (dimTable.Rows[i][5].ToString().Trim().Equals("3"))//智力潜能类 { dimTable.Rows[i][2] = rptBLL.ConvertZhiLiDimScore(dimID, dimscore); dimTable.Rows[i][3] = rptBLL.ConvertZhiLiDimScore(dimID, dim_s); dimTable.Rows[i][4] = rptBLL.ConvertZhiLiDimScore(dimID, dim_e); } else { dimTable.Rows[i][2] = rptBLL.ConvertDimScore(dimID, dimscore); dimTable.Rows[i][3] = rptBLL.ConvertDimScore(dimID, dim_s); dimTable.Rows[i][4] = rptBLL.ConvertDimScore(dimID, dim_e); } //原始分转化为标准分<<<<<<<<<<<<<<<<<<<<<<<<<< } //工作劣势 for (int mm = 0; mm < arGZZT_lieshi.Count; mm++) { lieshi += " " + (mm + 1).ToString() + "、" + arGZZT_lieshi[mm].ToString(); } //工作优势 for (int nn = 0; nn < arGZZT_youshi.Count; nn++) { youshi += " " + (nn + 1).ToString() + "、" + arGZZT_youshi[nn].ToString(); } //作答一致性等级,判定>>>>>>>>>>>>>>>>>> string trustful = string.Empty; string trustfulComments = string.Empty; int nTrustful = Int32.Parse(testerInfoTable.Rows[0][7].ToString()); trustful = (nTrustful == 0) ? "较低" : "较高"; trustfulComments = (nTrustful == 0) ? "他(她)答题时前后心理状态略不稳定,疲劳、环境干扰、心绪波动等均可能导致这种偏误" : "他(她)答题时心理状态基本稳定,此方面导致的测评偏误较小"; if (trustful.Equals("较高")) { b3 = true; } //作答一致性等级,判定<<<<<<<<<<<<<<<<<<< //作答时间,判定>>>>>>>>>>>>>>>>>> TimeSpan ts = DateTime.Parse(testerInfoTable.Rows[0][3].ToString()) - DateTime.Parse(testerInfoTable.Rows[0][2].ToString()); double nRealTime = (ts.TotalSeconds) / (double)60; string answerTimeComments = string.Empty; if (nRealTime <= refMinMinutes) { answerTimeComments = "答题速度过快,有可能是答题过程不够认真或是其他原因,有待进一步了解"; } else if (nRealTime >= refMaxMinutes) { answerTimeComments = "答题速度偏慢,背后原因有待进一步了解"; } else if (nRealTime > refMinMinutes && nRealTime < refMaxMinutes) { b1 = true; answerTimeComments = "答题速度比较适中"; } else { answerTimeComments = string.Empty; } //作答时间,判定<<<<<<<<<<<<<<<<<<<<< //提取智力维度,显示柱状图 rptDataSet ds = new rptDataSet(); for (int j = 0; j < dimTable.Rows.Count; j++) { if (dimTable.Rows[j][5].ToString().Trim().Equals("3"))//智力潜能类 { ds.ZhiliDimScore.AddZhiliDimScoreRow( dimTable.Rows[j][0].ToString().Trim(), dimTable.Rows[j][1].ToString().Trim(), dimTable.Rows[j][2].ToString().Trim()); } } //删除智力维度在维度得分表里。 for (int k = 0; k < dimTable.Rows.Count; k++) { if (dimTable.Rows[k][5].ToString().Trim().Equals("3"))//智力潜能类 { dimTable.Rows[k].Delete(); dimTable.AcceptChanges(); k--; } } //删除三个特殊维度在维度得分表里。 for (int s = 0; s < dimTable.Rows.Count; s++) { if (dimTable.Rows[s][1].ToString().Trim().Equals("社会称许性") || dimTable.Rows[s][1].ToString().Trim().Equals("心理健康度") || dimTable.Rows[s][1].ToString().Trim().Equals("诚信")) { dimTable.Rows[s].Delete(); dimTable.AcceptChanges(); s--; } } string xljk = string.Empty; string xljkLevel = string.Empty; string xljkComnet = string.Empty; xljk = rptBLL.GetXljkLevelAndComments(strGUID);//获取心理健康等级和评语 if (!string.IsNullOrEmpty(xljk)) { int n = xljk.IndexOf("-"); xljkLevel = xljk.Substring(0, n); xljkComnet = xljk.Substring(n + 1, xljk.Length - n - 1); } //数据准备完毕!!! //向报表数据源中插入数据。 ds.Report_ONE.AddReport_ONERow("社会称许性等级", shcxxDENGJI, "社会称许性评定", shcxxPINGDING); ds.Report_ONE.AddReport_ONERow("作答一致性等级", trustful, "测评工具信度", "0.857 ~ 0.949"); ds.Report_ONE.AddReport_ONERow("作答实际时间", ((int)ts.TotalMinutes).ToString()+"分钟", "答题时间参照值", strREFtime + "分钟"); ds.Report_ONE.AddReport_ONERow("答题诚信表现", cxbxPY, "心理健康度状况", xljkLevel); ds.Report_ONE2.AddReport_ONE2Row("社会称许性的相关描述:", " 1、" + shcxxMIAOSHU + ";"); ds.Report_ONE2.AddReport_ONE2Row("做答一致性的相关描述:", " 2、" + trustfulComments + ";"); ds.Report_ONE2.AddReport_ONE2Row("作答时间的相关描述:", " 3、" + answerTimeComments + ";"); ds.Report_ONE2.AddReport_ONE2Row("心理健康的相关描述:", " 4、" + xljkComnet + "。"); ds.zhiweilieshi.AddzhiweilieshiRow(lieshi); ds.zhiweiyoushi.AddzhiweiyoushiRow(youshi); ds.Guanli.AddGuanliRow(sbYRJY.ToString()); ds.Qita.AddQitaRow("其他维度名称"); ds.gerenfazhan.AddgerenfazhanRow(sbGRFZ.ToString()); ReportViewer1.LocalReport.ReportPath = MapPath("Report.rdlc"); ReportDataSource rds0 = new ReportDataSource("DimensionScore", dimTable);//注意这里的name和报表中的一致 ReportDataSource rds1 = new ReportDataSource("TesterInfo", testerInfoTable); ReportDataSource rds2 = new ReportDataSource("Report_ONE", ds.Tables[2]); ReportDataSource rds3 = new ReportDataSource("ZhiliDimScore", ds.Tables[3]); ReportDataSource rds4 = new ReportDataSource("Report_ONE2", ds.Tables[4]); ReportDataSource rds5 = new ReportDataSource("zhiweiyoushi", ds.Tables[5]); ReportDataSource rds6 = new ReportDataSource("zhiweilieshi", ds.Tables[6]); ReportDataSource rds7 = new ReportDataSource("Guanli", ds.Tables[7]); ReportDataSource rds8 = new ReportDataSource("Qita", ds.Tables[8]); ReportDataSource rds9 = new ReportDataSource("gerenfazhan", ds.Tables[9]); ReportParameter rp5Hidden = new ReportParameter("p5Visible", (!p5Visible).ToString()); ReportParameter rp6Hidden = new ReportParameter("p6Visible", (!p6Visible).ToString()); bool b = false; if (b1 == true && b2 == true && b3 == true) { b = true; } ReportParameter rptBelievable = new ReportParameter("rptBelievable", b.ToString()); ReportViewer1.LocalReport.DataSources.Add(rds0); ReportViewer1.LocalReport.DataSources.Add(rds1); ReportViewer1.LocalReport.DataSources.Add(rds2); ReportViewer1.LocalReport.DataSources.Add(rds3); ReportViewer1.LocalReport.DataSources.Add(rds4); ReportViewer1.LocalReport.DataSources.Add(rds5); ReportViewer1.LocalReport.DataSources.Add(rds6); ReportViewer1.LocalReport.DataSources.Add(rds7); ReportViewer1.LocalReport.DataSources.Add(rds8); ReportViewer1.LocalReport.DataSources.Add(rds9); ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp5Hidden, rp6Hidden }); ReportViewer1.LocalReport.Refresh(); } } } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { int rowIndex = Int32.Parse(e.CommandArgument.ToString());//获取点击了第几行 int posID = Int32.Parse(grVPositionManage.DataKeys[rowIndex].Values[0].ToString()); if (e.CommandName == "DimSetting") { Response.Redirect("~/System/DimensionSet.aspx?mode=0&posid=" + posID.ToString()); } if (e.CommandName.Equals("Export") || e.CommandName.Equals("ExportNewData"))//答题信息导出 or 数据导出 { PositionBLL temp = new PositionBLL(); DimensionBLL dBll = new DimensionBLL(); DataSet dimDS = dBll.GetDimensionAll(); DataSet dsAll = new DataSet(); for (int i = 0; i < dimDS.Tables[0].Rows.Count; i++) { int dimID = Int32.Parse(dimDS.Tables[0].Rows[i][0].ToString()); DataSet dsa = temp.GetExportDSIncAllDim(posID,dimID); dsa.Tables[0].TableName = dBll.GetDimension(dimID.ToString()).Dimnm; dsAll.Tables.Add(dsa.Tables[0].Copy()); } //2012.3.14,岗位导出时删除无关维度表 begin. for (int i = dsAll.Tables.Count - 1; i >= 0; i--) { if (dsAll.Tables[i].Rows.Count < 1) { dsAll.Tables.Remove(dsAll.Tables[i]); } } dsAll.AcceptChanges(); //2012.3.14,岗位导出时删除无关维度表 end. //新的导出格式---数据导出 DataSet dsPivot = new DataSet(); if (e.CommandName.Equals("ExportNewData")) { //开始进行pivot string activityName = string.Empty; string testerName = string.Empty; TesterInfoBLL tbll = new TesterInfoBLL(); ActivityBLL abll = new ActivityBLL(); GuidBLL gbll = new GuidBLL(); foreach (DataTable t in dsAll.Tables) { Pivot p = new Pivot(t); DataTable dt = p.PivotData("序列号", "原始得分", AggregateFunction.Sum, "题目编号"); p = null; dt.TableName = t.TableName; dt.Columns.Add("项目名称").SetOrdinal(0); dt.Columns.Add("姓名").SetOrdinal(1); foreach (DataRow row in dt.Rows) { string guid = row["序列号"].ToString(); row["项目名称"] = abll.GetActivityNM(gbll.GetActivityId(guid)); row["姓名"] = tbll.GetUserNameByGUID(guid); } dsPivot.Tables.Add(dt); } //pivot结束 } string filePath = Server.MapPath("../userfiles") + @"\position_" + DateTime.Now.ToString("yyyyMMdd_HH_mm_ss") + ".xls"; string fileName = Path.GetFileName(filePath); if (e.CommandName.Equals("Export"))//原始格式--答题信息导出 { //2013.10.22 add by conghui for export issue begin. foreach (DataTable dt in dsAll.Tables) { for (int i = 0; i < dt.Columns.Count; i++) { for (int j = 0; j < dt.Rows.Count; j++) { if (dt.Rows[j][i] == DBNull.Value || dt.Rows[j][i] == null)//如果单元格为空 { if (i == 2)//第二列是日期列 { dt.Rows[j][i] = "1900-1-1"; } else { dt.Rows[j][i] = ""; } } else//单元格非空 { if (i == 2)//将日期强制转化为字符串 { dt.Rows[j][i] = dt.Rows[j][i].ToString(); } } } } } //2013.10.22 add by conghui for export issue end. ExcelLibrary.DataSetHelper.CreateWorkbook(filePath, dsAll); } else if (e.CommandName.Equals("ExportNewData"))//新的格式--答题数据导出 { ExcelLibrary.DataSetHelper.CreateWorkbook(filePath, dsPivot); } Stream stream = null; stream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read); long bytesToRead = stream.Length; Response.Clear(); Response.ContentType = "application/ms-excel"; Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName); while (bytesToRead > 0) { if (Response.IsClientConnected) { byte[] buffer = new Byte[10000]; int length = stream.Read(buffer, 0, 10000); Response.OutputStream.Write(buffer, 0, length); Response.Flush(); bytesToRead = bytesToRead - length; } else { bytesToRead = -1; } } } }
private void bind() { DimensionBLL dimensionBll = new DimensionBLL(); DataSet dsPosition = dimensionBll.GetDimensionAll(); ddlDeminsion.DataSource = dsPosition.Tables[0].DefaultView; ddlDeminsion.DataTextField = "dimension_name"; ddlDeminsion.DataValueField = "dimension_id"; ddlDeminsion.DataBind(); if (Request.QueryString["dimID"] != null) { if (!string.IsNullOrEmpty(Request.QueryString["dimID"])) { ddlDeminsion.SelectedValue = Request.QueryString["dimID"]; } } }
private bool ImportComment(string xlsFileNm) { try { if (!File.Exists(xlsFileNm)) return false; int posID = Int32.Parse(ddlPosition.SelectedItem.Value); Workbook book = Workbook.Load(xlsFileNm); PositionBLL posBLL = new PositionBLL(); DimensionBLL dimBLL = new DimensionBLL(); CommentBLL comBLL = new CommentBLL(); Comment com = new Comment(); DataSet dimDS = dimBLL.GetDimensionAll(); DataSet posDS = posBLL.GetPositionAll(string.Empty); comBLL.DelAllComment(posID);//删除与此岗位相关的所有评语。 foreach (Worksheet sheet in book.Worksheets) { string sheetNm = sheet.Name.Trim(); int dimID = -1;//在这里加断点可以监视单个维度的导入情况 foreach (DataRow row in dimDS.Tables[0].Rows) { if (row["dimension_name"].ToString().Equals(sheetNm)) { dimID = Int32.Parse(row["dimension_id"].ToString().Trim()); break; } } for (int rowIndex = sheet.Cells.FirstRowIndex + 1;//忽略第一行(标题行) rowIndex <= sheet.Cells.LastRowIndex; rowIndex++) { Row row = sheet.Cells.GetRow(rowIndex); com.Posion_id = posID; com.Dimension_id = dimID; string score_region = row.GetCell(0).StringValue.Trim(); if (score_region.Equals("偏高")) { com.Region_id = 1; } else if (score_region.Equals("适配")) { com.Region_id = 2; } else if (score_region.Equals("稍低")) { com.Region_id = 3; } else if (score_region.Equals("偏低")) { com.Region_id = 4; } for (int i = 1; i < sheet.Cells.LastColIndex + 1; i++) { com.Report_part_id = i; com.Comment_nm = row.GetCell(i).StringValue.Trim(); comBLL.Add(com); } } } return true; } catch (Exception ex) { MessageBox.Show(ex.Message); return false; } }
protected void btnSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtbActivityenterpriseuid.Text)) { MessageBox.Show("请先选择一个企业用户,然后再添加相应的项目."); return; } if (string.IsNullOrEmpty(txtbActivity.Text.Trim())) { MessageBox.ShowAndRedirect(this, "测评项目添加失败,请输入正确的活动名称!", "ActivityList.aspx?users_id=" + txtbActivityenterpriseuid.Text + "&users_name=" + lblEnterpriseName.Text + "&users_incname=" + lblEnterpriseFull.Text); return; } ActivityBLL activityBll = new ActivityBLL(); Activity temp = new Activity(); temp.Activity_enterpriseuid = int.Parse(txtbActivityenterpriseuid.Text); temp.Activity_name = txtbActivity.Text; temp.Activity_positionid = int.Parse(ddlPosition.SelectedValue); temp.Activity_status = 1; DateTime dtCreateTime = DateTime.Now; temp.Activity_createtime = dtCreateTime; //temp.Activity_holdtime = DBNull.Value ; temp.Activity_welcometext = "欢迎您参加 【公司名】 测评!"; temp.Activity_companyintrotext = "XXX集团是经销奔驰、别克、凯迪拉克等多种品牌的集团经销商,资金雄厚,管理规范,是有志之士职业成长的平台"; temp.Activity_content = "本次招聘活动希望通过科学的测评广纳人才,为新开设的多家经销店输入适合招聘岗位的新鲜血液"; temp.Activity_viewreport = 2111111;//新建测评活动时,默认不允许用户查看报表 int nAddResult = activityBll.Add(temp); if (nAddResult != -1) { Activity activity = activityBll.GetModel(nAddResult); if (activity != null) { int activityID = nAddResult; //添加活动时,根据岗位设置相应的默认维度>>>>>>>>>>>>>>>>>开始 int posID = int.Parse(ddlPosition.SelectedValue); DimensionBLL dimBll = new DimensionBLL(); DataSet dimDS = dimBll.GetDefaultDimensionByPosID(posID.ToString()); if (dimDS != null && dimDS.Tables[0].Rows.Count > 0) { for (int i = 0; i < dimDS.Tables[0].Rows.Count; i++) { string dimNM = dimDS.Tables[0].Rows[i]["dimension_name"].ToString().Trim(); if (dimNM.Equals("社会称许性") || dimNM.Equals("心理健康度") || dimNM.Equals("诚信")) { int rows = dimBll.SetActivityDimension(activityID, Int32.Parse(dimDS.Tables[0].Rows[i][0].ToString()), 0);//三个特殊维度权重为0 } else { int rows = dimBll.SetActivityDimension(activityID, Int32.Parse(dimDS.Tables[0].Rows[i][0].ToString()), (float)1.0 / (dimDS.Tables[0].Rows.Count - 3));//减去3个特殊维度后,取平均值。 } } } //添加活动时,根据岗位设置相应的默认维度<<<<<<<<<<<<<<<<<结束 MessageBox.ShowAndRedirect(this, "测评项目添加成功!", "ActivityList.aspx?users_id=" + txtbActivityenterpriseuid.Text + "&users_name=" + lblEnterpriseName.Text + "&users_incname=" + lblEnterpriseFull.Text); } else { System.Diagnostics.Debug.Assert(false); } } else { //Todo: MessageBox.ShowAndRedirect(this, "测评项目添加失败!", "ActivityList.aspx?users_id=" + txtbActivityenterpriseuid.Text + "&users_name=" + lblEnterpriseName.Text + "&users_incname=" + lblEnterpriseFull.Text); } }
protected void Page_Load(object sender, EventArgs e) { ((SiteSystemMaster)Master).InitMenu(); ((SiteSystemMaster)Master).li3.Attributes.Add("class", "hover ccc"); ((SiteSystemMaster)Master).b_hmenu1.Style.Add("display", "none"); ((SiteSystemMaster)Master).b_hmenu2.Style.Add("display", "none"); ((SiteSystemMaster)Master).b_hmenu3.Style.Clear(); ((SiteSystemMaster)Master).s_menu3_1.Style.Add("COLOR", "#147ab8"); ((SiteSystemMaster)Master).s_menu3_1.Style.Add("TEXT-DECORATION", "none"); /*判断是否是管理员身份*/ if (Session["username"] == null) { Page.ClientScript.RegisterStartupScript(this.GetType(), "PopupScript", "<script>alert('请先登录系统!');top.location.href='../System/Login.aspx';</script>"); return; } else { if (!IsPostBack) { DimensionBLL dimensionBll = new DimensionBLL(); DataSet ds = dimensionBll.GetDimensionClass(); ddlType.DataSource = ds.Tables[0].DefaultView; ddlType.DataTextField = "dimension_class_nm"; ddlType.DataValueField = "dimension_class_id"; ddlType.DataBind(); dimension_id = Request.QueryString["dimension_id"]; if (!string.IsNullOrEmpty(dimension_id)) { Dimension di = dimensionBll.GetDimension(dimension_id); txtbDimnm.Text = di.Dimnm; txtbDescrip.Text = di.Dimension_descrip; ddlType.SelectedValue = di.Dimension_classid.ToString(); txtbTime.Text = (di.Time_min).ToString(); txtbQ1.Text = di.Sinterval.ToString(); txtbQ2.Text = di.Minterval.ToString(); txtbQ3.Text = di.Linterval.ToString(); txtb2.Text = di.Dimension_2.ToString(); txtb8.Text = di.Dimension_8.ToString(); txtb17.Text = di.Dimension_17.ToString(); txtb32.Text = di.Dimension_32.ToString(); txtb50.Text = di.Dimension_50.ToString(); txtb68.Text = di.Dimension_68.ToString(); txtb83.Text = di.Dimension_83.ToString(); txtb92.Text = di.Dimension_92.ToString(); txtb98.Text = di.Dimension_98.ToString(); txtXiaXianTime.Text = di.Time_xiaxian.ToString(); txtShangXianTime.Text = di.Time_shangxian.ToString(); } } } }
private void bind() { DimensionBLL dimensionBll = new DimensionBLL(); DataSet dsPosition = dimensionBll.GetDimensionAll(); ddlDimension.DataSource = dsPosition.Tables[0].DefaultView; ddlDimension.DataValueField = "dimension_id"; ddlDimension.DataTextField = "dimension_name"; ddlDimension.DataBind(); if (Request.QueryString["dimID"] != null) { ddlDimension.SelectedValue = Request.QueryString["dimID"]; } QuestionBLL quesitionBll = new QuestionBLL(); DataSet ds = quesitionBll.GetQuestionByDimension(ddlDimension.SelectedValue); grVQuestionManage.DataSource = ds.Tables[0].DefaultView; grVQuestionManage.DataSourceID = null; grVQuestionManage.DataBind(); quesitionBll = null; dimensionBll = null; }
private bool ImportQuestion(string xlsFileNm) { try { xlsFileNm = @"E:\Project\svn_all\exam-report\需求文档\功能调试版题库(维度仍旧在增加).xls"; if (!File.Exists(xlsFileNm)) return false; Workbook book = Workbook.Load(xlsFileNm); //Worksheet sheet = book.Worksheets[0]; DimensionBLL dimBLL = new DimensionBLL(); QuestionBLL qesBLL = new QuestionBLL(); Question question = new Question(); DataSet dimDS = dimBLL.GetDimensionAll(); foreach (Worksheet sheet in book.Worksheets) { if (sheet.Name.Trim().Equals("说明")) { continue; } string sheetNm = sheet.Name.Trim(); int dimID = -1;//在这里加断点可以监视单个维度的导入情况 foreach (DataRow row in dimDS.Tables[0].Rows) { if (row["dimension_name"].ToString().Equals(sheetNm)) { dimID = Int32.Parse(row["dimension_id"].ToString().Trim()); break; } } for (int rowIndex = sheet.Cells.FirstRowIndex + 2;//忽略第一行(标题行) rowIndex <= sheet.Cells.LastRowIndex; rowIndex++) { Row row = sheet.Cells.GetRow(rowIndex); question.Question_no = Int32.Parse(row.GetCell(0).StringValue.Trim()); question.Question_title = row.GetCell(5).StringValue.Trim(); question.Question_answer_A = row.GetCell(6).StringValue.Trim(); question.Question_answer_B = row.GetCell(7).StringValue.Trim(); question.Question_answer_C = row.GetCell(8).StringValue.Trim(); question.Question_answer_D = row.GetCell(9).StringValue.Trim(); question.Question_answer_E = row.GetCell(10).StringValue.Trim(); question.Question_answer_A_score = row.GetCell(11).StringValue.Trim().Equals(string.Empty) ? 0 : Int32.Parse(row.GetCell(11).StringValue.Trim()); question.Question_answer_B_score = row.GetCell(12).StringValue.Trim().Equals(string.Empty) ? 0 : Int32.Parse(row.GetCell(12).StringValue.Trim()); question.Question_answer_C_score = row.GetCell(13).StringValue.Trim().Equals(string.Empty) ? 0 : Int32.Parse(row.GetCell(13).StringValue.Trim()); question.Question_answer_D_score = row.GetCell(14).StringValue.Trim().Equals(string.Empty) ? 0 : Int32.Parse(row.GetCell(14).StringValue.Trim()); question.Question_answer_E_score = row.GetCell(15).StringValue.Trim().Equals(string.Empty) ? 0 : Int32.Parse(row.GetCell(15).StringValue.Trim()); question.Question_typeid = 1;//1 单选 question.Question_status = 1;//1 有效 if (dimID > 0) { question.Question_dimensionid = dimID; } else { MessageBox.Show("Error"); return false; } qesBLL.Add(question); } } MessageBox.Show("题目导入成功"); return true; } catch (Exception ex) { MessageBox.Show(ex.Message); return false; } }
private bool ImportDimension(string xlsFileNm) { try { if (!File.Exists(xlsFileNm)) return false; Workbook book = Workbook.Load(xlsFileNm); Worksheet sheet = book.Worksheets[0]; DimensionBLL dimBll = new DimensionBLL(); Dimension dimModel = new Dimension(); // traverse rows by Index for (int rowIndex = sheet.Cells.FirstRowIndex + 1;//忽略第一行(标题行) rowIndex <= sheet.Cells.LastRowIndex; rowIndex++) { Row row = sheet.Cells.GetRow(rowIndex); dimModel.Dimnm = row.GetCell(1).StringValue; dimModel.Dimension_descrip = row.GetCell(2).StringValue; switch (row.GetCell(3).StringValue) { case "职业能力/技能类": dimModel.Dimension_classid = 1; break; case "职业行为风格类": dimModel.Dimension_classid = 2; break; case "职业智力/潜能类": dimModel.Dimension_classid = 3; break; case "职业态度/动机类": dimModel.Dimension_classid = 4; break; case "质量检测类": dimModel.Dimension_classid = 5; break; case "职业心理基础类": dimModel.Dimension_classid = 6; break; default: break; } dimModel.Time_min = (int)float.Parse(row.GetCell(4).StringValue) ; dimModel.Sinterval = (int)float.Parse(row.GetCell(5).StringValue); dimModel.Minterval = (int)float.Parse(row.GetCell(6).StringValue); dimModel.Linterval = (int)float.Parse(row.GetCell(7).StringValue); dimModel.Dimension_2 = float.Parse(row.GetCell(8).StringValue); dimModel.Dimension_8 = float.Parse(row.GetCell(9).StringValue); dimModel.Dimension_17 = float.Parse(row.GetCell(10).StringValue); dimModel.Dimension_32 = float.Parse(row.GetCell(11).StringValue); dimModel.Dimension_50 = float.Parse(row.GetCell(12).StringValue); dimModel.Dimension_68 = float.Parse(row.GetCell(13).StringValue); dimModel.Dimension_83 = float.Parse(row.GetCell(14).StringValue); dimModel.Dimension_92 = float.Parse(row.GetCell(15).StringValue); dimModel.Dimension_98 = float.Parse(row.GetCell(16).StringValue); dimBll.Add(dimModel); } return true; } catch (Exception ex) { MessageBox.Show(ex.Message); return false; } }
private bool ImportQuestion(string xlsFileNm,ArrayList arDimID) { try { if (!File.Exists(xlsFileNm)) return false; Workbook book = Workbook.Load(xlsFileNm); DimensionBLL dimBLL = new DimensionBLL(); QuestionBLL qesBLL = new QuestionBLL(); Question question = new Question(); DataSet dimDS = dimBLL.GetDimensionAll(); //qesBLL.DeleteAllQuestion(); for (int k = 0; k < arDimID.Count; k++) { qesBLL.DeleteQuestionByDim(Int32.Parse(arDimID[k].ToString())); } string dName = string.Empty; for (int i = 0; i < arDimID.Count; i++) { dName = dimBLL.GetDimension(arDimID[i].ToString()).Dimnm; foreach (Worksheet sheet in book.Worksheets) { string sheetNm = sheet.Name.Trim(); if (sheetNm.Equals("说明")) { continue; } if (false == sheetNm.Equals(dName)) { continue; } int dimID = -1;//在这里加断点可以监视单个维度的导入情况 foreach (DataRow row in dimDS.Tables[0].Rows) { if (row["dimension_name"].ToString().Equals(sheetNm)) { dimID = Int32.Parse(row["dimension_id"].ToString().Trim()); break; } } if (dimID < 1) { string msg = "Excel工作表中存在的[" + sheet.Name + "]维度在系统维度表中不存在!" + Environment.NewLine + "请先确保Excel工作表中的维度名称在系统中存在,然后再执行导入操作"; //Response.Write("<script>...alert('" + msg + "')</script>"); MessageBox.ShowMessage(msg); continue; } for (int rowIndex = sheet.Cells.FirstRowIndex + 2;//忽略第一行(标题行) rowIndex <= sheet.Cells.LastRowIndex; rowIndex++) { Row row = sheet.Cells.GetRow(rowIndex); question.Question_no = Int32.Parse(row.GetCell(0).StringValue.Trim()); question.Question_title = row.GetCell(5).StringValue.Trim(); question.Question_answer_A = row.GetCell(6).StringValue.Trim(); question.Question_answer_B = row.GetCell(7).StringValue.Trim(); question.Question_answer_C = row.GetCell(8).StringValue.Trim(); question.Question_answer_D = row.GetCell(9).StringValue.Trim(); question.Question_answer_E = row.GetCell(10).StringValue.Trim(); question.Question_answer_A_score = row.GetCell(11).StringValue.Trim().Equals(string.Empty) ? 0 : Int32.Parse(row.GetCell(11).StringValue.Trim()); question.Question_answer_B_score = row.GetCell(12).StringValue.Trim().Equals(string.Empty) ? 0 : Int32.Parse(row.GetCell(12).StringValue.Trim()); question.Question_answer_C_score = row.GetCell(13).StringValue.Trim().Equals(string.Empty) ? 0 : Int32.Parse(row.GetCell(13).StringValue.Trim()); question.Question_answer_D_score = row.GetCell(14).StringValue.Trim().Equals(string.Empty) ? 0 : Int32.Parse(row.GetCell(14).StringValue.Trim()); question.Question_answer_E_score = row.GetCell(15).StringValue.Trim().Equals(string.Empty) ? 0 : Int32.Parse(row.GetCell(15).StringValue.Trim()); question.Question_typeid = 1;//1 单选 question.Question_status = 1;//1 有效 if (dimID > 0) { question.Question_dimensionid = dimID; } else { break; } qesBLL.Add(question); } } } return true; } catch (Exception ex) { string errMsg = ex.Message; return false; } }
protected void Page_Load(object sender, EventArgs e) { ((SiteSystemMaster)Master).InitMenu(); ((SiteSystemMaster)Master).li3.Attributes.Add("class", "hover ccc"); ((SiteSystemMaster)Master).b_hmenu1.Style.Add("display", "none"); ((SiteSystemMaster)Master).b_hmenu2.Style.Add("display", "none"); ((SiteSystemMaster)Master).b_hmenu3.Style.Clear(); ((SiteSystemMaster)Master).s_menu3_1.Style.Add("COLOR", "#147ab8"); ((SiteSystemMaster)Master).s_menu3_1.Style.Add("TEXT-DECORATION", "none"); /*判断是否是管理员身份*/ if (Session["username"] == null) { Page.ClientScript.RegisterStartupScript(this.GetType(), "PopupScript", "<script>alert('请先登录系统!');top.location.href='../System/Login.aspx';</script>"); return; } else { if (!IsPostBack) { DimensionBLL temp = new DimensionBLL(); DataSet ds = temp.GetDimensionAll(); grVDimensionManage.DataSource = ds.Tables[0].DefaultView; grVDimensionManage.DataSourceID = null; grVDimensionManage.DataBind(); temp = null; } this.btnImport.Attributes.Add("onclick", "return CheckConfirm();"); } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { int rowIndex = Int32.Parse(e.CommandArgument.ToString());//获取点击了第几行 int dimension_id = 0; ArrayList arUNSelList = new ArrayList(); if (e.CommandName == "Export") { //导出到Excel DimensionBLL temp = new DimensionBLL(); DataSet ds = temp.GetDimensionAllReport(); //记录没有选中的维度 for(int i=0; i< ds.Tables[0].Rows.Count;i++) { dimension_id = Int32.Parse(ds.Tables[0].Rows[i][0].ToString()); foreach (GridViewRow gr in grVDimensionManage.Rows) { if (int.Parse(grVDimensionManage.DataKeys[gr.RowIndex].Values[0].ToString().Trim()) == dimension_id) { CheckBox chk = (CheckBox)gr.Cells[0].FindControl("CB_Select"); if (false == chk.Checked) { arUNSelList.Add(dimension_id); break; } } } } //删除没有选中的维度 for (int j = 0; j < arUNSelList.Count; j++) { deleteDataRow(arUNSelList[j].ToString(), ds.Tables[0]); } //开始导出 //ds.Tables[0].Columns.Add("最后修改时间", Type.GetType("System.DateTime")); //ds.Tables[0].Columns["最后修改时间"].SetOrdinal(8); string filePath = Server.MapPath("../userfiles") + @"\dimension_" + DateTime.Now.ToString("yyyyMMdd_HH_mm_ss") + ".xls"; string fileName = Path.GetFileName(filePath); ExcelLibrary.DataSetHelper.CreateWorkbook(filePath, ds); Stream stream = null; stream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read); long bytesToRead = stream.Length; Response.Clear(); Response.ContentType = "application/ms-excel"; Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName); while (bytesToRead > 0) { if (Response.IsClientConnected) { byte[] buffer = new Byte[10000]; int length = stream.Read(buffer, 0, 10000); Response.OutputStream.Write(buffer, 0, length); Response.Flush(); bytesToRead = bytesToRead - length; } else { bytesToRead = -1; } } } }
protected void GridView1_Index(object sender,GridViewPageEventArgs e) { grVDimensionManage.PageIndex = e.NewPageIndex; DimensionBLL temp = new DimensionBLL(); DataSet ds = temp.GetDimensionAll(); grVDimensionManage.DataSource = ds.Tables[0].DefaultView; grVDimensionManage.DataSourceID = null; grVDimensionManage.DataBind(); temp = null; }
private void GenPDFReport(string strGUID) { try { #region 业务逻辑处理开始 RptBLL rptBLL = new RptBLL(); ActivityBLL aBLL = new ActivityBLL(); GuidBLL guidBLL = new GuidBLL(); CommentBLL cBLL = new CommentBLL(); DataTable dtTmp = rptBLL.GetDimensionScore(strGUID); dtTmp.DefaultView.Sort = "DIMCLASSID ASC"; DataTable dimTable = dtTmp.DefaultView.ToTable(); DataTable testerInfoTable = rptBLL.GetTesterInfo(strGUID); DimensionBLL dimbll = new DimensionBLL(); //double totalMinutes = rptBLL.GetRefTotalTimeMinute(strGUID); double refMinMinutes = 0; double refMaxMinutes = 0; //if (totalMinutes > 12.1) //{ // refMinMinutes = totalMinutes - (double)12.1; //} //refMaxMinutes = totalMinutes + 12.1; refMinMinutes = rptBLL.GetRefTotalTimeMinute_xiaxian(strGUID); refMaxMinutes = rptBLL.GetRefTotalTimeMinute_shangxian(strGUID); string strREFtime = refMinMinutes.ToString("F1") + " ~ " + refMaxMinutes.ToString("F1"); string shcxxDENGJI = string.Empty; string shcxxPINGDING = string.Empty; string shcxxMIAOSHU = string.Empty; string cxbxPY = string.Empty;//诚信表现评语 string usrNm = testerInfoTable.Rows[0]["testerNAME"].ToString(); string posNm = testerInfoTable.Rows[0]["testerPOSITION"].ToString(); int aID = guidBLL.GetActivityId(strGUID); int positionId = aBLL.GetPositionId(aID); Activity a = aBLL.GetModel(aID); int rptSettings = a.Activity_viewreport; bool p5Visible = true; bool p6Visible = true; if (rptSettings != 0 && rptSettings.ToString().Length > 1) { p5Visible = rptSettings.ToString().Substring(5, 1).Equals("1"); p6Visible = rptSettings.ToString().Substring(6, 1).Equals("1"); } ArrayList arGZZT_youshi = new ArrayList();//工作状况_优势 ArrayList arGZZT_lieshi = new ArrayList();//工作状况_劣势 string youshi = string.Empty; string lieshi = string.Empty; bool bAllDimIsLow = false;//所有维度偏低 bool bAllDimIsHigh = false;//所有维度偏高 StringBuilder sbGZZT = new StringBuilder();//工作状况 StringBuilder sbTZMS = new StringBuilder();//特质描述 StringBuilder sbYRJY = new StringBuilder();//用人建议 StringBuilder sbGRFZ = new StringBuilder();//个人发展 //作答结果是否可信>>>>>>> bool b1 = false;//实际作答时间是否落在参考值区间 bool b2 = false;//社会称许性等级得分大于7.9 bool b3 = false;//作答一致性处于"较高"的等级 //作答结果是否可信<<<<<<< for (int i = 0; i < dimTable.Rows.Count; i++) { int dimID = Int32.Parse(dimTable.Rows[i][0].ToString());//维度ID int dimscore = Int32.Parse(dimTable.Rows[i][2].ToString());//维度原始分 Double dim_s = Double.Parse(dimTable.Rows[i][3].ToString());//维度参考区间开始分 Double dim_e = Double.Parse(dimTable.Rows[i][4].ToString());//维度参考区间结束分 //Double dimQ1 = Double.Parse(dimTable.Rows[i][9].ToString());//Q1 //Double dimQ2 = Double.Parse(dimTable.Rows[i][10].ToString());//Q2 //Double dimQ3 = Double.Parse(dimTable.Rows[i][11].ToString());//Q3 Double p17 = Double.Parse(dimTable.Rows[i][9].ToString()); Double p68 = Double.Parse(dimTable.Rows[i][10].ToString()); Double p92 = Double.Parse(dimTable.Rows[i][11].ToString()); if (dimscore <= p17) { dimTable.Rows[i][8] = "偏低"; } else if (dimscore > p17 && dimscore <= p68) { dimTable.Rows[i][8] = "稍低"; } else if (dimscore > p68 && dimscore < p92) { dimTable.Rows[i][8] = "适配"; } else if (dimscore >= p92) { dimTable.Rows[i][8] = "偏高"; } //维度内判断诚信等级>>>>>>>>>>>>>>>>>>>>>>>>>>>> if (dimTable.Rows[i][1].ToString().Trim().Equals("诚信")) { if (dimscore <= 59.5) { cxbxPY = "有待提高"; } else if (dimscore >= 73.5) { cxbxPY = "比较诚信"; } else if (dimscore > 59.5 && dimscore < 73.5) { cxbxPY = "中等"; } } //维度内判断诚信等级<<<<<<<<<<<<<<<<<<<<<<<<<<<< //获取评语>>>>>>>>>>>>>>>>>>>>>>>>>>>> for (int kk = 1; kk < 5; kk++) { if (dimTable.Rows[i][8].ToString().Trim().Equals("偏低")) { string c = cBLL.GetCommentByAll(positionId, dimID, kk, 4); if (kk == 1) { if (!string.IsNullOrEmpty(c)) { sbTZMS.Append((i + 1).ToString() + "、" + c + Environment.NewLine); } } else if (kk == 2) { if (!string.IsNullOrEmpty(c)) { sbGZZT.Append((i + 1).ToString() + "、" + c + Environment.NewLine); arGZZT_lieshi.Add(c + Environment.NewLine); } } else if (kk == 3) { if (!string.IsNullOrEmpty(c)) { sbYRJY.Append(" * " + c + Environment.NewLine); } } else if (kk == 4) { if (!string.IsNullOrEmpty(c)) { sbGRFZ.Append(" * " + c + Environment.NewLine); } } dimTable.Rows[i][12] = cBLL.GetCommentByAll(positionId, dimID, 1, 4); } else if (dimTable.Rows[i][8].ToString().Trim().Equals("稍低")) { string c = cBLL.GetCommentByAll(positionId, dimID, kk, 3); if (kk == 1) { if (!string.IsNullOrEmpty(c)) { sbTZMS.Append((i + 1).ToString() + "、" + c + Environment.NewLine); } } else if (kk == 2) { if (!string.IsNullOrEmpty(c)) { sbGZZT.Append((i + 1).ToString() + "、" + c + Environment.NewLine); arGZZT_lieshi.Add(c + Environment.NewLine); } } else if (kk == 3) { if (!string.IsNullOrEmpty(c)) { sbYRJY.Append(" * " + c + Environment.NewLine); } } else if (kk == 4) { if (!string.IsNullOrEmpty(c)) { sbGRFZ.Append(" * " + c + Environment.NewLine); } } dimTable.Rows[i][12] = cBLL.GetCommentByAll(positionId, dimID, 1, 3); } else if (dimTable.Rows[i][8].ToString().Trim().Equals("适配")) { string c = cBLL.GetCommentByAll(positionId, dimID, kk, 2); if (kk == 1) { if (!string.IsNullOrEmpty(c)) { sbTZMS.Append((i + 1).ToString() + "、" + c + Environment.NewLine); } } else if (kk == 2) { if (!string.IsNullOrEmpty(c)) { sbGZZT.Append((i + 1).ToString() + "、" + c + Environment.NewLine); arGZZT_youshi.Add(c + Environment.NewLine); } } else if (kk == 3) { if (!string.IsNullOrEmpty(c)) { sbYRJY.Append(" * " + c + Environment.NewLine); } } else if (kk == 4) { if (!string.IsNullOrEmpty(c)) { sbGRFZ.Append(" * " + c + Environment.NewLine); } } dimTable.Rows[i][12] = cBLL.GetCommentByAll(positionId, dimID, 1, 2); } else if (dimTable.Rows[i][8].ToString().Trim().Equals("偏高")) { string c = cBLL.GetCommentByAll(positionId, dimID, kk, 1); if (kk == 1) { if (!string.IsNullOrEmpty(c)) { sbTZMS.Append((i + 1).ToString() + "、" + c + Environment.NewLine); } } else if (kk == 2) { if (!string.IsNullOrEmpty(c)) { sbGZZT.Append((i + 1).ToString() + "、" + c + Environment.NewLine); arGZZT_youshi.Add(c + Environment.NewLine); } } else if (kk == 3) { if (!string.IsNullOrEmpty(c)) { sbYRJY.Append(" * " + c + Environment.NewLine); } } else if (kk == 4) { if (!string.IsNullOrEmpty(c)) { sbGRFZ.Append(" * " + c + Environment.NewLine); } } dimTable.Rows[i][12] = cBLL.GetCommentByAll(positionId, dimID, 1, 1); } } //获取评语<<<<<<<<<<<<<<<<<<<<<<<<<<<< //维度内判断社会称许性等级>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> if (dimTable.Rows[i][1].ToString().Trim().Equals("社会称许性")) { double score = double.Parse(dimTable.Rows[i][2].ToString()); if (score >= 0 && score <= 0.9) { shcxxDENGJI = "较高"; shcxxPINGDING = "倾向偏强"; shcxxMIAOSHU = "他(她)在本次答题时表现出较强的获取赞许的倾向,这种倾向可能是有意识的,也可能是无意识的,不能排除潜意识的影响"; } else if (score >= 1.0 && score <= 4.0) { shcxxDENGJI = "中等"; shcxxPINGDING = "可接受"; shcxxMIAOSHU = "他(她)在本次答题时表现出与大多数人相似的称许性倾向"; //社会称许性取中间等级(社会称许性既不偏高,也不偏低时)显示比较可信,偏高偏低都需要进一步测评。 b2 = true; } else if (score >= 4.1 && score <= 16.0) { shcxxDENGJI = "较低"; shcxxPINGDING = "可接受"; shcxxMIAOSHU = "他(她)在本次答题中表现出较低的社会称许性倾向,通俗说,比起大多数人,他(她)有点不太在乎别人的评价,能够较客观的进行答题"; } } //维度内判断社会称许性等级<<<<<<<<<<<<<<<<<<<<<<<<<<<< //原始分转化为标准分>>>>>>>>>>>>>>>>>>>>>> if (dimTable.Rows[i][5].ToString().Trim().Equals("3"))//智力潜能类 { dimTable.Rows[i][2] = rptBLL.ConvertZhiLiDimScore(dimID, dimscore); dimTable.Rows[i][3] = rptBLL.ConvertZhiLiDimScore(dimID, dim_s); dimTable.Rows[i][4] = rptBLL.ConvertZhiLiDimScore(dimID, dim_e); } else { dimTable.Rows[i][2] = rptBLL.ConvertDimScore(dimID, dimscore); dimTable.Rows[i][3] = rptBLL.ConvertDimScore(dimID, dim_s); dimTable.Rows[i][4] = rptBLL.ConvertDimScore(dimID, dim_e); } //原始分转化为标准分<<<<<<<<<<<<<<<<<<<<<<<<<< } //查看所有维度是否均较低 2012.3.18 string dimRes = string.Empty; for (int kj = 0; kj < dimTable.Rows.Count; kj++) { if (false == dimTable.Rows[kj]["DIMCLASSID"].ToString().Trim().Equals("3")&& false == dimTable.Rows[kj]["DIMNM"].ToString().Trim().Equals("社会称许性") && false == dimTable.Rows[kj]["DIMNM"].ToString().Trim().Equals("心理健康度") && false == dimTable.Rows[kj]["DIMNM"].ToString().Trim().Equals("诚信"))//除去智力维度 { dimRes = dimTable.Rows[kj]["DIMRESULT"].ToString().Trim(); if (dimRes.Equals("偏低") || dimRes.Equals("稍低")) { bAllDimIsLow = true; } else { bAllDimIsLow = false; break; } } } //查看所有维度是否均较高 2012.3.18 for (int jk = 0; jk < dimTable.Rows.Count; jk++) { if (false == dimTable.Rows[jk]["DIMCLASSID"].ToString().Trim().Equals("3") && false == dimTable.Rows[jk]["DIMNM"].ToString().Trim().Equals("社会称许性") && false == dimTable.Rows[jk]["DIMNM"].ToString().Trim().Equals("心理健康度") && false == dimTable.Rows[jk]["DIMNM"].ToString().Trim().Equals("诚信"))//除去智力维度 { dimRes = dimTable.Rows[jk]["DIMRESULT"].ToString().Trim(); if (dimRes.Equals("适配") || dimRes.Equals("偏高")) { bAllDimIsHigh = true; } else { bAllDimIsHigh = false; break; } } } //工作劣势 for (int mm = 0; mm < arGZZT_lieshi.Count; mm++) { lieshi += " " + (mm + 1).ToString() + "、" + arGZZT_lieshi[mm].ToString(); } if (bAllDimIsHigh == true)//add by conghui 2012.3.18 { lieshi += " " + "答题者在本次所测试的心理特征维度上得分均偏高,请注意其社会称许性得分,如果该得分在适中区间,可以认为他/她在这些特质方面的表现可以符合该岗位要求。"; } //工作优势 for (int nn = 0; nn < arGZZT_youshi.Count; nn++) { youshi += " " + (nn + 1).ToString() + "、" + arGZZT_youshi[nn].ToString(); } if (bAllDimIsLow == true)//add by conghui 2012.3.18 { youshi += " " + "答题者在本次所测试的各心理特征维度上的得分均偏低,他/她在这些方面的表现与岗位要求有些差距。"; } //作答一致性等级,判定>>>>>>>>>>>>>>>>>> string trustful = string.Empty; string trustfulComments = string.Empty; int nTrustful = Int32.Parse(testerInfoTable.Rows[0][7].ToString()); trustful = (nTrustful == 0) ? "较低" : "较高"; trustfulComments = (nTrustful == 0) ? "他(她)答题时前后心理状态略不稳定,疲劳、环境干扰、心绪波动等均可能导致这种偏误" : "他(她)答题时心理状态基本稳定,此方面导致的测评偏误较小"; if (trustful.Equals("较高")) { b3 = true; } //作答一致性等级,判定<<<<<<<<<<<<<<<<<<< //作答时间,判定>>>>>>>>>>>>>>>>>> TimeSpan ts = DateTime.Parse(testerInfoTable.Rows[0][3].ToString()) - DateTime.Parse(testerInfoTable.Rows[0][2].ToString()); double nRealTime = (ts.TotalSeconds) / (double)60; string answerTimeComments = string.Empty; if (nRealTime <= refMinMinutes) { answerTimeComments = "答题速度过快,有可能是答题过程不够认真或是其他原因,有待进一步了解"; } else if (nRealTime >= refMaxMinutes) { answerTimeComments = "答题速度偏慢,背后原因有待进一步了解"; } else if (nRealTime > refMinMinutes && nRealTime < refMaxMinutes) { b1 = true; answerTimeComments = "答题速度比较适中"; } else { answerTimeComments = string.Empty; } //作答时间,判定<<<<<<<<<<<<<<<<<<<<< //提取智力维度,显示柱状图 rptDataSet ds = new rptDataSet(); for (int j = 0; j < dimTable.Rows.Count; j++) { if (dimTable.Rows[j]["DIMCLASSID"].ToString().Trim().Equals("3"))//智力潜能类 { ds.ZhiliDimScore.AddZhiliDimScoreRow( dimTable.Rows[j]["DIMID"].ToString().Trim(), dimTable.Rows[j]["DIMNM"].ToString().Trim(), dimTable.Rows[j]["DIMSCORE"].ToString().Trim()); } } //删除智力维度在维度得分表里。 for (int k = 0; k < dimTable.Rows.Count; k++) { if (dimTable.Rows[k]["DIMCLASSID"].ToString().Trim().Equals("3"))//智力潜能类 { dimTable.Rows[k].Delete(); dimTable.AcceptChanges(); k--; } } //删除三个特殊维度在维度得分表里。 for (int s = 0; s < dimTable.Rows.Count; s++) { if (dimTable.Rows[s]["DIMNM"].ToString().Trim().Equals("社会称许性") || dimTable.Rows[s]["DIMNM"].ToString().Trim().Equals("心理健康度") || dimTable.Rows[s]["DIMNM"].ToString().Trim().Equals("诚信")) { dimTable.Rows[s].Delete(); dimTable.AcceptChanges(); s--; } } string xljk = string.Empty; string xljkLevel = string.Empty; string xljkComnet = string.Empty; xljk = rptBLL.GetXljkLevelAndComments(strGUID);//获取心理健康等级和评语 if (!string.IsNullOrEmpty(xljk)) { int n = xljk.IndexOf("-"); xljkLevel = xljk.Substring(0, n); xljkComnet = xljk.Substring(n + 1, xljk.Length - n - 1); } bool b = false; if (b1 == true && b2 == true && b3 == true) { b = true;//答题结果是否可信 } //数据准备完毕!!! #endregion #region 准备生成pdf报告 Document doc = new Document(PageSize.A4); PdfWriter writer = PdfWriter.GetInstance(doc, new FileStream( Server.MapPath("../PDF") + "\\" + strGUID + ".pdf", FileMode.Create)); doc.Open(); BaseFont bf = BaseFont.CreateFont(@"C:\Windows\fonts\simsun.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED); Font zhengwen_font = new Font(bf); Font zhengwen_title = new Font(bf, 12, Font.BOLD); #endregion #region 封面 Paragraph ph = new Paragraph(); ph.Alignment = Element.ALIGN_RIGHT; ph.Font = zhengwen_font; ph.Add("报告编号:" + strGUID); doc.Add(ph); //header Image jpeg = Image.GetInstance(Server.MapPath("../images/header.jpg")); jpeg.Alignment = Image.ALIGN_CENTER; jpeg.ScalePercent(70); doc.Add(jpeg); //first page title BaseFont bfHei = BaseFont.CreateFont(@"C:\WINDOWS\fonts\SIMHEI.TTF", BaseFont.IDENTITY_H, BaseFont.EMBEDDED); Font fRptTitle = new Font(bfHei, 24, Font.BOLD); Paragraph phRptTitle = new Paragraph(); phRptTitle.Alignment = Element.ALIGN_CENTER; phRptTitle.Font = fRptTitle; phRptTitle.Add(testerInfoTable.Rows[0]["testerCOMPANYNM"].ToString() + Environment.NewLine); phRptTitle.Add("4S店" + posNm + "人才测评报告"); phRptTitle.SetLeading(PARAGRAPH_SPACING, PARAGRAPH_SPACING); phRptTitle.SpacingAfter = 25; phRptTitle.SpacingBefore = 70; doc.Add(phRptTitle); //logo Image logo = Image.GetInstance(Server.MapPath("../images/logo.jpg")); logo.Alignment = Image.ALIGN_CENTER; logo.ScalePercent(70); doc.Add(logo); //姓名,日期 Paragraph phNm = new Paragraph(); //phNm.Alignment = Element.ALIGN_CENTER; phNm.Font = zhengwen_font; phNm.SetLeading(PARAGRAPH_SPACING, PARAGRAPH_SPACING); phNm.Add("姓名:" + usrNm + Environment.NewLine); phNm.Add("日期:" + DateTime.Parse(testerInfoTable.Rows[0]["testerDATE"].ToString()).ToShortDateString()); phNm.IndentationLeft = 222; phNm.SpacingBefore = 100; phNm.SpacingAfter = 75; doc.Add(phNm); //footer doc.Add(jpeg); #endregion #region 报告阅读说明 doc.NewPage(); Paragraph p0 = new Paragraph("报告阅读说明", new Font(bfHei, 14, Font.BOLD)); p0.SetLeading(PARAGRAPH_SPACING, PARAGRAPH_SPACING); p0.SpacingAfter = TITLE_TEXT_DISTANCE;//标题与后面文字间隔 p0.Alignment = Element.ALIGN_CENTER; doc.Add(p0); Paragraph phshuoming = new Paragraph(); phshuoming.Font = zhengwen_font; phshuoming.SetLeading(PARAGRAPH_SPACING, PARAGRAPH_SPACING); phshuoming.Alignment = Element.ALIGN_LEFT; phshuoming.Add(@" 本报告的系统平台内包含人格量表、态度量表、动机量表等数十种心理测验量表,开发过程综合了麦克莱兰德(David C.McClelland)、班杜拉(Albert Bandura)、卡特尔(R.B.Cattell)、吉尔福特(J.P.Guilford)、霍兰德(J.L.Holland) 等多位知名心理学家关于人格类型、态度的形成与改变、驱力理论、管理心理理论等多个专题领域的相关观点,在国内高校本土化研究实践的基础上,进一步实现汽车行业化,力争满足汽车行业广大测评使用者的需求。 报告第一部分为本次测评有效性技术指标的监测结果,并给出简要解释,供报告使用者参考;需要说明的是,以下因素可能影响测评报告的有效性: * 答题者不具备基本水平的阅读理解能力 * 答题时过于关心得到的结果是怎样的 * 答题者误解了测评活动的本质 * 答题者感到较大的环境压力 * 答题过程中存在较严重的心理干扰 * 答题者存在较强的药物依赖 报告第二部分中综合适配度是指以本次测评报告中呈现的各心理特征维度为该岗位的胜任要求时答题者与岗位要求间的适配程度,由于不同用户定制不同,适配度含义会有差异; 报告第三部分逐一分析各项心理特征具体水平状况,提供个人结果与参照标准的对比; 报告第四部分管理用人建议由具备丰富汽车行业实战经验及深厚行业理论基础的资深专家二十余名参与开发,其中融入了多年实践与研究的心得,旨在帮助管理者和报告使用者明确提升方向,解决实际问题; 报告第五部分中的个人发展建议依据杜布(L.W.Doob)、费斯汀格(L.Festinger)、科尔曼(H.Kelman)等人的相关理论编制;由于每个人职业发展机遇、所处团队文化等诸多外因的不确定性,该部分仅就本次测评结果为使用者提供个人发展方面的指导与建议。 由于个体心理结构的复杂性、心理发展的动态性和测评条件的局限性,报告使用者需避免用绝对化的眼光看待测评报告的结果;使用本报告时若能结合标准化面试、情景模拟等其他人才测评技术手段,将会有利于进一步全面评估被测评者的个人能力。"); doc.Add(phshuoming); #endregion #region 第一部分 doc.NewPage(); Paragraph p1 = new Paragraph("第一部分 测评有效性及个人基本情况", new Font(bfHei, 14, Font.BOLD)); p1.SpacingAfter = TITLE_TEXT_DISTANCE;//标题与后面文字间隔 p1.Alignment = Element.ALIGN_CENTER; doc.Add(p1); Paragraph p11 = new Paragraph(" 本部分通过以下指标结果来综合评价本次测评的有效性,并报告答题者的基本心理状况。", zhengwen_font); p11.SetLeading(PARAGRAPH_SPACING, PARAGRAPH_SPACING); doc.Add(p11); //第一部分表格 PdfPTable p1t1 = new PdfPTable(4); p1t1.SpacingAfter = 5; p1t1.SpacingBefore = 15; //row 1 PdfPCell cell11 = new PdfPCell(new Paragraph("社会称许性等级", new Font(bf, 10, Font.NORMAL))); cell11.BackgroundColor = new BaseColor(220, 220, 220); cell11.BorderWidthLeft = 0; cell11.BorderWidthRight = 0; cell11.MinimumHeight = TABLE_ROW_HEIGHT; cell11.VerticalAlignment = Element.ALIGN_MIDDLE; cell11.BorderWidthBottom = 0; PdfPCell cell12 = new PdfPCell(new Paragraph(shcxxDENGJI, new Font(bf, 10, Font.NORMAL))); cell12.BorderWidthLeft = 0; cell12.BorderWidthRight = 0; cell12.VerticalAlignment = Element.ALIGN_MIDDLE; cell12.BorderWidthBottom = 0; PdfPCell cell13 = new PdfPCell(new Paragraph("社会称许性评定", new Font(bf, 10, Font.NORMAL))); cell13.BackgroundColor = new BaseColor(220, 220, 220); cell13.BorderWidthLeft = 0; cell13.BorderWidthRight = 0; cell13.VerticalAlignment = Element.ALIGN_MIDDLE; cell13.BorderWidthBottom = 0; PdfPCell cell14 = new PdfPCell(new Paragraph(shcxxPINGDING, new Font(bf, 10, Font.NORMAL))); cell14.BorderWidthLeft = 0; cell14.BorderWidthRight = 0; cell14.VerticalAlignment = Element.ALIGN_MIDDLE; cell14.BorderWidthBottom = 0; //row 2 PdfPCell cell21 = new PdfPCell(new Paragraph("作答一致性等级", new Font(bf, 10, Font.NORMAL))); cell21.BackgroundColor = new BaseColor(220, 220, 220); cell21.BorderWidthLeft = 0; cell21.BorderWidthRight = 0; cell21.MinimumHeight = TABLE_ROW_HEIGHT; cell21.VerticalAlignment = Element.ALIGN_MIDDLE; cell21.BorderWidthBottom = 0; PdfPCell cell22 = new PdfPCell(new Paragraph(trustful, new Font(bf, 10, Font.NORMAL))); cell22.BorderWidthLeft = 0; cell22.BorderWidthRight = 0; cell22.VerticalAlignment = Element.ALIGN_MIDDLE; cell22.BorderWidthBottom = 0; PdfPCell cell23 = new PdfPCell(new Paragraph("测评工具信度", new Font(bf, 10, Font.NORMAL))); cell23.BackgroundColor = new BaseColor(220, 220, 220); cell23.BorderWidthLeft = 0; cell23.BorderWidthRight = 0; cell23.VerticalAlignment = Element.ALIGN_MIDDLE; cell23.BorderWidthBottom = 0; PdfPCell cell24 = new PdfPCell(new Paragraph("0.857 ~ 0.949", new Font(bf, 10, Font.NORMAL))); cell24.BorderWidthLeft = 0; cell24.BorderWidthRight = 0; cell24.VerticalAlignment = Element.ALIGN_MIDDLE; cell24.BorderWidthBottom = 0; //row 3 PdfPCell cell31 = new PdfPCell(new Paragraph("作答实际时间", new Font(bf, 10, Font.NORMAL))); cell31.BackgroundColor = new BaseColor(220, 220, 220); cell31.BorderWidthLeft = 0; cell31.BorderWidthRight = 0; cell31.MinimumHeight = TABLE_ROW_HEIGHT; cell31.VerticalAlignment = Element.ALIGN_MIDDLE; cell31.BorderWidthBottom = 0; PdfPCell cell32 = new PdfPCell(new Paragraph(((int)ts.TotalMinutes).ToString() + "分钟", new Font(bf, 10, Font.NORMAL))); cell32.BorderWidthLeft = 0; cell32.BorderWidthRight = 0; cell32.VerticalAlignment = Element.ALIGN_MIDDLE; cell32.BorderWidthBottom = 0; PdfPCell cell33 = new PdfPCell(new Paragraph("答题时间参照值", new Font(bf, 10, Font.NORMAL))); cell33.BackgroundColor = new BaseColor(220, 220, 220); cell33.BorderWidthLeft = 0; cell33.BorderWidthRight = 0; cell33.VerticalAlignment = Element.ALIGN_MIDDLE; cell33.BorderWidthBottom = 0; PdfPCell cell34 = new PdfPCell(new Paragraph(strREFtime + "分钟", new Font(bf, 10, Font.NORMAL))); cell34.BorderWidthLeft = 0; cell34.BorderWidthRight = 0; cell34.VerticalAlignment = Element.ALIGN_MIDDLE; cell34.BorderWidthBottom = 0; //row 4 PdfPCell cell41 = new PdfPCell(new Paragraph("答题诚信表现", new Font(bf, 10, Font.NORMAL))); cell41.BackgroundColor = new BaseColor(220, 220, 220); cell41.BorderWidthLeft = 0; cell41.BorderWidthRight = 0; cell41.MinimumHeight = TABLE_ROW_HEIGHT; cell41.VerticalAlignment = Element.ALIGN_MIDDLE; PdfPCell cell42 = new PdfPCell(new Paragraph(cxbxPY, new Font(bf, 10, Font.NORMAL))); cell42.BorderWidthLeft = 0; cell42.BorderWidthRight = 0; cell42.VerticalAlignment = Element.ALIGN_MIDDLE; PdfPCell cell43 = new PdfPCell(new Paragraph("心理健康度状况", new Font(bf, 10, Font.NORMAL))); cell43.BackgroundColor = new BaseColor(220, 220, 220); cell43.BorderWidthLeft = 0; cell43.BorderWidthRight = 0; cell43.VerticalAlignment = Element.ALIGN_MIDDLE; PdfPCell cell44 = new PdfPCell(new Paragraph(xljkLevel, new Font(bf, 10, Font.NORMAL))); cell44.BorderWidthLeft = 0; cell44.BorderWidthRight = 0; cell44.VerticalAlignment = Element.ALIGN_MIDDLE; PdfPCell[] cells1 = new PdfPCell[] { cell11, cell12, cell13, cell14 }; PdfPRow row1 = new PdfPRow(cells1); PdfPCell[] cells2 = new PdfPCell[] { cell21, cell22, cell23, cell24 }; PdfPRow row2 = new PdfPRow(cells2); PdfPCell[] cells3 = new PdfPCell[] { cell31, cell32, cell33, cell34 }; PdfPRow row3 = new PdfPRow(cells3); PdfPCell[] cells4 = new PdfPCell[] { cell41, cell42, cell43, cell44 }; PdfPRow row4 = new PdfPRow(cells4); p1t1.Rows.Add(row1); p1t1.Rows.Add(row2); p1t1.Rows.Add(row3); p1t1.Rows.Add(row4); doc.Add(p1t1); Paragraph p12 = new Paragraph(" 综合来看," + usrNm + "本次作答结果" + (b == true ? "比较可信。" : "有必要进一步测评。"), zhengwen_font); p12.SetLeading(PARAGRAPH_SPACING, PARAGRAPH_SPACING); doc.Add(p12); Paragraph p13 = new Paragraph(" 1、" + shcxxMIAOSHU + ";", zhengwen_font); p13.SetLeading(PARAGRAPH_SPACING, PARAGRAPH_SPACING); doc.Add(p13); Paragraph p14 = new Paragraph(" 2、" + trustfulComments + ";", zhengwen_font); p14.SetLeading(PARAGRAPH_SPACING, PARAGRAPH_SPACING); doc.Add(p14); Paragraph p15 = new Paragraph(" 3、" + answerTimeComments + ";", zhengwen_font); p15.SetLeading(PARAGRAPH_SPACING, PARAGRAPH_SPACING); doc.Add(p15); Paragraph p16 = new Paragraph(" 4、" + xljkComnet + "。", zhengwen_font); p16.SetLeading(PARAGRAPH_SPACING, PARAGRAPH_SPACING); doc.Add(p16); #endregion #region 第二部分 doc.NewPage(); Paragraph p2 = new Paragraph("第二部分 与4S店" + posNm + "岗位规范的综合适配情况", new Font(bfHei, 14, Font.BOLD)); p2.SpacingAfter = TITLE_TEXT_DISTANCE;//标题与后面文字间隔 p2.Alignment = Element.ALIGN_CENTER; doc.Add(p2); Paragraph p21 = new Paragraph(" 将本次测评数据比照汽车行业该岗位素质特征模型统计数据," + usrNm + "与4S店" + posNm + "的综合适配度为:", zhengwen_font); p21.SetLeading(PARAGRAPH_SPACING, PARAGRAPH_SPACING); doc.Add(p21); System.Drawing.Bitmap bmpScore = new System.Drawing.Bitmap(Server.MapPath(@"../images/score_bk.png")); System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bmpScore); System.Drawing.Pen redPen = new System.Drawing.Pen(System.Drawing.Color.Red, 3); System.Drawing.Font f = new System.Drawing.Font("Arial", 15); System.Drawing.SolidBrush brush = new System.Drawing.SolidBrush(System.Drawing.Color.Red); g.DrawString(float.Parse(testerInfoTable.Rows[0]["testerTOTALSCORE"].ToString()).ToString("0.0%"), f, brush, 18, 10); g.Dispose(); Image scorePic = Image.GetInstance(bmpScore, new BaseColor(0)); scorePic.Alignment = Image.ALIGN_CENTER; scorePic.ScalePercent(70); doc.Add(scorePic); Paragraph p22 = new Paragraph(" ● " + usrNm + "担任" + posNm + "的优势:", zhengwen_title); p22.SetLeading(PARAGRAPH_SPACING, PARAGRAPH_SPACING); doc.Add(p22); Paragraph p23 = new Paragraph(" 我们对成功的建议是:“以已之长,补已之短”。学会了这一点将会影响个人对工作的喜好甚至职业发展的成败。" + Environment.NewLine + youshi, zhengwen_font); p23.SetLeading(PARAGRAPH_SPACING, PARAGRAPH_SPACING); doc.Add(p23); Paragraph p24 = new Paragraph(" ● " + usrNm + "担任" + posNm + "的劣势:", zhengwen_title); p24.SetLeading(PARAGRAPH_SPACING, PARAGRAPH_SPACING); doc.Add(p24); Paragraph p25 = new Paragraph(" 有的人不足之处比较明显,有的却没有明显缺点,或者他(她)自己并不容易意识到,了解个人存在的问题就是完善自我的重要一步。下面列出了他(她)工作中可能存在的欠缺,目的是为了引起对它们的 “注意”,促进反思。" + Environment.NewLine + lieshi, zhengwen_font); p25.SetLeading(PARAGRAPH_SPACING, PARAGRAPH_SPACING); doc.Add(p25); #endregion #region 第三部分 doc.NewPage(); Paragraph p3 = new Paragraph("第三部分 各项特征具体状况", new Font(bfHei, 14, Font.BOLD)); p3.SpacingAfter = TITLE_TEXT_DISTANCE;//标题与后面文字间隔 p3.Alignment = Element.ALIGN_CENTER; doc.Add(p3); Paragraph p31 = new Paragraph(" 下列图中灰色区间是经过统计分析得出的标准参照区间,下方红色游标指示" + usrNm + "在该特征上的个人得分水平。", zhengwen_font); p31.SetLeading(PARAGRAPH_SPACING, PARAGRAPH_SPACING); doc.Add(p31); for (int i = 0; i < dimTable.Rows.Count; i++) { Paragraph p = new Paragraph(" " + dimTable.Rows[i]["DIMNM"].ToString(), zhengwen_title); p.SetLeading(PARAGRAPH_SPACING, PARAGRAPH_SPACING); doc.Add(p); Double rangeStart = Double.Parse(dimTable.Rows[i]["DIMRANGE_START"].ToString()); Double rangeEnd = Double.Parse(dimTable.Rows[i]["DIMRANGE_END"].ToString()); Double rangeCurrent = Double.Parse(dimTable.Rows[i]["DIMSCORE"].ToString()); Image ruler = Image.GetInstance(drawRuler(rangeStart, rangeEnd, rangeCurrent), new BaseColor(0)); ruler.Alignment = Image.ALIGN_CENTER; ruler.ScalePercent(70); doc.Add(ruler); } for (int j = 0; j < dimTable.Rows.Count; j++) { Paragraph p = new Paragraph(" ● " + dimTable.Rows[j]["DIMNM"].ToString() + " " + dimTable.Rows[j]["dimDESC"].ToString(), zhengwen_font); p.SetLeading(PARAGRAPH_SPACING, PARAGRAPH_SPACING); doc.Add(p); Paragraph q = new Paragraph(" 他(她)在这方面的表现情况是 " + dimTable.Rows[j]["dimCOMMENTS"].ToString(), zhengwen_font); q.SetLeading(PARAGRAPH_SPACING, PARAGRAPH_SPACING); doc.Add(q); } //各项个人特征得分等级表 Paragraph p32 = new Paragraph("各项个人特征得分等级表", zhengwen_title); p32.Alignment = Element.ALIGN_CENTER; p32.SetLeading(PARAGRAPH_SPACING, PARAGRAPH_SPACING); doc.Add(p32); PdfPTable p3t1 = new PdfPTable(4); p3t1.SpacingAfter = 5; p3t1.SpacingBefore = 15; /* //row 1 PdfPCell c11 = new PdfPCell(new Paragraph("职业特质类别", new Font(bf, 10, Font.BOLD))); c11.BackgroundColor = new BaseColor(220,220,220); c11.BorderWidthLeft = 0; c11.BorderWidthRight = 0; c11.MinimumHeight = TABLE_ROW_HEIGHT; c11.VerticalAlignment = Element.ALIGN_MIDDLE; c11.HorizontalAlignment = Element.ALIGN_CENTER; c11.BorderWidthBottom = 0; c11.BorderWidthTop = 0; */ PdfPCell c12 = new PdfPCell(new Paragraph("个人特征", new Font(bf, 10, Font.BOLD))); c12.BackgroundColor = new BaseColor(220, 220, 220); c12.BorderWidthLeft = 0; c12.BorderWidthRight = 0; c12.VerticalAlignment = Element.ALIGN_MIDDLE; c12.HorizontalAlignment = Element.ALIGN_CENTER; c12.BorderWidthBottom = 0; c12.BorderWidthTop = 0; c12.MinimumHeight = TABLE_ROW_HEIGHT; PdfPCell c13 = new PdfPCell(new Paragraph("实际得分", new Font(bf, 10, Font.BOLD))); c13.BackgroundColor = new BaseColor(220, 220, 220); c13.BorderWidthLeft = 0; c13.BorderWidthRight = 0; c13.VerticalAlignment = Element.ALIGN_MIDDLE; c13.HorizontalAlignment = Element.ALIGN_CENTER; c13.BorderWidthBottom = 0; c13.BorderWidthTop = 0; PdfPCell c14 = new PdfPCell(new Paragraph("参考区间", new Font(bf, 10, Font.BOLD))); c14.BackgroundColor = new BaseColor(220, 220, 220); c14.BorderWidthLeft = 0; c14.BorderWidthRight = 0; c14.VerticalAlignment = Element.ALIGN_MIDDLE; c14.HorizontalAlignment = Element.ALIGN_CENTER; c14.BorderWidthBottom = 0; c14.BorderWidthTop = 0; PdfPCell c15 = new PdfPCell(new Paragraph("评价等级", new Font(bf, 10, Font.BOLD))); c15.BackgroundColor = new BaseColor(220, 220, 220); c15.BorderWidthLeft = 0; c15.BorderWidthRight = 0; c15.VerticalAlignment = Element.ALIGN_MIDDLE; c15.HorizontalAlignment = Element.ALIGN_CENTER; c15.BorderWidthBottom = 0; c15.BorderWidthTop = 0; PdfPCell[] cs1 = new PdfPCell[] { c12, c13, c14, c15 }; PdfPRow r1 = new PdfPRow(cs1); p3t1.Rows.Add(r1); for (int k = 0; k < dimTable.Rows.Count; k++) { /* PdfPCell c1 = new PdfPCell(new Paragraph(dimTable.Rows[k]["dimCLASSNM"].ToString(), new Font(bf, 10, Font.NORMAL))); c1.VerticalAlignment = Element.ALIGN_MIDDLE; c1.HorizontalAlignment = Element.ALIGN_CENTER; c1.BorderWidthLeft = 0; c1.BorderWidthRight = 0; //c1.BorderWidthBottom = 0; c1.BorderWidthTop = 0; c1.MinimumHeight = TABLE_ROW_HEIGHT; */ PdfPCell c2 = new PdfPCell(new Paragraph(dimTable.Rows[k]["dimNM"].ToString(), new Font(bf, 10, Font.NORMAL))); c2.VerticalAlignment = Element.ALIGN_MIDDLE; c2.HorizontalAlignment = Element.ALIGN_CENTER; c2.BorderWidthLeft = 0; c2.BorderWidthRight = 0; //c2.BorderWidthBottom = 0; c2.BorderWidthTop = 0; c2.MinimumHeight = TABLE_ROW_HEIGHT; PdfPCell c3 = new PdfPCell(new Paragraph(dimTable.Rows[k]["dimSCORE"].ToString(), new Font(bf, 10, Font.NORMAL))); c3.VerticalAlignment = Element.ALIGN_MIDDLE; c3.HorizontalAlignment = Element.ALIGN_CENTER; c3.BorderWidthLeft = 0; c3.BorderWidthRight = 0; //c3.BorderWidthBottom = 0; c3.BorderWidthTop = 0; PdfPCell c4 = new PdfPCell(new Paragraph(dimTable.Rows[k]["dimRANGE_START"].ToString() + " ~ " + dimTable.Rows[k]["dimRANGE_END"].ToString(), new Font(bf, 10, Font.NORMAL))); c4.VerticalAlignment = Element.ALIGN_MIDDLE; c4.HorizontalAlignment = Element.ALIGN_CENTER; c4.BorderWidthLeft = 0; c4.BorderWidthRight = 0; //c4.BorderWidthBottom = 0; c4.BorderWidthTop = 0; PdfPCell c5 = new PdfPCell(new Paragraph(dimTable.Rows[k]["dimRESULT"].ToString(), new Font(bf, 10, Font.NORMAL))); c5.VerticalAlignment = Element.ALIGN_MIDDLE; c5.HorizontalAlignment = Element.ALIGN_CENTER; c5.BorderWidthLeft = 0; c5.BorderWidthRight = 0; //c5.BorderWidthBottom = 0; c5.BorderWidthTop = 0; PdfPCell[] ces1 = new PdfPCell[] { c2, c3, c4, c5 }; PdfPRow ro1 = new PdfPRow(ces1); p3t1.Rows.Add(ro1); } doc.Add(p3t1); //智力柱状图 //各项个人特征得分等级表 if (ds != null && ds.ZhiliDimScore.Rows.Count > 0) { Paragraph p33 = new Paragraph("各项智力测评结果图", zhengwen_title); p33.Alignment = Element.ALIGN_CENTER; p33.SetLeading(PARAGRAPH_SPACING, PARAGRAPH_SPACING); doc.Add(p33); Image chrt = Image.GetInstance(makeChart(ds.ZhiliDimScore), new BaseColor(0)); chrt.Alignment = Image.ALIGN_CENTER; chrt.ScalePercent(80); doc.Add(chrt); } #endregion #region 第四部分 doc.NewPage(); Paragraph p4 = new Paragraph("第四部分 4S店管理用人建议", new Font(bfHei, 14, Font.BOLD)); p4.SpacingAfter = TITLE_TEXT_DISTANCE;//标题与后面文字间隔 p4.Alignment = Element.ALIGN_CENTER; doc.Add(p4); Paragraph p41 = new Paragraph(" 针对" + usrNm + "的特点,管理工作中建议注意以下方面:" + Environment.NewLine + sbYRJY.ToString(), zhengwen_font); p41.SetLeading(PARAGRAPH_SPACING, PARAGRAPH_SPACING); doc.Add(p41); #endregion #region 第五部分 doc.NewPage(); Paragraph p5 = new Paragraph("第五部分 个人发展建议", new Font(bfHei, 14, Font.BOLD)); p5.SpacingAfter = TITLE_TEXT_DISTANCE;//标题与后面文字间隔 p5.Alignment = Element.ALIGN_CENTER; doc.Add(p5); Paragraph p51 = new Paragraph(" 本部分是针对" + usrNm + "不够完善的素质提供的一些发展建议。若能要花时间认真思考并付注于行动,定会对本人有所帮助,建议如下: " + Environment.NewLine + sbGRFZ.ToString(), zhengwen_font); p51.SetLeading(PARAGRAPH_SPACING, PARAGRAPH_SPACING); doc.Add(p51); #endregion doc.Close(); } catch (Exception ex) { //Response.Write(ex.Message); StreamWriter errof = new StreamWriter(Server.MapPath(@"../PDF/") + "测评系统log.txt"); errof.WriteLine(System.DateTime.Now.ToString() + ":错误: " + ex.Message); errof.Flush(); errof.Close(); } }