public static void Setup(int testItems) { SetTestRepo(); for (int i = 0; i < testItems; i++) { V_Position_Branch item = new V_Position_Branch(); _testRepo._items.Add(item); } }
public override bool Equals(object obj) { if (obj.GetType() == typeof(V_Position_Branch)) { V_Position_Branch compare = (V_Position_Branch)obj; return(compare.KeyValue() == this.KeyValue()); } else { return(base.Equals(obj)); } }
public static V_Position_Branch SingleOrDefault(Expression <Func <V_Position_Branch, bool> > expression, string connectionString, string providerName) { var repo = GetRepo(connectionString, providerName); var results = repo.Find(expression); V_Position_Branch single = null; if (results.Count() > 0) { single = results.ToList()[0]; } return(single); }
public static V_Position_Branch SingleOrDefault(Expression <Func <V_Position_Branch, bool> > expression) { var repo = GetRepo(); var results = repo.Find(expression); V_Position_Branch single = null; if (results.Count() > 0) { single = results.ToList()[0]; single.OnLoaded(); single.SetIsLoaded(true); single.SetIsNew(false); } return(single); }
void Init() { TestMode = this._db.DataProvider.ConnectionString.Equals("test", StringComparison.InvariantCultureIgnoreCase); _dirtyColumns = new List <IColumn>(); if (TestMode) { V_Position_Branch.SetTestRepo(); _repo = _testRepo; } else { _repo = new SubSonicRepository <V_Position_Branch>(_db); } tbl = _repo.GetTable(); SetIsNew(true); OnCreated(); }
internal static IRepository <V_Position_Branch> GetRepo(string connectionString, string providerName) { Solution.DataAccess.DataModel.SolutionDataBase_standardDB db; if (String.IsNullOrEmpty(connectionString)) { db = new Solution.DataAccess.DataModel.SolutionDataBase_standardDB(); } else { db = new Solution.DataAccess.DataModel.SolutionDataBase_standardDB(connectionString, providerName); } IRepository <V_Position_Branch> _repo; if (db.TestMode) { V_Position_Branch.SetTestRepo(); _repo = _testRepo; } else { _repo = new SubSonicRepository <V_Position_Branch>(db); } return(_repo); }
public static void Setup(int testItems) { SetTestRepo(); for(int i=0;i<testItems;i++){ V_Position_Branch item=new V_Position_Branch(); _testRepo._items.Add(item); } }
public static void Setup(V_Position_Branch item) { SetTestRepo(); _testRepo._items.Add(item); }
/// <summary> /// 添加与编辑V_Position_Branch记录 /// </summary> /// <param name="page">当前页面指针</param> /// <param name="model">V_Position_Branch表实体</param> /// <param name="content">更新说明</param> /// <param name="isCache">是否更新缓存</param> /// <param name="isAddUseLog">是否添加用户操作日志</param> public void Save(Page page, V_Position_Branch 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 ? "添加" : "编辑") + "V_Position_Branch记录成功,ID为【" + model.Id + "】"; } //添加用户访问记录 UseLogBll.GetInstence().Save(page, content); } } catch (Exception e) { var result = "执行V_Position_BranchBll.Save()函数出错!"; //出现异常,保存出错日志信息 CommonBll.WriteLog(result, e); } }
/// <summary> /// 将V_Position_Branch记录实体(SubSonic实体)转换为普通的实体(DataAccess.Model.V_Position_Branch) /// </summary> /// <param name="model">SubSonic插件生成的实体</param> /// <returns>DataAccess.Model.V_Position_Branch</returns> public DataAccess.Model.V_Position_Branch Transform(V_Position_Branch model) { if (model == null) return null; return new DataAccess.Model.V_Position_Branch { Code = model.Code, Id = model.Id, Name = model.Name, Branch_Id = model.Branch_Id, Branch_Code = model.Branch_Code, Branch_Name = model.Branch_Name, PagePower = model.PagePower, ControlPower = model.ControlPower, IsSetBranchPower = model.IsSetBranchPower, SetBranchCode = model.SetBranchCode, Manager_Id = model.Manager_Id, Manager_CName = model.Manager_CName, UpdateDate = model.UpdateDate, }; }
/// <summary> /// 更新IIS缓存中指定Id记录 /// </summary> /// <param name="model">记录实体</param> public void SetModelForCache(V_Position_Branch model) { SetModelForCache(Transform(model)); }
public static void Setup(V_Position_Branch item) { SetTestRepo(); _testRepo._items.Add(item); }