Example #1
0
 public void ProcessRequest(HttpContext context)
 {
     var jsonModel = new JsonModel();
     var jcUserBF = new jc_User();
     var userName = context.Request.Form["userName"];
     var userPwd = context.Request.Form["userPwd"];
     if (string.IsNullOrEmpty(userName) || string.IsNullOrEmpty(userPwd))
     {
         jsonModel.Status = "0";
         jsonModel.Message = "用户名密码不能为空!";
     }
     else
     {
         var loginUser = jcUserBF.GetModelByUsername(userName,
             FormsAuthentication.HashPasswordForStoringInConfigFile(userPwd, "MD5"));
         if (loginUser == null)
         {
             jsonModel.Status = "0";
             jsonModel.Message = "用户名或密码错误!";
         }
         else
         {
             jsonModel.Data = loginUser;
             jsonModel.Status = "1";
             jsonModel.Message = "登录成功!";
         }
     }
     var js = new JavaScriptSerializer();
     context.Response.Write(js.Serialize(jsonModel));
 }
 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));
 }
 public void ProcessRequest(HttpContext context)
 {
     evalCourse evalCourse = new evalCourse();
     JsonModel jsonModel = new JsonModel();
     PagedDataModel<evalCourse> jsonPagedDataModel = new PagedDataModel<evalCourse>();
     jc_Public jcPublic = new jc_Public();
     int totalcount = 0;
     var userId = context.Request.QueryString["userId"];
     var evalStatus = context.Request.QueryString["evalStatus"];
     var PageIndex = context.Request.QueryString["PageIndex"];
     var PageSize = context.Request.QueryString["PageSize"];
     if (string.IsNullOrEmpty(userId) || string.IsNullOrEmpty(evalStatus) || string.IsNullOrEmpty(PageIndex) ||
         string.IsNullOrEmpty(PageSize))
     {
         jsonModel.Status = "0";
         jsonModel.Message = "缺少必要参数!";
     }
     else
     {
         string strWhere = "and u.evalUserId=" + userId + " and u.evalStatus=" + evalStatus;
         string strSql = @" SELECT u.evalUserId, c.evalCourseName, c.evalCourseTeacher,
                          c.evalCourseDate,u.evalStatus,c.evalCourseId, c.evalSurveryId
                         FROM   jc_EvaluateCourseUser u, jc_EvaluateCourse c
                         WHERE  u.evalCourseId = c.evalCourseId ";
         jsonPagedDataModel.PagedData = evalCourse.GetevalCourseList(jcPublic.GetList(strSql + strWhere, "evalUserId",
                int.Parse(PageIndex), int.Parse(PageSize), out totalcount).Tables[0]);
         jsonPagedDataModel.PageCount = totalcount / int.Parse(PageIndex);
         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));
 }
        public void ProcessRequest(HttpContext context)
        {
            string userId = context.Request.QueryString["userId"];
            string evalCourseId = context.Request.QueryString["evalCourseId"];
            string surveryId = context.Request.QueryString["evalSurveryId"];
            string evalResult = context.Request.QueryString["evalResult"];
            string evalAdvice = context.Request.QueryString["evalAdvice"];
            var jsonModel = new JsonModel();
            bool result = true;
            if (string.IsNullOrEmpty(userId) || string.IsNullOrEmpty(evalCourseId) || string.IsNullOrEmpty(surveryId) ||
                string.IsNullOrEmpty(evalResult))
            {
                jsonModel.Status = "0";
                jsonModel.Message = "缺少必要参数!";
            }
            else
            {
                string[] evalItem = evalResult.Split(';');
                if (evalItem.Length == 0)
                {

                    jsonModel.Status = "0";
                    jsonModel.Message = "evalResult参数格式错误!";
                }
                else
                {
                    for (int i = 0; i < evalItem.Length; i++)
                    {
                        string[] evalItem2 = evalItem[i].Split(',');
                        if (evalItem2.Length == 2)
                        {
                            result = jcEvaluateResult.Merge(new SHMetroTestSysModel.jc_EvaluateResult()
                            {
                                evalCourseId = int.Parse(evalCourseId),
                                evalItemId = int.Parse(evalItem2[0]),
                                evalSurveryId = int.Parse(surveryId),
                                evalUserId = int.Parse(userId),
                                evalResult = evalItem2[1]
                            }) && result;
                        }
                    }
                    if (result)
                    {
                        string strsql = @"select evalCourseUserId from jc_EvaluateCourseUser where evalUserId=" + userId + "and evalCourseId=" + evalCourseId;
                        DataTable dt = jcPublicBF.GetDataSet(strsql).Tables[0];
                        if (dt.Rows.Count == 1)
                        {
                            if (jcEvaluateCourseUserBF.FinishEval(int.Parse(dt.Rows[0]["evalCourseUserId"].ToString()), evalAdvice))
                            {
                                jsonModel.Data = "";
                                jsonModel.Status = "1";
                                jsonModel.Message = "评价成功!";
                            }
                            else
                            {
                                jsonModel.Data = "";
                                jsonModel.Status = "0";
                                jsonModel.Message = "评价失败!";
                            }
                        }
                        else
                        {
                            jsonModel.Data = "";
                            jsonModel.Status = "0";
                            jsonModel.Message = "评价失败!";
                        }

                    }
                    else
                    {
                        jsonModel.Data = "";
                        jsonModel.Status = "0";
                        jsonModel.Message = "评价失败!";
                    }
                }

            }

            var js = new JavaScriptSerializer();
            context.Response.Write(js.Serialize(jsonModel));
        }