internal static List <UserVO> GetUserByUserNameOrFullName(UserClientRole clientType, string userNameToSearch, string fullNameToSearch) { return(ServiceLocator.Get <IUserService>().FilterByUserNameAndFullName(clientType, userNameToSearch, fullNameToSearch)); //TODO: Buscar por la web y agregar el resultado a la lista. //Notificar aqui en caso de que se este buscando solamente por la db local. //UsersSearchResult = UserNameToSearch.Concat(ServiceLocator.Get<IUserWebService>(FilterByUserNameAndFullName(SelectedClientType, UserNameToSearch, FullNameToSearch))); }
public UserByMembresy_DetailsViewModel(EMMainViewModel centralEMMain, UserClientRole clientType) : base(centralEMMain) { Subtitle = "usuarios por membresía"; CurrentClientTypeDetails = clientType; //TODO RECORDAR BORRAR ESTO UserClientCollection = new List <UserClientModel>() { new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" }, new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" }, new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" }, new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" }, new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" }, new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" }, new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" }, new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" }, new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" }, new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" }, new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" }, new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" }, new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" }, new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" }, new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" }, new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" }, new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" }, new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" }, new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" }, new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" }, new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" }, new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" }, new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" }, new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" }, new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" }, new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" }, new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" }, new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" }, new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" }, new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" }, new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" }, new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" }, new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" }, new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" }, new UserClientModel() { NombreyApellidos = "Fulanito Tales Mascuales", Direccion = "Calle 24 entre 15 y 17, Vedado, La Habana", RecomendationLevel = 2, Correo = "*****@*****.**", Telefono = "65465446-3513113" } }; }
public List <UserVO> FilterByUserNameAndFullName(UserClientRole clientType, string userNameToSearch, string fullNameToSearch) { IQueryable <UserVO> q = from s in db.Users join ads in db.AditionalServices on s.AditionalServiceFK equals ads.Id into sads from ads in sads.DefaultIfEmpty() join mem in db.Memberships on s.MembershipFK equals mem.Id into smem from mem in smem.DefaultIfEmpty() join mun in db.Municipalities on s.MunicipalityFK equals mun.Id into smun from mun in smun.DefaultIfEmpty() select new UserVO { AditionalServiceFK = s.AditionalServiceFK, MembershipFK = s.MembershipFK, MunicipalityFK = s.MunicipalityFK, Id = s.Id, AditionalService = ads == null ? null : new AditionalServiceVO { Id = ads.Id, Name = ads.Name, Price = ads.Price, UserType = ads.UserType, }, AuthenticationType = s.AuthenticationType, Name = s.Name, Balance = s.Balance, Email = s.Email, HomePhoneNumber = s.HomePhoneNumber, HowKnowEmplomania = s.HowKnowEmplomania, InvitationConfirmCode = s.InvitationConfirmCode, LastName = s.LastName, LastName2 = s.LastName2, Membership = mem == null ? null : new MembershipVO { Id = mem.Id, Name = mem.Name, Price = mem.Price, UserType = mem.UserType, }, MovilPhoneNumber = s.MovilPhoneNumber, Municipality = mun == null ? null : new MunicipalityVO { Id = mun.Id, Name = mun.Name, ProvinciaId = mun.ProvinceFK, }, PasswordHash = s.PasswordHash, ProfileImageRaw = s.ProfileImageRaw, UserName = s.UserName, Verified = s.Verified, }; switch (clientType) { case UserClientRole.Trabajador: q = from w in db.Workers join us in q on w.UserFK equals us.Id select us; break; case UserClientRole.Empleador: q = from e in db.Employers join us in q on e.UserFK equals us.Id select us; break; case UserClientRole.Profesor: q = from t in db.Teachers join us in q on t.UserFK equals us.Id select us; break; default: break; } if (q == null) { return(null); } if (!string.IsNullOrEmpty(userNameToSearch)) { q = q.Where(x => x.UserName == userNameToSearch); } if (!string.IsNullOrEmpty(fullNameToSearch)) { q = q.Where(x => (x.Name + " " + x.LastName + " " + x.LastName2).Contains(fullNameToSearch)); } //q = q.Where(x => x.Name.Contains(fullNameToSearch)||x.LastName.Contains(fullNameToSearch)||x.LastName2.Contains(fullNameToSearch)); return(q.ToList()); }