protected void btnSave_Click(object sender, EventArgs e) { ActivityBLL activityBll = new ActivityBLL(); StringBuilder sb = new StringBuilder(7); if (RadioButtonList1.SelectedItem.Text.Equals("是")) { sb.Append("1"); } else { sb.Append("2"); } sb.Append(CheckBox1.Checked ? "1" : "2"); sb.Append(CheckBox2.Checked ? "1" : "2"); sb.Append(CheckBox3.Checked ? "1" : "2"); sb.Append(CheckBox4.Checked ? "1" : "2"); sb.Append(CheckBox5.Checked ? "1" : "2"); sb.Append(CheckBox6.Checked ? "1" : "2"); string aID = ddlActivity.SelectedValue; int rptSettings = int.Parse(sb.ToString()); int rows = activityBll.UpdateActivityRptSettings(aID, rptSettings); if (rows == 1) { MessageBox.ShowAndRedirect(this, "测试报告设置成功", "ManageActivity.aspx"); } else { MessageBox.ShowAndRedirect(this, "测试报告设置失败", "ManageActivity.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["isTesting"] == null)//如果没有输入序列号,则禁止访问此页面 { Response.Redirect("Tlogin.aspx"); } btnNext.Enabled = false; if (!IsPostBack) { if (Request.QueryString["logopath"] != null) { if (string.IsNullOrEmpty(Request.QueryString["logopath"])) { usrLogo.ImageUrl = "~/images/5050.jpg"; usrLogo.Visible = false; } else { usrLogo.ImageUrl = Request.QueryString["logopath"].ToString().Replace("\\", "/"); } } string companyName = string.Empty; int totalMinutes = 50; int xiaxian = 0; int shangxian = 0; if (!string.IsNullOrEmpty(Request.QueryString["guid"])) { GuidBLL gbll = new GuidBLL(); QuestionBLL qbll = new QuestionBLL(); ActivityBLL abll = new ActivityBLL(); int aID = gbll.GetActivityId(Request.QueryString["guid"]); totalMinutes = qbll.GetQuestionTimeByGUID(Request.QueryString["guid"],1) / 60; xiaxian = qbll.GetQuestionTimeByGUID(Request.QueryString["guid"], 2) / 60; shangxian = qbll.GetQuestionTimeByGUID(Request.QueryString["guid"], 3) / 60; DataSet ds = abll.GetEUsrInfoByActivityId(aID); if (ds != null) { companyName = ds.Tables[0].Rows[0]["users_incname"].ToString(); } } txtWelcome.Text = @" 欢迎您参加" + companyName + "组织的题目测试,本次测试需要" + xiaxian.ToString() + "-" + shangxian.ToString() + "分钟左右的时间。"; } }
protected void GrVActivityManage_RowCommand(object sender, GridViewCommandEventArgs e) { int rowIndex = Int32.Parse(e.CommandArgument.ToString());//获取点击了第几行 if (e.CommandName == "GuidSetting") { string guidNew = GenerateGuid.NewGuidNo().Substring(0, 8); GuidNo guidObject = new GuidNo(); guidObject.GuidStr = guidNew; guidObject.ActivityId = int.Parse(grVActivityManage.DataKeys[rowIndex].Values[0].ToString()); guidObject.CreateTime = DateTime.Now; GuidBLL temp = new GuidBLL(); if (temp.Add(guidObject) != -1) { MessageBox.ShowAndRedirect(this, "已成功开启项目", "ManageActivity.aspx"); } } if (e.CommandName == "DisableActivity") { string strStatus = ((Button)grVActivityManage.Rows[rowIndex].Cells[8].Controls[0]).Text; string actid = grVActivityManage.DataKeys[rowIndex].Values[0].ToString(); string positonid = grVActivityManage.DataKeys[rowIndex].Values[1].ToString(); EnterpriseUserBLL enterprisebll = new EnterpriseUserBLL(); string enterpriseid = enterprisebll.GetEnterpriseIdByUser(Session["username"].ToString()); ActivityBLL temp = new ActivityBLL(); switch (strStatus) { case "开启项目": if (temp.UpdateActivityStatus(actid, positonid, enterpriseid, false) != -1) { MessageBox.ShowAndRedirect(this, "已成功开启项目", "ManageActivity.aspx"); } break; case "停止项目": if (temp.UpdateActivityStatus(actid, positonid, enterpriseid, true) != -1) { MessageBox.ShowAndRedirect(this, "已成功停止项目", "ManageActivity.aspx"); } break; default: break; } temp = null; } }
protected void btnSave_Click(object sender, EventArgs e) { try { int activityId = int.Parse(Request["actid"].ToString()); int count = int.Parse(txtAvailablecount.Text.Trim());//次数 float money = float.Parse(txtMoney.Text.Trim());//金额 if (payBll.AddPayment(activityId, money, count) != -1) { //正常 } else { } //产生GUID 分配企业。 for (int i = 0; i < count; i++) { string guidNew = GenerateGuid.NewGuidNo().Substring(0, 8); GuidNo guidObject = new GuidNo(); guidObject.GuidStr = guidNew; guidObject.ActivityId = activityId; guidObject.CreateTime = DateTime.Now; guidObject.Guid_status = 0; GuidBLL guidBLL = new GuidBLL(); guidBLL.Add(guidObject); } ActivityBLL aBll = new ActivityBLL(); DataSet dsEUsrInfo = aBll.GetEUsrInfoByActivityId(Int32.Parse(Request.QueryString["actid"])); MessageBox.ShowAndRedirect(this, "续费成功", "ActivityList.aspx?users_id=" + dsEUsrInfo.Tables[0].Rows[0][0].ToString()); } catch (Exception ex) { MessageBox.ShowAndRedirect(this, "续费失败!" + ex.Message, "EnterpriseUserList.aspx"); } }
protected void btnDelete_Click(object sender, EventArgs e) { ActivityBLL temp = new ActivityBLL(); int selectCount = 0; int activity_id = 0; foreach (GridViewRow gr in grVActivityManage.Rows) { CheckBox chk = (CheckBox)gr.Cells[0].FindControl("CB_Select"); if (chk.Checked) { activity_id = int.Parse(grVActivityManage.DataKeys[gr.RowIndex].Values["activity_id"].ToString()); temp.Delete(activity_id); selectCount++; } } if (0 == selectCount) { MessageBox.ResponseScript(this, "对不起,你没有选择记录!"); } temp = null; Response.Redirect(Request.Url.ToString()); }
protected void btnCancel_Click(object sender, EventArgs e) { ActivityBLL aBll = new ActivityBLL(); DataSet dsEUsrInfo = aBll.GetEUsrInfoByActivityId(Int32.Parse(Request.QueryString["actid"])); Response.Redirect("ActivityList.aspx?users_id=" + dsEUsrInfo.Tables[0].Rows[0][0].ToString()); }
protected void Page_Load(object sender, EventArgs e) { if (Session["isTesting"] == null)//如果没有输入序列号,则禁止访问此页面 { Response.Redirect("Tlogin.aspx"); } Response.Write("<div id='mydiv'>"); Response.Write("_"); Response.Write("</div>"); Response.Write("<script>mydiv.innerText = '';</script>"); Response.Write("<script language=javascript>;"); Response.Write("var dots = 0;var dotmax = 10;function ShowWait()"); Response.Write("{var output; output = '正在提交答题结果';dots++;if(dots>=dotmax)dots=1;"); Response.Write("for(var x = 0;x < dots;x++){output += '·';}mydiv.innerText = output;}"); Response.Write("function StartShowWait(){mydiv.style.visibility = 'visible'; "); Response.Write("window.setInterval('ShowWait()',1000);}"); Response.Write("function HideWait(){mydiv.style.visibility = 'hidden';"); Response.Write("window.clearInterval();}"); Response.Write("StartShowWait();</script>"); Response.Flush(); System.Threading.Thread.Sleep(4000); if (!IsPostBack) { if (Request["guid"] != null) { m_TesterInfoBll.UpdateTesterInfo(Request["guid"].ToString(), "tester_testendtime", DateTime.Now.ToString()); //记录答题结果 DataTable dtTmp = (DataTable)CacheManager.Get("usrSelected_" + Request["guid"].ToString()); foreach (DataRow row in dtTmp.Rows) { string test_sn = row["test_sn"].ToString(); int questionID = Int32.Parse(row["question_id"].ToString()); string question_sel = row["question_selected"].ToString(); int question_is_dirty = Int32.Parse(row["question_is_dirty"].ToString()); DateTime dt_start = (DateTime.Parse(row["question_start_dt"].ToString())); DateTime dt_end = (DateTime.Parse(row["question_end_dt"].ToString())); m_QuestionStatusBll.RecordScore(test_sn, questionID, question_sel, question_is_dirty, dt_start, dt_end); } //计算总分并更新到TesterInfo表中 RptBLL rptBLL = new RptBLL(); double score = rptBLL.GetTotalSocre(Request["guid"].ToString()); m_TesterInfoBll.UpdateTesterInfo(Request["guid"].ToString(), "tester_matching", score.ToString()); //考察本次测评结果是否可信 if (true == rptBLL.IsTrust(Request["guid"].ToString())) { //可信 m_TesterInfoBll.UpdateTesterInfo(Request["guid"].ToString(), "tester_consistencyscore", "1"); } else { //不可信 m_TesterInfoBll.UpdateTesterInfo(Request["guid"].ToString(), "tester_consistencyscore", "0"); } //测试完成 m_GuidBll.UpdateStatus(Request["guid"].ToString(), 2); CacheManager.Clear(Request["guid"].ToString());//清空缓存 Session["isTesting"] = null; Response.Write("<script language='javascript'>alert('恭喜,此次答题完成,系统已经记录您的成绩');</script>"); /* Response.Write("<script>"); Response.Write("{top.opener =null;top.close();}"); Response.Write("</script>"); */ //Response.Write("<script language='javascript'>window.parent.close())</script>"); ActivityBLL activityBll = new ActivityBLL(); Activity activity = activityBll.GetModel(m_GuidBll.GetActivityId(Request.QueryString["guid"])); int nPartFlag = activity.Activity_viewreport; //如果企业端允许查看 报告,则测评完毕后自动转入查看报告页面。 if (nPartFlag.ToString().Length != 7) { Response.Write("<script language='javascript'>window.navigate(\"Tlogin.aspx\")</script>"); } else //企业端允许 { if (nPartFlag.ToString().Substring(0, 1).Equals("1")) { Response.Write("<script language='javascript'>alert('您已完成答题,点击“确定”可现在查看报告。若需以后查看,请记录下该网址:answer.kingmas.com.cn,凭本次序列号查看。');window.navigate(\"../Report/GenPdfReport.aspx?sn=" + Request.QueryString["guid"] + "\")</script>"); } else { Response.Write("<script language='javascript'>window.navigate(\"Tlogin.aspx\")</script>"); } } } } }
protected void BtnLogin_Click(object sender, ImageClickEventArgs e) { if (!txtValidate.Text.ToUpper().Equals(Session["CheckCode"].ToString())) { MessageBox.ShowAndRedirect(this, "您输入的验证码有误,请重新输入!", "Tlogin.aspx"); return; } GuidBLL guidBll = new GuidBLL(); QuestionBLL qBll = new QuestionBLL(); ActivityBLL aBll = new ActivityBLL(); string userGUID = txtPart1.Text.Trim().ToUpper(); int status = guidBll.GetStatus(userGUID); int nActID = guidBll.GetActivityId(userGUID); Activity activity = aBll.GetModel(nActID); if (-1 == status)//无效序列号 { MessageBox.ShowAndRedirect(this, "您好,序列号无效,请输入正确的8位序列号", "Tlogin.aspx"); } else if (2 == status)//测试完成过的序列号,如果测评项目允许查看报告,则跳转至相关界面。 { if (activity != null && activity.Activity_viewreport.ToString().Substring(0,1).Equals("1")) { MessageBox.ShowAndRedirect(this, "您好,该序列号已经测试完成,将转入报告查看页面", "../Report/GenPdfReport.aspx?sn=" + userGUID); } else { MessageBox.ShowAndRedirect(this, "您好,该序列号已经测试完成", "Tlogin.aspx"); } } else if (0 == status || 1 == status)//正常,未使用过的序列号,或者正在测试的。 { if (activity != null) { //是否为禁用的活动状态 if (activity.Activity_status == 0) { MessageBox.ShowAndRedirect(this, "您好,您参加的测评项目未开启,请联系发放序列号的相关人员", "Tlogin.aspx"); } else { Session["isTesting"] = "true";//开始考试 if (status == 1 && CacheManager.Get("guid_" + userGUID) != null) { MessageBox.ShowAndRedirect(this, "将继续上次答题", "QuestionRepeat.aspx?guid=" + userGUID + "&logopath=" + activity.Activity_logo); } else { Response.Redirect("Introduce.aspx?guid=" + userGUID + "&logopath=" + activity.Activity_logo + "&weltext=" + activity.Activity_welcometext.Replace("\n", "") + "&atext=" + activity.Activity_content.Replace("\n", "") + "&ctext=" + activity.Activity_companyintrotext.Replace("\n", "")); } } } } else { MessageBox.ShowAndRedirect(this, "您好,该序列号无效", "Tlogin.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { ((SiteEnterpriseMaster)Master).InitMenu(); ((SiteEnterpriseMaster)Master).li1.Attributes.Add("class", "hover ccc"); ((SiteEnterpriseMaster)Master).b_hmenu1.Style.Clear(); ((SiteEnterpriseMaster)Master).b_hmenu2.Style.Add("display", "none"); ((SiteEnterpriseMaster)Master).b_hmenu3.Style.Add("display", "none"); ((SiteEnterpriseMaster)Master).b_hmenu4.Style.Add("display", "none"); ((SiteEnterpriseMaster)Master).s_menu1_1.Style.Add("COLOR", "#147ab8"); ((SiteEnterpriseMaster)Master).s_menu1_1.Style.Add("TEXT-DECORATION", "none"); if (Session["username"] == null) { Page.ClientScript.RegisterStartupScript(this.GetType(), "PopupScript", "<script>alert('请先登录系统!');top.location.href='../Enterprise/EnterpriseLogin.aspx';</script>"); return; } else { if (!IsPostBack) { if (Request["actid"] != null) { m_actid = Request["actid"].ToString(); ActivityBLL activityBll = new ActivityBLL(); EnterpriseUserBLL enterpriseUserBll = new EnterpriseUserBLL(); string username = Session["username"].ToString(); string enterpriseId = enterpriseUserBll.GetEnterpriseIdByUser(username); DataSet dsActivity = activityBll.GetActivityAll(enterpriseId); if (dsActivity != null) { ddlActivity.DataSource = dsActivity.Tables[0].DefaultView; ddlActivity.DataValueField = "activity_id"; ddlActivity.DataTextField = "activity_name"; ddlActivity.DataBind(); ddlActivity.SelectedValue = m_actid; } bind(Int32.Parse(m_actid)); } } } }
private void LoadDimSelected() { if (Request["mode"] != null) { _mode = Request["mode"].ToString(); if (!string.IsNullOrEmpty(_mode)) { if (Int32.Parse(_mode) == POSITION_DEFAULT_TYPE) { if (Request["posid"] != null) { _posID = Request["posid"].ToString(); PositionBLL pBll = new PositionBLL(); lblSpec.Text = "设置岗位默认维度: " + pBll.GetPositionNmById(Int32.Parse(_posID)); lblNotice.Text = string.Empty; LoadDimension(_posID, 0); } } else if (Int32.Parse(_mode) == ACTIVITY_CUSTOM_TYPE) { if (Request["actid"] != null) { _actID = Request["actid"].ToString(); ActivityBLL aBll = new ActivityBLL(); DataSet dsIncInfo = aBll.GetEUsrInfoByActivityId(Int32.Parse(_actID)); lblSpec.Text = "当前公司名称:" +"["+ dsIncInfo.Tables[0].Rows[0][1].ToString() +"]"+ " 当前测评项目名称: " + "[" + aBll.GetActivityNM(Int32.Parse(_actID)) + "]"; LoadDimension(_actID,1); grVDimensionSet.Columns[5].Visible = true; } } else { } } } }
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); } }
private void bind() { if (string.IsNullOrEmpty(Request.QueryString["users_id"])) { return; } ActivityBLL temp = new ActivityBLL(); DataSet ds = temp.GetActivityAll(Request.QueryString["users_id"]); if (ds == null) return; foreach (DataRow row in ds.Tables[0].Rows) { string aStatus = row["ACTIVITY_STATUS"].ToString(); if (aStatus.Equals("开启项目")) { row["ACTIVITY_STATUS"] = "已停止"; } else if (aStatus.Equals("停止项目")) { row["ACTIVITY_STATUS"] = "测试中"; } else { } } grVActivityManage.DataSource = ds.Tables[0].DefaultView; grVActivityManage.DataSourceID = null; grVActivityManage.DataBind(); temp = null; }
private void bind() { if (string.IsNullOrEmpty(username)) { return; } ActivityBLL temp = new ActivityBLL(); DataSet ds = temp.GetActivityByUser(username); grVActivityManage.DataSource = ds.Tables[0].DefaultView; grVActivityManage.DataSourceID = null; grVActivityManage.DataBind(); temp = null; }
private void SaveDimension(int mode) { int rowNo = 0; int rowSelected = 0; ArrayList dimIDArray = new ArrayList(); if (POSITION_DEFAULT_TYPE == mode)//设置【岗位】的默认维度。 { foreach (GridViewRow row in grVDimensionSet.Rows) { int dimID = (int)grVDimensionSet.DataKeys[rowNo].Value; CheckBox ck = (CheckBox)row.Cells[0].FindControl("CB_Select"); if (true == ck.Checked) { dimIDArray.Add(Int32.Parse(grVDimensionSet.DataKeys[rowNo].Value.ToString())); rowSelected++; } rowNo++; } for (int i = 0; i < dimIDArray.Count; i++) { Dimension dimTMP = _dimbll.GetDimension(dimIDArray[i].ToString()); string dimNM = dimTMP.Dimnm.Trim(); if (dimNM.Equals(DIM_SHCXX) || dimNM.Equals(DIM_XLJKD) || dimNM.Equals(DIM_CX)) { _dimbll.SetPositionDimension(Int32.Parse(Request["posid"].ToString()), Int32.Parse(dimIDArray[i].ToString()), 0);//社会称许性、心理健康度、诚信三个默认维度不计算权重。 } else { _dimbll.SetPositionDimension(Int32.Parse(Request["posid"].ToString()), Int32.Parse(dimIDArray[i].ToString()), (float)(1.0 / (rowSelected - 3)));//减去三个特殊维度后,再平均。 } } MessageBox.ShowAndRedirect(this, "维度设置成功", "PositionList.aspx"); } else if (ACTIVITY_CUSTOM_TYPE == mode)//设置【活动】的维度。 { //权重之和为1移交前台js检查->王聪慧2011.11.6 //float dimWeightSum = 0; //foreach (GridViewRow r in grVDimensionSet.Rows) //{ // CheckBox ck = (CheckBox)r.Cells[0].FindControl("CB_Select"); // if (true == ck.Checked) // { // TextBox txt = (TextBox)r.Cells[5].FindControl("txtbEdit"); // dimWeightSum += float.Parse(string.IsNullOrEmpty(txt.Text) ? "0" : txt.Text); // } //} //if (dimWeightSum != 1) //{ // MessageBox.ShowAndRedirect(this, "请确认所选维度的权重总和为1", "EnterpriseUserList.aspx"); // return; //} foreach (GridViewRow row in grVDimensionSet.Rows) { CheckBox ck = (CheckBox)row.Cells[0].FindControl("CB_Select"); if (true == ck.Checked) { TextBox txt = (TextBox)row.Cells[5].FindControl("txtbEdit"); _dimbll.SetActivityDimension(Int32.Parse(Request["actid"].ToString()), int.Parse(grVDimensionSet.DataKeys[row.RowIndex].Values[0].ToString()), float.Parse(txt.Text)); } } ActivityBLL aBll = new ActivityBLL(); DataSet dsEUsrInfo = aBll.GetEUsrInfoByActivityId(Int32.Parse(Request.QueryString["actid"])); MessageBox.ShowAndRedirect(this, "维度设置成功", "ActivityList.aspx?users_id=" + dsEUsrInfo.Tables[0].Rows[0][0].ToString()); } }
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(int aID) { ActivityBLL activityBll = new ActivityBLL(); Activity activity = activityBll.GetModel(aID); int nPartFlag = activity.Activity_viewreport; if (nPartFlag.ToString().Length != 7) { return; } else { if (nPartFlag.ToString().Substring(0, 1).Equals("1")) { RadioButtonList1.SelectedValue = "是"; } else { RadioButtonList1.SelectedValue = "否"; } //chkViewable.Checked = (nPartFlag.ToString().Substring(0, 1).Equals("1")); CheckBox1.Checked = (nPartFlag.ToString().Substring(1, 1).Equals("1")); CheckBox2.Checked = (nPartFlag.ToString().Substring(2, 1).Equals("1")); CheckBox3.Checked = (nPartFlag.ToString().Substring(3, 1).Equals("1")); CheckBox4.Checked = (nPartFlag.ToString().Substring(4, 1).Equals("1")); CheckBox5.Checked = (nPartFlag.ToString().Substring(5, 1).Equals("1")); CheckBox6.Checked = (nPartFlag.ToString().Substring(6, 1).Equals("1")); } }
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(); } } } }
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(); } }