コード例 #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));
 }