/// <summary> /// 查询指定实体对象的所有值 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="EntityInstance"></param> /// <returns></returns> public virtual List <T> QueryAll <T>(IEntityBase EntityInstance) { IDvTable dvt = DalCreateDriveTable(EntityInstance); DataSet ds = dvt.Select(); List <T> result = this.dh.Convert <T>(EntityInstance.GetType(), ds); return(result); }
/// <summary> /// 查询菜单 /// </summary> /// <returns></returns> public virtual DataSet QueryAllSet() { IMenu menu = this.entityfactory.CreateEntityInstance <IMenu>(); IDvTable dvt = this.entityfactory.CreateDriveTable(menu); DataSet ds = dvt.Select(); return(ds); }
/// <summary> /// 查询所有权限项 /// </summary> /// <returns></returns> public virtual List <IAuthItem> QueryAuthItem() { IAuthItem item = this.entityfactory.CreateEntityInstance <IAuthItem>(); IDvTable dvt = this.entityfactory.CreateDriveTable(item); DataSet ds = dvt.Select(); return(this.dh.Convert <IAuthItem>(this.entityfactory.CreateEntityInstance <IAuthItem>().GetType(), ds)); }
/// <summary> /// 查询所有单位 /// </summary> /// <returns></returns> public List <IUnits> QueryUnits() { IUnits nit = entityfactory.CreateEntityInstance <IUnits>(); IDvTable dvt = entityfactory.CreateDriveTable(nit); DataSet ds = dvt.Select(); List <IUnits> uitlist = this.dh.Convert <IUnits>(nit.GetType(), ds); return(uitlist); }
/// <summary> /// 查询所有权限控制项 /// </summary> /// <returns></returns> public List <IAuthControl> QueryAuthCtrl() { IAuthControl actrl = entityfactory.CreateEntityInstance <IAuthControl>(); IDvTable dvt = entityfactory.CreateDriveTable(actrl); DataSet ds = dvt.Select(); List <IAuthControl> list = this.dh.Convert <IAuthControl>(actrl.GetType(), ds); return(list); }
/// <summary> /// 查询所有用户 /// </summary> /// <returns></returns> public virtual List <IUser> QueryUser() { IUser user = entityfactory.CreateEntityInstance <IUser>(); IDvTable dvt = entityfactory.CreateDriveTable(user); DataSet ds = dvt.Select(); List <IUser> list = this.dh.Convert <IUser>(user.GetType(), ds); return(list); }
/// <summary> /// 查询所有角色 /// </summary> /// <returns></returns> public List <IRole> QueryRole() { IRole role = entityfactory.CreateEntityInstance <IRole>(); IDvTable dvt = entityfactory.CreateDriveTable(role); DataSet ds = dvt.Select(); List <IRole> list = this.dh.Convert <IRole>(role.GetType(), ds); return(list); }
/// <summary> /// 根据条件查询指定实体对象的所有值 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="Field"></param> /// <param name="EntityInstance"></param> /// <param name="LinkOpr"></param> /// <param name="Opr"></param> /// <returns></returns> public virtual List <T> QueryEntityList <T>(IEntityBase EntityInstance, string Field, Operator Opr, LinkOperator LinkOpr) { List <T> result = new List <T>(); IDvTable dvt = DalCreateDriveTable(EntityInstance); dvt.WhereClause(Field, Opr, LinkOpr); DataSet ds = dvt.Select(); result = this.dh.Convert <T>(EntityInstance.GetType(), ds); return(result); }
/// <summary> /// 根据权限类型名称查询权限控制项 /// </summary> /// <param name="AuthType"></param> /// <returns></returns> public List <IAuthControl> QueryAuthCtrl(AuthType AuthType) { IAuthControl actrl = entityfactory.CreateEntityInstance <IAuthControl>(); IDvTable dvt = entityfactory.CreateDriveTable(actrl); actrl.AuthCode = long.Parse(Enum.Parse(typeof(AuthType), AuthType.ToString()).ToString()); DataSet ds = dvt.Select(); List <IAuthControl> list = this.dh.Convert <IAuthControl>(actrl.GetType(), ds); return(list); }
/// <summary> /// 根据单位编码查询单位 /// </summary> /// <param name="UnitCode"></param> /// <returns></returns> public IUnits QueryUnitsForCode(long UnitCode) { IUnits uit = entityfactory.CreateEntityInstance <IUnits>(); IDvTable dvt = entityfactory.CreateDriveTable(uit); uit.UnitCode = UnitCode; dvt.WhereClause("UnitCode", Operator.Deng, LinkOperator.nul); DataSet ds = dvt.Select(); uit = this.dh.Convert <IUnits>(uit.GetType(), ds, 0); return(uit); }
/// <summary> /// 根据角色编码查询角色 /// </summary> /// <param name="RoleCode">角色编码</param> /// <returns></returns> public IRole QueryRoleForCode(long RoleCode) { IRole role = entityfactory.CreateEntityInstance <IRole>(); IDvTable dvt = entityfactory.CreateDriveTable(role); role.RoleCode = RoleCode; dvt.WhereClause("RoleCode", Operator.Deng, LinkOperator.nul); DataSet ds = dvt.Select(); role = this.dh.Convert <IRole>(role.GetType(), ds, 0); return(role); }
/// <summary> /// 查询菜单 /// </summary> /// <param name="PerntCode">父菜单编号</param> /// <returns></returns> public virtual List <IMenu> QuerySubmenu(string PerntCode) { IMenu menu = this.entityfactory.CreateEntityInstance <IMenu>(); menu.PARENTCODE = PerntCode; IDvTable dvt = this.entityfactory.CreateDriveTable(menu); dvt.WhereClause("PARENTCODE", Operator.Deng, LinkOperator.nul); DataSet ds = dvt.Select(); return(this.dh.Convert <IMenu>(menu.GetType(), ds)); }
/// <summary> /// 根据菜单类型查询菜单 /// </summary> /// <param name="MType">菜单类型</param> /// <returns></returns> public List <IMenu> QueryMenus(MenuType MType) { IMenu menu = entityfactory.CreateEntityInstance <IMenu>(); IDvTable dvt = entityfactory.CreateDriveTable(menu); menu.MENUTYPE = MType.ToString(); dvt.WhereClause("MENUTYPE", Operator.Deng, LinkOperator.nul); DataSet ds = dvt.Select(); List <IMenu> list = this.dh.Convert <IMenu>(menu.GetType(), ds); return(list); }
/// <summary> /// 根据菜单类全名查询菜单 /// </summary> /// <param name="FullClassName"></param> /// <returns></returns> public IMenu QueryMenu(string FullClassName) { IMenu menu = entityfactory.CreateEntityInstance <IMenu>(); IDvTable dvt = entityfactory.CreateDriveTable(menu); menu.FULLCLASSNAME = FullClassName; dvt.WhereClause("FULLCLASSNAME", Operator.Deng, LinkOperator.nul); DataSet ds = dvt.Select(); DataHelper dte = new DataHelper(); return(dte.Convert <IMenu>(menu.GetType(), ds, 0)); }
/// <summary> /// 根据角色名称查询权限控制项 /// </summary> /// <param name="Role"></param> /// <returns></returns> public List <IAuthControl> QueryAuthCtrl(IRole Role) { IAuthControl actrl = entityfactory.CreateEntityInstance <IAuthControl>(); IDvTable dvt = entityfactory.CreateDriveTable(actrl); actrl.RoleCode = Role.RoleCode; dvt.WhereClause("RoleCode", Operator.Deng, LinkOperator.nul); DataSet ds = dvt.Select(); List <IAuthControl> list = this.dh.Convert <IAuthControl>(actrl.GetType(), ds); return(list); }
/// <summary> /// 根据单位查询用户 /// </summary> /// <param name="Units"></param> /// <returns></returns> public virtual List <IUser> QueryUser(IUnits Units) { IUser user = entityfactory.CreateEntityInstance <IUser>(); user.UnitCode = Units.UnitCode; IDvTable dvt = entityfactory.CreateDriveTable(user); dvt.WhereClause("UnitCode", Operator.Deng, LinkOperator.nul); DataSet ds = dvt.Select(); List <IUser> list = this.dh.Convert <IUser>(user.GetType(), ds); return(list); }
/// <summary> /// 查询菜单编码 /// </summary> /// <param name="MenuCode"></param> /// <returns></returns> public virtual IMenu QueryCode(string MenuCode) { IMenu menu = this.entityfactory.CreateEntityInstance <IMenu>(); menu.MENUCODE = MenuCode; IDvTable dvt = this.entityfactory.CreateDriveTable(menu); dvt.WhereClause("MENUCODE", Operator.Deng, LinkOperator.nul); DataSet ds = dvt.Select(); DataHelper dte = new DataHelper(); return(dte.Convert <IMenu>(menu.GetType(), ds, 0));; }
/// <summary> /// 根据指定的权限项编码查询权限项对象 /// </summary> /// <param name="AuthItemCode"></param> /// <returns></returns> public virtual IAuthItem QueryAuthItem(string AuthItemCode) { IAuthItem item = this.entityfactory.CreateEntityInstance <IAuthItem>(); item.AuthItemCode = AuthItemCode; IDvTable dvt = this.entityfactory.CreateDriveTable(item); dvt.WhereClause("AuthItemCode", Operator.Deng, LinkOperator.nul); DataSet ds = dvt.Select(); DataHelper dte = new DataHelper(); return(dte.Convert <IAuthItem>(item.GetType(), ds, 0));; }
/// <summary> /// 根据用户名称查询用户 /// </summary> /// <param name="UserName"></param> /// <returns></returns> public virtual IUser QueryUserName(string UserName) { IUser user = entityfactory.CreateEntityInstance <IUser>(); IDvTable dvt = entityfactory.CreateDriveTable(user); user.UserName = UserName; dvt.WhereClause("UserName", Operator.Deng, LinkOperator.nul); DataSet ds = dvt.Select(); user = this.dh.Convert <IUser>(user.GetType(), ds, 0); return(user); }
protected virtual void button1_Click(object sender, EventArgs e) { //ProteinCustomSection config // = (ProteinCustomSection)System.Configuration.ConfigurationManager.GetSection("Protein"); //ProteinConfig pconfig = ProteinConfig.GetInstance(); throw new Exception("测试"); /// ILHTDZS_ManagerUser user = this.entityfactory.CreateEntityInstance <ILHTDZS_ManagerUser>(); IDvTable dvt = this.entityfactory.CreateDriveTable(user); DataSet ds = dvt.Select(); //List<LHTDZS_ManagerUser> list = this.dh.Convert<LHTDZS_ManagerUser>(user.GetType(), ds); }
/// <summary> /// 根据权限项和角色查询权限控制项 /// </summary> /// <param name="AuthItem"></param> /// <param name="Role"></param> /// <returns></returns> public IAuthControl QueryAuthCtrl(IAuthItem AuthItem, IRole Role) { IAuthControl actrl = entityfactory.CreateEntityInstance <IAuthControl>(); IDvTable dvt = entityfactory.CreateDriveTable(actrl); actrl.FItemCode = AuthItem.AuthItemCode.ToString(); actrl.RoleCode = Role.RoleCode; dvt.WhereClause("FItemCode", Operator.Deng, LinkOperator.and); dvt.WhereClause("RoleCode", Operator.Deng, LinkOperator.nul); DataSet ds = dvt.Select(); actrl = this.dh.Convert <IAuthControl>(actrl.GetType(), ds, 0); return(actrl); }
/// <summary> /// 根据角色编码查询用户 /// </summary> /// <param name="RoleCode"></param> /// <returns></returns> public List <IUser> QueryUserRoleCode(long RoleCode) { IUser user = entityfactory.CreateEntityInstance <IUser>(); IDvTable dvt = entityfactory.CreateDriveTable(user); user.RoleCode = RoleCode; dvt.WhereClause("UserName", Operator.Deng, LinkOperator.nul); DataSet ds = dvt.Select(); DataHelper dte = new DataHelper(); List <object> userlist = dte.ConvertToEntity(user.GetType(), ds); List <IUser> result = new List <IUser>(); foreach (object obj in userlist) { result.Add((IUser)obj); } return(result); }
/// <summary> /// 根据多个条件子语句查询指定实体对象的所有值 当条件子语句数量为0时返回值为空列表 此方法不考虑联立表查询情况 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="EntityInstance"></param> /// <param name="Clauses"></param> /// <returns></returns> public virtual List <T> QueryEntityList <T>(IEntityBase EntityInstance, List <ClauseElement> Clauses) { List <T> result = new List <T>(); if (Clauses.Count == 0) { return(result); } IDvTable dvt = DalCreateDriveTable(EntityInstance); foreach (ClauseElement ce in Clauses) { dvt.WhereClause(ce.FieldName, ce.Opr, ce.LinkOpr); } DataSet ds = dvt.Select(); result = this.dh.Convert <T>(EntityInstance.GetType(), ds); return(result); }
/// <summary> /// 根据角色名和菜单类型查询菜单 /// </summary> /// <param name="Role">角色</param> /// <param name="MType">菜单类型</param> /// <returns></returns> public List <IMenu> QueryMenus(IRole Role, MenuType MType) { IMenu menu = entityfactory.CreateEntityInstance <IMenu>(); menu.MENUTYPE = MType.ToString(); IAuthControl actrl = entityfactory.CreateEntityInstance <IAuthControl>(); actrl.RoleCode = Role.RoleCode; IDvTable dvt = entityfactory.CreateDriveTable(menu); dvt.Join.Entitys.Add(actrl); dvt.WhereClause("MENUTYPE", Operator.Deng, LinkOperator.and); dvt.WhereClause(actrl, "RoleCode", Operator.Deng, LinkOperator.nul); DataSet ds = dvt.Select(); List <IMenu> list = this.dh.Convert <IMenu>(menu.GetType(), ds); List <IMenu> result = RefactoringMenu(list); return(result); }
/// <summary> /// 根据用户编码查询用户 /// </summary> /// <param name="UserCode"></param> /// <returns></returns> public virtual IUser QueryUserCode(long UserCode) { IUser user = entityfactory.CreateEntityInstance <IUser>(); IDvTable dvt = entityfactory.CreateDriveTable(user); user.UserCode = UserCode; dvt.WhereClause("UserCode", Operator.Deng, LinkOperator.nul); DataSet ds = dvt.Select(); DataHelper dte = new DataHelper(); List <object> userlist = dte.ConvertToEntity(user.GetType(), ds); if (userlist.Count > 0) { user = (IUser)userlist[0]; } else { user = null; } return(user); }
/// <summary> /// 获取指定对象字段的最大值 /// </summary> /// <param name="Entity">实体</param> /// <param name="FieldName">字段名</param> /// <param name="Entityfactory">字段名</param> /// <returns></returns> public virtual Int64 GetMaxField(IEntityBase Entity, string FieldName, IEntityFactory Entityfactory) { Regex re = new Regex("^[0-9]*[1-9][0-9]*$"); Int64 i = -99999; IDvTable dvt = Entityfactory.CreateDriveTable(Entity); dvt.SetFilter(Operator.Fun_Max, FieldName); DataSet ds = dvt.Select(); if (ds.Tables.Count > 0) { if (re.IsMatch(ds.Tables[0].Rows[0][0].ToString())) { i = Int64.Parse(ds.Tables[0].Rows[0][0].ToString()); } } if (i == -99999) { i = 0; } return(i); }
/// <summary> /// 根据用户名称和密码查询用户 /// </summary> /// <param name="UserName"></param> /// <param name="UserPassword"></param> /// <returns></returns> public IUser QueryUserInfo(string UserName, string UserPassword) { IUser user = entityfactory.CreateEntityInstance <IUser>(); IDvTable dvt = entityfactory.CreateDriveTable(user); user.UserName = UserName; user.Userpd = UserPassword; dvt.WhereClause("UserName", Operator.Deng, LinkOperator.and); dvt.WhereClause("Userpd", Operator.Deng, LinkOperator.nul); DataSet ds = dvt.Select(); DataHelper dte = new DataHelper(); List <object> userlist = dte.ConvertToEntity(user.GetType(), ds); if (userlist.Count > 0) { user = (IUser)userlist[0]; } else { user = null; } return(user); }