Example #1
0
        /// <summary>
        /// 获取新闻列表信息
        /// </summary>
        /// <returns></returns>
        private Hashtable GetViewList(HttpContext context)
        {
            Hashtable htRet   = new Hashtable();
            Hashtable rowData = new Hashtable();

            try
            {
                FastReadServer.admin.UserInfo user = (FastReadServer.admin.UserInfo)context.Session[FastReadServer.admin.CConst.CSession.C_UserInfoKey];
                if (user == null || user.UserId == "")
                {
                    htRet["msg"] = "用户信息超时,请重新登录!";
                    htRet["ok"]  = false;
                    return(htRet);
                }

                string sViewType = CConvert.ToString(context.Request["vt"]);
                string sKey      = CConvert.ToString(context.Request["key"]);
                int    iLimit    = CConvert.ToInt32(context.Request["limit"]);
                int    iPage     = CConvert.ToInt32(context.Request["page"]);

                int     allRows = 0;
                DBIndex dbm     = new DBIndex();
                DataSet ds      = dbm.GetViewList(sViewType, sKey, iPage, iLimit, ref allRows);
                if (ds.Tables[0].Rows.Count == 0)
                {
                    htRet["ok"]  = true;
                    htRet["cnt"] = 0;
                    htRet["msg"] = "无数据!";
                }
                else
                {
                    ArrayList lst = new ArrayList();
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        Hashtable htItem = new Hashtable();

                        htItem["title"]        = CConvert.ToString(dr["title"]);
                        htItem["create_time"]  = CConvert.ToString(dr["create_time"]);
                        htItem["viewtrain_id"] = CConvert.ToString(dr["viewtrain_id"]);
                        htItem["photo"]        = CConvert.ToString(dr["photo"]);
                        htItem["content"]      = CConvert.ToString(dr["content"]);
                        htItem["route"]        = CConvert.ToString(dr["route"]);
                        htItem["desc"]         = CConvert.ToString(dr["v_desc"]);
                        htItem["vt_type"]      = CConvert.ToString(dr["vt_type"]);
                        switch (CConvert.ToString(dr["vt_type"]))
                        {
                        case "1":
                            htItem["vt_name"] = "视点移动训练";
                            break;

                        case "2":
                            htItem["vt_name"] = "视幅扩展训练";
                            break;

                        case "3":
                            htItem["vt_name"] = "瞬间感知能力";
                            break;
                        }
                        lst.Add(htItem);
                    }

                    htRet["ok"]      = true;
                    htRet["lst"]     = lst;
                    htRet["cnt"]     = allRows;
                    htRet["curpage"] = iPage;
                }
            }
            catch (Exception ex)
            {
                htRet["err"] = true;
                htRet["msg"] = "获取轮播信息失败!" + ex.Message;
            }
            return(htRet);
        }