Beispiel #1
0
        private void SetValue()
        {
            try
            {
                var courseId = Guid.Empty;
                var coursebll = new BLL.Course();
                if (!string.IsNullOrEmpty(Request.QueryString["cid"]))
                {
                    courseId = new Guid(Request.QueryString["cid"]);
                    hCourseid.Value = courseId.ToString();
                }
                else //取个默认的
                {
                    courseId = coursebll.GetTop1Guid();
                    hCourseid.Value = courseId.ToString();
                }

                var courseModel = coursebll.GetModel(courseId);
                courseName.InnerText = courseModel.CourseName;
                coursePlace.InnerText = courseModel.TeachPlace;
                teacherName.InnerText = courseModel.TeacherName;
                trainTime.InnerText = courseModel.TeachTime;

                var question = new BLL.Questionnaire();
                var dsResult = question.GetReportTile(courseId);
                if (dsResult != null && dsResult.Tables.Count > 0)
                {
                    var row = dsResult.Tables[0].Rows[0];
                    spTotalAvg.InnerText = string.Format("{0:N2}", row["totalAvg"]) + " 分(满分52)";
                    satisfaction.InnerText =Convert.ToDouble(row["Satisfy"])>=1.0? "100%": string.Format("{0:N2}" + "%", ((Convert.ToDecimal(row["Satisfy"])) * 100));
                    level.InnerText = question.GetLevel((Convert.ToDouble(row["Satisfy"])));
                }

                var dsrr = question.GetTotalReport();
                if (dsrr != null && dsrr.Rows.Count > 0)
                {
                    var result = dsrr.Select(string.Format(" CourseId='{0}'",courseId));
                    if (result.Length > 0)
                    {
                        divCourseContent.InnerText = Convert.ToDouble(result[0]["TotalCourse"]) >= 1.0 ? "100%" : string.Format("{0:N2}" + "%", ((Convert.ToDecimal(result[0]["TotalCourse"])) * 100));
                        divTeacher.InnerText = Convert.ToDouble(result[0]["TotalTeacher"]) >= 1.0 ? "100%" : string.Format("{0:N2}" + "%", ((Convert.ToDecimal(result[0]["TotalTeacher"])) * 100));
                        divOrg.InnerText = Convert.ToDouble(result[0]["TotalOrg"]) >= 1.0 ? "100%" : string.Format("{0:N2}" + "%", ((Convert.ToDecimal(result[0]["TotalOrg"])) * 100));
                    }
                }

                //var totalAvg = question.GetTotalAvg(courseId.ToString());
                //spTotalAvg.InnerText = totalAvg.ToString();
                //satisfaction.InnerText = string.Format("{0:N2}" + "%", (((float) totalAvg/52)*100));
                //level.InnerText = question.GetLevel(((float)totalAvg / 52));

                var statifyPercent = question.GetSatisfyPercent(courseId);
                if (statifyPercent != null)
                {
                    htp1.Value = string.Format("{0:N2}", ((statifyPercent[0])*100));
                    htp2.Value = string.Format("{0:N2}", ((statifyPercent[1]) * 100));
                    htp3.Value = string.Format("{0:N2}", ((statifyPercent[2]) * 100));
                    htp4.Value = string.Format("{0:N2}", ((statifyPercent[3]) * 100));
                    htp5.Value = string.Format("{0:N2}", ((statifyPercent[4]) * 100));
                  //  nofinish.InnerText = statifyPercent[5].ToString();

                    totalPeople.InnerText = statifyPercent[6].ToString()+" 人";
                    totalDone.InnerText = statifyPercent[7].ToString() + " 人";

                    evProgress.InnerText = string.Format("{0:N2}%", ((statifyPercent[7] / statifyPercent[6]) * 100));

                }

                SetDetail(courseId);

                #region old tendency

                //var tendency = question.GetTendency(courseId);
                //if (tendency != null)
                //{
                //    htot1.Value = string.Format("{0:N2}", ((tendency[0]) ));
                //    htot2.Value = string.Format("{0:N2}", ((tendency[1])));
                //    htot3.Value = string.Format("{0:N2}", ((tendency[2])));
                //    htot4.Value = string.Format("{0:N2}", ((tendency[3])));
                //    htot5.Value = string.Format("{0:N2}", ((tendency[4])));
                //}

                #endregion

                #region old the six

                //var theTop6 = question.GetTheSix(courseId, true);
                //if (theTop6 != null)
                //{
                //    var result = new StringBuilder();
                //    var i = 0;
                //    foreach (var thetop in theTop6)
                //    {
                //        i++;
                //        result.Append(i + "、" + thetop + @"<br>");

                //    }
                //    top6.InnerHtml = result.ToString();

                //}

                //var theBottom6 = question.GetTheSix(courseId, false);
                //if (theBottom6 != null)
                //{
                //    var result = new StringBuilder();
                //    var i = 0;
                //    foreach (var thebop in theBottom6)
                //    {
                //        i++;
                //        result.Append(i + "、" + thebop + @"<br>");

                //    }
                //    bot6.InnerHtml = result.ToString();
                //}

                #endregion
            }
            catch (Exception ex)
            {
                LogHelper.WriteLogofExceptioin(ex);
            }
        }