private void AssignUserToOu(OrganizationUnitsDemoDbContext context, long userId, long organizationUnitId)
        {
            var uou = new UserOrganizationUnit(AbpSession.GetTenantId(), userId, organizationUnitId);

            context.UserOrganizationUnits.Add(uou);
            context.SaveChanges();
        }
Esempio n. 2
0
        /// <summary>
        /// 根据用户ID返回部门
        /// </summary>
        /// <param name="userid"></param>
        /// <returns></returns>
        public UserOrganizationUnit GetUserOrganizationUnitByUserid(string userid)
        {
            long longuserid = Convert.ToInt64(userid);

            //20170608修改
            var query = from uou in _userOrganizationUnitRepository.GetAll()
                        join ou in _organizationUnitRepository.GetAll() on uou.OrganizationUnitId equals ou.Id
                        where ou.IsDeleted == false && uou.UserId == longuserid
                        select new { uou };

            UserOrganizationUnit uu = query.Select(item => item.uou).FirstOrDefault();

            if (uu == null)
            {
                return(null);
            }
            return(uu);
        }
 public static bool IsStatic(this UserOrganizationUnit entity)
 {
     return((entity as ZeroUserOrganizationUnit)?.IsStatic == true);
 }
 private void AssignUserToOu(OrganizationUnitsDemoDbContext context, long userId, long organizationUnitId)
 {
     var uou = new UserOrganizationUnit(AbpSession.GetTenantId(), userId, organizationUnitId);
     context.UserOrganizationUnits.Add(uou);
     context.SaveChanges();
 }