public async Task LoadPersons() { var listCast = await _CastService.Get <List <Data.Model.MovieAndTvshowPerson> >(new MovieAndTvshowPersonSearchRequest() { MovieAndTvshowId = mtvs.Id, }); PersonsList.Clear(); foreach (var person in listCast) { PersonsList.Add(person); } List <Data.Model.MovieAndTvshow> rec = await _RecommendService.Get <List <Data.Model.MovieAndTvshow> >(new RecommendedSearchRequest() { MTVSID = mtvs.Id, }); RecommendedMoviesList.Clear(); foreach (var mtvs in rec) { RecommendedMoviesList.Add(mtvs); } LoadActors(); LoadDirectors(); }
public PersonsViewModel() { // Command initialisieren AddPersonCommand = new Command(() => { PersonsList.Add("Person #" + PersonsList.Count); }); var persons = new ObservableCollection <String> { "Klaus", "Peter", "Michael", "Rüdiger", "Bernd", "Jürgen", "Sebastian", "Mark", "Wolfgang", "Jochen", "Klaus", "Peter", "Michael", "Rüdiger", "Bernd", "Jürgen", "Sebastian", "Mark", "Wolfgang", }; PersonsList = persons; OnPropertyChanged("PersonsList"); }
/// <summary> /// Метод для заполнения списка пользователей. /// </summary> public void GetData() { personsList = new ObservableCollection <Person>(); personsList.CollectionChanged += OnGroceryListChanged; InteractionServer response = new InteractionServer(); List <Person> lp = response.GetPersonList(); for (int i = 0; i < lp.Count; i++) { PersonsList.Add(new Person { Idperson = lp[i].Idperson, Name = lp[i].Name, Dateofbirth = Convert.ToDateTime(lp[i].Dateofbirth), City = lp[i].City }); } base.RaisePropertyChangedEvent("PersonsList"); }
/// <summary> /// Метод заполнения списка пользователей с учётом фильтра. /// </summary> public void GetFilterData() { if (FilterName != null || FilterDate.Date != Convert.ToDateTime("01.01.0001 0:00:00") || FilterTown != null) //поставить вместо дата == нул стандартную дату { personsList.CollectionChanged += OnGroceryListChanged; InteractionServer response = new InteractionServer(); List <Person> fp = response.FilterPerson(FilterName, FilterDate, FilterTown); PersonsList.Clear(); for (int i = 0; i < fp.Count; i++) { PersonsList.Add(new Person { Idperson = fp[i].Idperson, Name = fp[i].Name, Dateofbirth = Convert.ToDateTime(fp[i].Dateofbirth), City = fp[i].City }); } base.RaisePropertyChangedEvent("PersonsList"); } else { MessageBox.Show("Выберите поля для фильтрации", "Сообщение", MessageBoxButton.OK); } }
public ServiceViewModel(User user, ResourceDictionary resource) { res = resource; unitOfWork = new UnitOfWork(); userContext = new UserContext(); userContext2 = new UserContext(); service = new DataModels.Service(); this.user = user; //Person info page Email = user.Email; FirstName = user.FirstName; LastName = user.LastName; Phone = user.Phone; // List of users & list of logins(ComboBox) in PersonList page foreach (User userlist in userContext.Users) { PersonsList.Add(userlist); UserComboList.Add(userlist.Login); } // list of orders id in combo foreach (UsersServices services in userContext.UsersServices) { if (user.Id == services.UserId) { UserOrderIdCombo.Add(services.UserServicesId); } } // status ComboBox PersonList page UserStatusCombo.Add("user"); UserStatusCombo.Add("admin"); // order status. All Orders page OrderStatusCombo.Add("Not ready"); OrderStatusCombo.Add("Ready"); OrderStatusCombo.Add("Denied"); // Order list of each user using (UserContext db = new UserContext()) { foreach (UsersServices ser in db.UsersServices) { foreach (DataModels.Service serv in userContext.Services) { if (user.Id == ser.UserId && ser.ServiceId == serv.Id) { InfoUserServices infoUserServices = new InfoUserServices { Id = ser.UserServicesId, Date = ser.Date, Price = serv.Price, ServiceName = serv.ServiceName, Status = ser.Status }; PersonOrderList.Add(infoUserServices); } } } } // page with all orders using (UserContext db = new UserContext()) { foreach (UsersServices ser in db.UsersServices) { foreach (DataModels.Service serv in userContext.Services) { foreach (User userr in userContext2.Users) { if (ser.ServiceId == serv.Id && ser.UserId == userr.Id) { AllOrders all = new AllOrders { Id = ser.UserServicesId, Date = ser.Date, Email = userr.Email, Name = userr.FirstName, Phone = userr.Phone, Price = serv.Price, ServiceName = serv.ServiceName, Status = ser.Status }; PersonOrderAllList.Add(all); } } } AllOrderIdCombo.Add(ser.UserServicesId); } } }