Esempio n. 1
0
 public static void Setup(int testItems)
 {
     SetTestRepo();
     for(int i=0;i<testItems;i++){
         Rank item=new Rank();
         _testRepo._items.Add(item);
     }
 }
Esempio n. 2
0
 public static void Setup(Rank item)
 {
     SetTestRepo();
     _testRepo._items.Add(item);
 }
Esempio n. 3
0
        /// <summary>
        /// 添加与编辑Rank记录
        /// </summary>
        /// <param name="page">当前页面指针</param>
        /// <param name="model">Rank表实体</param>
        /// <param name="content">更新说明</param>
        /// <param name="isCache">是否更新缓存</param>
        /// <param name="isAddUseLog">是否添加用户操作日志</param>
        public void Save(Page page, Rank model, string content = null, bool isCache = true, bool isAddUseLog = true)
        {
            try {
                //保存
                model.Save();

                //判断是否启用缓存
                if (CommonBll.IsUseCache() && isCache)
                {
                    SetModelForCache(model);
                }

                if (isAddUseLog)
                {
                    if (string.IsNullOrEmpty(content))
                    {
                        content = "{0}" + (model.Id == 0 ? "添加" : "编辑") + "Rank记录成功,ID为【" + model.Id + "】";
                    }

                    //添加用户访问记录
                    CommonBll.WriteLog(content);
                    //UseLogBll.GetInstence().Save(page, content);
                }
            }
            catch (Exception e) {
                var result = "执行RankBll.Save()函数出错!";

                //出现异常,保存出错日志信息
                CommonBll.WriteLog(result, e);
            }
        }
Esempio n. 4
0
 /// <summary>
 /// 更新IIS缓存中指定Id记录
 /// </summary>
 /// <param name="model">记录实体</param>
 public void SetModelForCache(Rank model)
 {
     SetModelForCache(Transform(model));
 }
Esempio n. 5
0
        /// <summary>
        /// 将Rank记录实体(SubSonic实体)转换为普通的实体(DataAccess.Model.Rank)
        /// </summary>
        /// <param name="model">SubSonic插件生成的实体</param>
        /// <returns>DataAccess.Model.Rank</returns>
        public DataAccess.Model.Rank Transform(Rank model)
        {
            if (model == null)
                return null;

            return new DataAccess.Model.Rank
            {

                Id = model.Id,

                RankLevel = model.RankLevel,

                RankCName = model.RankCName,

                RankEName = model.RankEName,

            };
        }