예제 #1
0
파일: LibCache.cs 프로젝트: lcx19910911/qyz
        /// <summary>
        /// 获取字典model类
        /// </summary>
        /// <param name="bianhao"></param>
        /// <returns></returns>
        public static Model.TcZidian get_zidian(int id)
        {
            var m    = new Model.TcZidian();
            var list = new List <Model.TcZidian>();

            if (HttpContext.Current.Cache[tc_zidian] == null)
            {
                list = BLL.TcZidian.Instance.GetModelList("");
                HttpContext.Current.Cache.Insert(tc_zidian, list, null, DateTime.Now.AddDays(c_day), TimeSpan.Zero);
            }
            else
            {
                list = (List <Model.TcZidian>)HttpContext.Current.Cache[tc_zidian];
            }
            if (list.Count(p => p.ID == id) > 0)
            {
                return(list.First(p => p.ID == id));
            }
            else
            {
                return(m);
            }
        }
예제 #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Tc.Model.TcZidian model)
 {
     return(dal.Update(model));
 }
예제 #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Tc.Model.TcZidian model)
 {
     return(dal.Add(model));
 }