public void ProcessRequest(HttpContext context)
 {
     evalItem evalItem = new evalItem();
     JsonModel jsonModel = new JsonModel();
     PagedDataModelNew<evalItem> jsonPagedDataModel = new PagedDataModelNew<evalItem>();
     jc_Public jcPublic = new jc_Public();
     jc_EvaluateCourse jcEvaluateCourseBF=new jc_EvaluateCourse();
     int totalcount = 0;
     var evalCourseId = context.Request.QueryString["evalCourseId"];
     var PageIndex = context.Request.QueryString["PageIndex"];
     var PageSize = context.Request.QueryString["PageSize"];
     if (string.IsNullOrEmpty(evalCourseId) || string.IsNullOrEmpty(PageIndex) ||
         string.IsNullOrEmpty(PageSize))
     {
         jsonModel.Status = "0";
         jsonModel.Message = "缺少必要参数!";
     }
     else
     {
         jsonPagedDataModel.EvaluateCourse=jcEvaluateCourseBF.GetModel(int.Parse(evalCourseId));
         string strWhere = "and c.evalCourseId=" + evalCourseId ;
         string strSql = @"  SELECT c.evalCourseId,
                            c.evalSurveryId,
                            c.evalCourseName,
                            s.evalSurveryName,
                            m.evalItemName,
                            d.evalItemName as evalItemCategory,
                            m.evalItemId
                       FROM jc_EvaluateCourse c,
                            jc_EvaluateSurvey s,
                            jc_EvaluateSurveyItem i,
                            jc_EvaluateItem m,
                            jc_EvaluateItem d
                      WHERE     c.evalSurveryId = s.evalSurveryId
                            AND s.evalSurveryId = i.evalSurveryId
                            AND i.evalItemId = m.evalItemId
                            AND m.evalParentItemId=d.evalItemId ";
         jsonPagedDataModel.PagedData = evalItem.GetEvalItemList(jcPublic.GetList(strSql + strWhere, "evalItemId",
                int.Parse(PageIndex), int.Parse(PageSize), out totalcount).Tables[0]);
         jsonPagedDataModel.PageCount = totalcount / int.Parse(PageSize);
         jsonPagedDataModel.PageIndex = int.Parse(PageIndex);
         jsonPagedDataModel.RowCount = totalcount;
         jsonModel.Data = jsonPagedDataModel;
         jsonModel.Status = "1";
         jsonModel.Message = "查询成功!";
     }
     var js = new JavaScriptSerializer();
     context.Response.Write(js.Serialize(jsonModel));
 }
Exemple #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public evalItem DataRowToModel(DataRow row)
        {
            evalItem model = new evalItem();
            if (row != null)
            {
                if (row["evalCourseId"] != null && row["evalCourseId"].ToString() != "")
                {
                    model.evalCourseId = int.Parse(row["evalCourseId"].ToString());
                }
                if (row["evalSurveryId"] != null && row["evalSurveryId"].ToString() != "")
                {
                    model.evalSurveryId = int.Parse(row["evalSurveryId"].ToString());
                }
                if (row["evalCourseName"] != null)
                {
                    model.evalCourseName = row["evalCourseName"].ToString();
                }
                if (row["evalSurveryName"] != null)
                {
                    model.evalSurveryName = row["evalSurveryName"].ToString();
                }
                if (row["evalItemName"] != null)
                {
                    model.evalItemName = row["evalItemName"].ToString();
                }
                if (row["evalItemId"] != null && row["evalItemId"].ToString() != "")
                {
                    model.evalItemId = int.Parse(row["evalItemId"].ToString());
                }

               // ------------------------------------------
                //if (row["evalCourseDate"] != null && row["evalCourseDate"].ToString() != "")
                //{
                //    model.evalCourseDate = row["evalCourseDate"].ToString();
                //}

                //if (row["evalCourseAddress"] != null && row["evalCourseAddress"].ToString() != "")
                //{
                //    model.evalCourseAddress =row["evalCourseAddress"].ToString();
                //}

                //if (row["evalCourseNumber"] != null && row["evalCourseNumber"].ToString() != "")
                //{
                //    model.evalCourseNumber = int.Parse(row["evalCourseNumber"].ToString());
                //}

                if (row["evalItemCategory"] != null && row["evalItemCategory"].ToString() != "")
                {
                    model.evalCourseCategory = row["evalItemCategory"].ToString();
                }

                //if (row["evalCourseContent"] != null && row["evalCourseContent"].ToString() != "")
                //{
                //    model.evalCourseCategory = row["evalCourseContent"].ToString();
                //}

                //if (row["evalCourseTeacher"] != null && row["evalCourseTeacher"].ToString() != "")
                //{
                //    model.evalCourseTeacher = row["evalCourseTeacher"].ToString();
                //}

            }
            return model;
        }