Esempio n. 1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            //context.Response.Write("Hello World");
            string studNo, courseID, studScore;

            studNo    = context.Request["studNo"].ToString();
            courseID  = context.Request["courseID"].ToString();
            studScore = context.Request["studScore"].ToString();
            BLL.StudScoreInfo   scoreServer = new BLL.StudScoreInfo();
            Model.StudScoreInfo score       = new Model.StudScoreInfo();
            score.courseID  = courseID;
            score.studNo    = studNo;
            score.studScore = Decimal.Parse(studScore);
            bool isSuccess = scoreServer.Add(score);

            if (isSuccess)
            {
                context.Response.Write("ok");
            }
            else
            {
                context.Response.Write("不ok");
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            //context.Response.Write("Hello World");
            List <Model.StudScoreInfo> scoreList = new List <Model.StudScoreInfo>();

            BLL.StudScoreInfo scoreServer = new BLL.StudScoreInfo();
            int    pageSize     = 12;
            int    pageIndex    = int.Parse(context.Request["pageIndex"].ToString());
            int    totalCount   = scoreServer.GetRecordCount(string.Empty);
            string pagination   = CreatePagination.ShowPageNavigate(pageSize, pageIndex, totalCount);
            var    scoreDataSet = scoreServer.GetListByPage(string.Empty, string.Empty, (pageIndex - 1) * pageSize, pageIndex * pageSize);

            scoreList = scoreServer.DataTableToList(scoreDataSet.Tables[0]);
            var    scoreListAndJson = new { studList = scoreList, pagination = pagination };
            string json             = new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(scoreListAndJson);

            context.Response.Write(json);
        }