示例#1
0
        /// <summary>
        /// 获取新闻列表信息
        /// </summary>
        /// <returns></returns>
        private Hashtable GetTrain(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 sType  = CConvert.ToString(context.Request["tp"]);
                string sSpeed = CConvert.ToString(context.Request["speed"]);
                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.GetTrainList(sType, sSpeed, 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["train_id"]    = CConvert.ToString(dr["train_id"]);
                        htItem["photo"]       = CConvert.ToString(dr["photo"]);
                        htItem["content"]     = CConvert.ToString(dr["content"]);
                        htItem["words"]       = CConvert.ToString(dr["words"]);
                        htItem["speed"]       = CConvert.ToString(dr["speed"]);
                        htItem["speedname"]   = CConvert.ToString(dr["speedname"]);
                        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);
        }