public static IPartyRepository GetPartyRepository() { IPartyRepository partyRepository = new PartyRepository(new PartySqlContext()); return(partyRepository); }
public PartyController() { partyRepos = new PartyRepository(); }
public List <Party> GetFirst10Parties() { return(PartyRepository.GetAll().OrderByDescending(x => x.Date).Take(10).ToList()); }
public Party GetParty(int partyId) { return(PartyRepository.Get(partyId)); }
public List <Party> GetIncomingParties() { return(PartyRepository.GetAll()); }
public List <Party> GetAdultParties() { return(PartyRepository.GetAll().Where(x => x.IsPlus18).ToList()); }
private async Task GetParties() { parties_all = await PartyRepository.GetParties(); if (parties_all != null) { for (int i = 0; i < parties_all.Count; i++) { try { Party item = parties_all[i]; if (item.Location == null) { break; } item.VisibleShow = Visibility.Collapsed; item.ShowCommand = new RelayCommand <object>(e => ShowParty(e)); item.RouteCommand = new RelayCommand <object>(e => mapItem_Party(e)); item.TakeCommand = new RelayCommand <object>(e => TakeParty(e)); item.RouteCommandText = "Toon route"; if (MainViewVM.USER.IsBob.Value) { item.VisibleTake = Visibility.Collapsed; } else { item.VisibleTake = Visibility.Visible; } BasicGeoposition tempbasic = new BasicGeoposition(); //Locaties omzetten en in de tijdelijke posities opslaan. tempbasic.Latitude = ((Location)item.Location).Latitude; tempbasic.Longitude = ((Location)item.Location).Longitude; //Omzetten van tijdelijk punt naar echte locatie (anders krijg je die niet in de mapIconFeestLocation.Location) Geopoint temppoint = new Geopoint(tempbasic); MapIcon mapIconFeestLocation = new MapIcon(); mapIconFeestLocation.Location = temppoint; //Opgehaalde locatie //mapIconFeestLocation.Title = feest.Name; //Naam van het feestje; mapIconFeestLocation.Image = MainViewVM.Pins.FeestPin; mapIconFeestLocation.Title = item.Name; this.Map.MapElements.Add(mapIconFeestLocation);//Marker op de map zetten. } catch (Exception ex) { } } try { var newControl = new MapItemsControl(); FeestjesOverzicht view = MainViewVM.MainFrame.Content as FeestjesOverzicht; newControl.ItemsSource = parties_all; newControl.ItemTemplate = (DataTemplate)view.Resources["PartiesMapTemplate"] as DataTemplate; AddOrUpdateChild(newControl); } catch (Exception) { } this.Parties = parties_all.Take(10).ToList(); RaiseAll(); } }
private Dictionary <int, string> GetPartiesDictionary(List <int> ids) { IReadOnlyList <Party> result = PartyRepository.GetByIds(ids).ToList(); return(result.ToDictionary(p => p.Id, p => p.Name)); }
// inject the repositories here, if you use DI public PartyRegistrationService() { this.registrationRepository = new RegistrationRepository(); this.personRepository = new PersonRepository(); this.partyRepository = new PartyRepository(); }
public PartyController(UserManager <ApplicationUser> userManager, ApplicationDbContext context) { this.userManager = userManager; this.repository = new PartyRepository(context); this.context = context; }
public PartiesController() { db = new ApplicationDbContext(); PartyRepository = new PartyRepository(); }
public async Task <ActionResult> AddDo() { IContractTypeRepository _repo = new ContractTypeRepository(); Response result = await _repo.GetallContractTrypes(); List <ContractTypeVM> list = ((IEnumerable)result.Value).Cast <ContractTypeVM>().ToList(); var selectListItems = list.Select(x => new SelectListItem() { Value = x.Id.ToString(), Text = x.Type }).ToList(); ViewBag.LstContractType = selectListItems; ICityRepository _repocity = new CityRepository(); Response resultcity = await _repocity.GetALLCities(); List <CityVM> listcity = ((IEnumerable)resultcity.Value).Cast <CityVM>().ToList(); var selectListItemscity = listcity.Select(x => new SelectListItem() { Value = x.Id.ToString(), Text = x.City1 }).ToList(); ViewBag.LstCities = selectListItemscity; IPartyRepository _repoparty = new PartyRepository(); Response resultparty = await _repoparty.GetALLParties(); List <PartyVM> listparty = ((IEnumerable)resultparty.Value).Cast <PartyVM>().ToList(); var selectListItemsparty = listparty.Select(x => new SelectListItem() { Value = x.Id.ToString(), Text = x.Party1 }).ToList(); ViewBag.LstParty = selectListItemsparty; IGoodsRepository _repogoods = new GoodsRepository(); Response resultgoods = await _repogoods.GetALLGoods(); List <GoodsTypeVM> listgoods = ((IEnumerable)resultgoods.Value).Cast <GoodsTypeVM>().ToList(); var selectListItemsgoods = listgoods.Select(x => new SelectListItem() { Value = x.Id.ToString(), Text = x.Goods }).ToList(); ViewBag.LstGoods = selectListItemsgoods; Response resultUnits = _repogoods.GetallUnits(); List <DropDownListModel> listunits = ((IEnumerable)resultUnits.Value).Cast <DropDownListModel>().ToList(); var selectListUnits = listunits.Select(x => new SelectListItem() { Value = x.Value.ToString(), Text = x.Text }).ToList(); ViewBag.LstUnits = selectListUnits; ISettingRepository _setting = new SettingRepository(); DorderVM Do = new DorderVM(); bool autoInc = _setting.GetDoAutoIncrement(); if (autoInc) { Do.DoNumber = (_setting.GetLastDoNumber() + 1); } else { Do.DoNumber = _setting.GetLastDoNumber(); } Do.ContractNumber = _setting.GetLastContractNumber(); ViewBag.isAutoIncrement = autoInc; Do.BagsPerWeight = _setting.GetPackPerWeight(); return(View(Do)); }
public PartyInfo GetPartyInfo(int partyId) { var party = PartyRepository.GetPartyById(partyId); if (party != null && party.STATUS != (int)PartyStatuses.DELETED) { var info = new PartyInfo { PartyId = party.PARTY_ID, InitiatorName = party.DUOJU_USERS.NICK_NAME, HoldDate = party.HOLD_DATE, HoldTime = party.HOLD_TIME, Description = party.DESCRIPTION, MinIntoForce = party.MIN_INTO_FORCE, MaxIntoForce = party.MAX_INTO_FORCE, Status = party.STATUS, SupplierInfo = SupplierService.GetSupplierInfoById(party.SUPPLIER_ID), PartyParticipantInfos = GetPartyParticipantInfos(partyId), PartyCommentInfos = party.STATUS == (int)PartyStatuses.CONSUMED ? PartyRepository.GetPartyCommentInfos(partyId) : null }; ConvertPartyInfo(info); return(info); } return(null); }
public PartyParticipateCountInfo ParticipateParty(int partyId, string openId) { var user = UserRepository.GetUserByOpenId(openId); if (user == null || user.SUBSCRIBED == YesNo.N.ToString()) { throw new UserDidNotConcernException(); } var party = PartyRepository.GetPartyById(partyId); if (party == null) { throw new CanNotFindPartyException(); } else { if (party.STATUS == (int)PartyStatuses.PUBLISHED) { var validParticipants = party.DUOJU_PARTY_PARTICIPANTS.Where(i => i.PARTY_ID == partyId && i.STATUS == (int)PartyParticipantStatuses.PARTICIPATED); var participant = validParticipants.FirstOrDefault(i => i.PARTICIPANT_ID == user.USER_ID); participant = null; if (participant != null && participant.STATUS == (int)PartyParticipantStatuses.PARTICIPATED) { throw new UserHasBeenParticipateThePartyException(); } if (participant == null) { participant = new DUOJU_PARTY_PARTICIPANTS { DUOJU_USERS = user, CREATE_BY = user.USER_ID, CREATE_TIME = DateTime.Now }; party.DUOJU_PARTY_PARTICIPANTS.Add(participant); if (party.MAX_INTO_FORCE.HasValue && validParticipants.Count() + 1 >= party.MAX_INTO_FORCE.Value) { party.STATUS = (int)PartyStatuses.FULLED; party.LAST_UPDATE_BY = user.USER_ID; party.LAST_UPDATE_TIME = DateTime.Now; } } participant.PARTICIPATE_TIME = DateTime.Now; participant.STATUS = (int)PartyParticipantStatuses.PARTICIPATED; participant.LAST_UPDATE_BY = user.USER_ID; participant.LAST_UPDATE_TIME = DateTime.Now; PartyRepository.SaveChanges(); return(new PartyParticipateCountInfo { InitiatorOpenId = party.DUOJU_USERS.OPEN_ID, MinIntoForce = party.MIN_INTO_FORCE, MaxIntoForce = party.MAX_INTO_FORCE, ParticipateCount = party.DUOJU_PARTY_PARTICIPANTS.Count }); } else if (party.STATUS == (int)PartyStatuses.DELETED) { throw new CanNotFindPartyException(); } else { throw new PartyWasClosedException(); } } }
public override void Setup() { base.Setup(); partyRepository = new PartyRepository(null, new PartyService()); }