public PowerActionFilterAttribute() { IHibernateOper hibernateOper = HibernateFactory.GetInstance(); empModFuncOper = new TbBaseOper <EmpModFunc>(hibernateOper, typeof(EmpModFunc)); empModOper = new TbBaseOper <EmpMod>(hibernateOper, typeof(EmpMod)); }
public BaseController() { try { //获取数据库操作对象 HibernateOper = HibernateFactory.GetInstance(); } catch (Exception e) { throw e; } }
/// <summary> /// 由OpenId得到客户 /// </summary> /// <param name="hibernateOper"></param> /// <param name="openId"></param> /// <returns></returns> public static Customer GetCust(IHibernateOper hibernateOper, string openId) { Customer retVal = null; Exec(hibernateOper, delegate(ISession s){ //查找客户openId retVal = GetCust(s, openId); } ); return(retVal); }
/// <summary> /// 由OpenId得到客户 /// </summary> /// <param name="hibernateOper"></param> /// <param name="openId"></param> /// <returns></returns> public static Customer GetCust(IHibernateOper hibernateOper, string openId) { Customer retVal = null; Exec(hibernateOper, delegate(ISession s){ //查找客户openId retVal = GetCust(s, openId); } ); return retVal; }
/// <summary> /// 获取最短距离的分店 /// </summary> /// <param name="hibernateOper"></param> /// <param name="loc">地址</param> /// <param name="maxDist">最长距离</param> /// <returns></returns> public static Department GetMinDistDept(IHibernateOper hibernateOper, TbLocation loc, double maxDist) { Department retVal = null; Exec(hibernateOper, delegate(ISession s) { //查找地址码 retVal = GetMinDistDept(s, loc, maxDist); } ); return(retVal); }
/// <summary> /// 由地址码获取地址全称 /// </summary> /// <param name="hibernateOper"></param> /// <param name="code"></param> /// <returns></returns> public static string GetAddrForCode(IHibernateOper hibernateOper, string code) { string retVal = null; Exec(hibernateOper, delegate(ISession s) { //查找地址码 retVal = GetAddrForCode(s, code); } ); return(retVal); }
public static Employee GetEmployee(IHibernateOper hibernateOper, string code) { Employee retVal = null; Exec(hibernateOper, delegate(ISession s) { //查找员工工号 retVal = GetEmployee(s, code); } ); return(retVal); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); try { //获取数据库操作对象 HibernateOper = HibernateFactory.GetInstance(); updateVersion();//更新数据库 } catch (Exception e) { throw e; } }
public static IHibernateOper GetInstance() { try { if (hibernateOper == null) { lock (_lock) { if (hibernateOper == null) { hibernateOper = new HibernateOper(); } } } } catch (Exception e) { throw e; } return hibernateOper; }
public static IHibernateOper GetInstance() { try { if (hibernateOper == null) { lock (_lock) { if (hibernateOper == null) { hibernateOper = new HibernateOper(); } } } } catch (Exception e) { throw e; } return(hibernateOper); }
public static void Exec(IHibernateOper hibernateOper, OnSession onSession) { ISession s = null; ITransaction trans = null; try { s = hibernateOper.GetCurrentSession(); trans = s.BeginTransaction(); onSession(s); trans.Commit(); } catch (Exception e) { if (trans != null) { trans.Rollback(); } throw e; } }
public TbBaseOper(IHibernateOper hibernateOper, Type type) { this.hibernateOper = hibernateOper; this.type = type; }
public static Employee GetEmployee(IHibernateOper hibernateOper, string code) { Employee retVal = null; Exec(hibernateOper, delegate(ISession s) { //查找员工工号 retVal = GetEmployee(s, code); } ); return retVal; }
/// <summary> /// 获取最短距离的分店 /// </summary> /// <param name="hibernateOper"></param> /// <param name="loc">地址</param> /// <param name="maxDist">最长距离</param> /// <returns></returns> public static Department GetMinDistDept(IHibernateOper hibernateOper, TbLocation loc,double maxDist) { Department retVal = null; Exec(hibernateOper, delegate(ISession s) { //查找地址码 retVal = GetMinDistDept(s, loc, maxDist); } ); return retVal; }
/// <summary> /// 获取最短距离的分店 /// </summary> /// <param name="hibernateOper"></param> /// <param name="loc">地址</param> /// <returns></returns> public static Department GetMinDistDept(IHibernateOper hibernateOper, TbLocation loc) { return GetMinDistDept(hibernateOper,loc,double.MaxValue); }
/// <summary> /// 由地址码获取地址全称 /// </summary> /// <param name="hibernateOper"></param> /// <param name="code"></param> /// <returns></returns> public static string GetAddrForCode(IHibernateOper hibernateOper, string code) { string retVal = null; Exec(hibernateOper, delegate(ISession s) { //查找地址码 retVal = GetAddrForCode(s, code); } ); return retVal; }
public HomeController() { IHibernateOper hibernateOper = HibernateFactory.GetInstance(); empOper = new TbBaseOper <Employee>(hibernateOper, typeof(Employee)); }
/// <summary> /// 获取最短距离的分店 /// </summary> /// <param name="hibernateOper"></param> /// <param name="loc">地址</param> /// <returns></returns> public static Department GetMinDistDept(IHibernateOper hibernateOper, TbLocation loc) { return(GetMinDistDept(hibernateOper, loc, double.MaxValue)); }