コード例 #1
0
ファイル: IndexHandke.cs プロジェクト: bookxiao/orisoft
        /// <summary>
        /// 根据关键字查询课程信息
        /// </summary>
        /// <param name="context"></param>
        private void GetTeachInfo(HttpContext context)
        {
            BLL.SysManage.UsersExp ubll = new BLL.SysManage.UsersExp();

            string uid = context.Request.Params["uid"];
            JsonObject json = new JsonObject();
            if (!string.IsNullOrEmpty(uid))
            {
                List<Maticsoft.Model.UserExp.UsersExp> list = ubll.GetModelList(int.Parse(uid));
                if (list.Count > 0)
                {
                    JsonArray data = new JsonArray();
                    list.ForEach(info => data.Add(
                        new JsonObject(
                            new string[] { "UserAvatar", "Tags" },
                            new object[] { info.UserAvatar, info.Tags }
                            )));
                    json.Put(TAO_KEY_STATUS, TAO_STATUS_SUCCESS);
                    json.Put(TAO_KEY_DATA, data);
                }
            }
            else
            {
                json.Put(TAO_KEY_STATUS, TAO_STATUS_FAILED);
            }
            context.Response.Write(json.ToString());
        }
コード例 #2
0
ファイル: IndexHandke.cs プロジェクト: bookxiao/orisoft
        /// <summary>
        /// 根据关键字查询课程信息
        /// </summary>
        /// <param name="context"></param>
        private void GetTeacherByKEY(HttpContext context)
        {
            BLL.SysManage.UsersExp ubll = new BLL.SysManage.UsersExp();
            int RowCount = 0;
            int PageCount = 0;

            string strIKey = context.Request.Params["StrKey"];
            string strPi = context.Request.Params["pageIndex"];
            int intPi = 0;
            if (!int.TryParse(strPi, out intPi))//将字符串页码 转成 整型页码,如果失败,设置页码为1
            {
                intPi = 1;
            }
            int intPz = 7;

            JsonObject json = new JsonObject();
            if (!string.IsNullOrEmpty(strIKey))
            {
                List<Maticsoft.Model.SysManage.Users> list = ubll.GetListByTeacherkey(out RowCount, out PageCount, strIKey, intPi, intPz);
                if (list.Count > 0)
                {
                    JsonArray data = new JsonArray();
                    list.ForEach(info => data.Add(
                        new JsonObject(
                            new string[] { "UserID", "UesrName", "TrueName" },
                            new object[] { info.UserID, info.UserName, info.TrueName }
                            )));
                    json.Put(TAO_KEY_STATUS, TAO_STATUS_SUCCESS);
                    json.Put(TAO_KEY_DATA, data);
                }
                json.Put("ROWCOUNT", RowCount);
                json.Put("PAGECOUNT", PageCount);
            }
            else
            {
                json.Put(TAO_KEY_STATUS, TAO_STATUS_FAILED);
            }
            context.Response.Write(json.ToString());
        }