public JsonResult SearchByAccountName(string searchText) { Company _currentCom = ((EInvoiceContext)FXContext.Current).CurrentCompany; IuserService _SvcUser = IoC.Resolve <IuserService>(); IList <user> lst = _SvcUser.GetbyHQuery("select u from user u where u.GroupName = :comid AND u.username like :searchText AND u.username Not IN (select AccountName from Customer)", new SQLParam("comid", _currentCom.id), new SQLParam("searchText", "%" + searchText + "%")); var qr = from u in lst select(new { u.username }); return(Json(qr, JsonRequestBehavior.AllowGet)); }
/// <summary> /// Removes the specified user names from the specified roles for the configured applicationName /// </summary> /// <param name="usernames"> A string array of user names to be removed from the specified roles.</param> /// <param name="roleNames">A string array of role names to remove the specified user names from.</param> public override void RemoveUsersFromRoles(string[] usernames, string[] roleNames) { if (_App == null) { return; } string hql = "from user u where u.username in (:usernames)"; IList <user> UserList = UserSrv.GetbyHQuery(hql, new SQLParam("usernames", usernames.ToString())); string hql2 = "from role r where r.name in (:roleNames) AND r.AppID = :AppID"; IList <role> RoleList = RoleSrv.GetbyHQuery(hql2, new SQLParam("roleNames", roleNames.ToString()), new SQLParam("AppID", _App.AppID)); foreach (user u in UserList) { foreach (role r in RoleList) { if (u.Roles.Contains(r)) { u.Roles.Remove(r); } } } UserSrv.CommitChanges(); }