public TicketBookingViewModel(FlightInfoModel[] flights, Site site = null) { _allInsextypes.Add(new KeyValuePair <EnumSexType?, string>(EnumSexType.Male, UIExt.Helper.EnumHelper.GetDescription(EnumSexType.Male))); _allInsextypes.Add(new KeyValuePair <EnumSexType?, string>(EnumSexType.Female, UIExt.Helper.EnumHelper.GetDescription(EnumSexType.Female))); _allInsextypes.Add(new KeyValuePair <EnumSexType?, string>(EnumSexType.UnKnown, UIExt.Helper.EnumHelper.GetDescription(EnumSexType.UnKnown))); _flightItems = flights; CommunicateManager.Invoke <IBusinessmanService>(service => { CurrentUserInfo = service.GetCurrentUserInfo(); }, UIManager.ShowErr); if (CurrentUserInfo == null) { CurrentUserInfo = new CurrentUserInfoDto(); } Items = new ObservableCollection <FlightInformationItemViewModel>(); PassengerInformationItems = new ObservableCollection <PassengerInformationViewModel>(); AgeTypeItems = CollectionViewSource.GetDefaultView(CAgeTypeItems); //AgeTypeItems.Filter = (o) => //{ // if (o is KeyValuePair<dynamic, string>) // { // var item = (KeyValuePair<dynamic, string>)o; // if (IsAdult) // { // return item.Key != AgeType.Child; // } // else // { // return item.Key == AgeType.Child; // } // } // return false; //}; Reset(); foreach (var flight in flights) { if (site != null) { flight.DefaultSite = site; } Items.Add(new FlightInformationItemViewModel(flight)); } AddNew(); }
public CurrentUserInfoDto GetCurrentUserInfo() { CurrentUserInfo currentUser = AuthManager.GetCurrentUser(); var bm = businessmanRepository.FindAll(x => x.Code == currentUser.Code && x is Buyer).Select(p => p as Buyer).SingleOrDefault(); var current = new CurrentUserInfoDto() { BusinessmanCode = currentUser.Code, BusinessmanName = currentUser.BusinessmanName, OperatorAccount = currentUser.OperatorAccount, OperatorName = currentUser.OperatorName, OperatorPhone = currentUser.OperatorPhone, Contact = bm.ContactWay.Contact, Tel = bm.ContactWay.Tel, CreateTime = bm.CreateTime, ContactName = bm.ContactName, Phone = bm.Phone }; return(current); }