Exemplo n.º 1
0
        //[LoginFilterAttribute]
        public ActionResult PaperInfo(long id)
        {
            dto_Paper p = B_Paper.GetPaper(id);
            bool      b = B_Paper.IsPaperSubmited(id, UserId);

            ViewBag.CourseId   = p == null ? 0 : p.CourseId;
            ViewBag.PaperName  = p == null ? "" : p.Title;
            ViewBag.PaperId    = id;
            ViewBag.IsSubmited = b;
            return(View());
        }
Exemplo n.º 2
0
        public static dto_Paper GetPaper(int paperId)
        {
            dto_Paper p = null;

            using (MySqlDataReader dr = MySqlHelper.ExecuteReader(Util.GetConnectString(QuesConnString),
                                                                  "select PaperId, CourseId, TypeId, GradeId, AreaId, PaperYear, Title, QIds from T_Paper where PaperId = @PaperId",
                                                                  "@PaperId".ToInt32InPara(paperId)))
            {
                if (dr != null && dr.HasRows)
                {
                    p = MySqlDBHelper.ConvertDataReaderToEntitySingle <dto_Paper>(dr);
                }
            }
            return(p);
        }
Exemplo n.º 3
0
        private static int[] GetPaperQuesIds(int paperId)
        {
            dto_Paper p = D_PaperRedis.GetPaper(paperId);

            if (p == null)
            {
                return(null);
            }
            if (p.QIds == "")
            {
                return(null);
            }

            string[] s = p.QIds.Split(',');

            int[] result = Array.ConvertAll(s, new Converter <string, int>(StringToInt));
            return(result);
        }
Exemplo n.º 4
0
        public static dto_Paper GetPaper(int paperId)
        {
            dto_Paper tempresult = null;
            string    key        = RedisHelper.GetEasyZyRedisKey(CacheCatalog.Paper, paperId.ToString());

            using (var client = RedisHelper.Instance.GetRedisClient(CacheCatalog.Paper.ToString()))
            {
                if (client != null)
                {
                    tempresult = client.Get <dto_Paper>(key);
                    if (tempresult == null)
                    {
                        tempresult = D_Paper.GetPaper(paperId);
                        if (tempresult != null)
                        {
                            client.Set(key, tempresult, ts);
                        }
                    }
                }
            }

            return(tempresult);
        }