public static IPartyRepository GetPartyRepository()
        {
            IPartyRepository partyRepository = new PartyRepository(new PartySqlContext());

            return(partyRepository);
        }
 public PartyController()
 {
     partyRepos = new PartyRepository();
 }
示例#3
0
 public List <Party> GetFirst10Parties()
 {
     return(PartyRepository.GetAll().OrderByDescending(x => x.Date).Take(10).ToList());
 }
示例#4
0
 public Party GetParty(int partyId)
 {
     return(PartyRepository.Get(partyId));
 }
示例#5
0
 public List <Party> GetIncomingParties()
 {
     return(PartyRepository.GetAll());
 }
示例#6
0
 public List <Party> GetAdultParties()
 {
     return(PartyRepository.GetAll().Where(x => x.IsPlus18).ToList());
 }
示例#7
0
        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();
 }
示例#10
0
 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();
 }
示例#12
0
        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));
        }
示例#13
0
        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);
        }
示例#14
0
        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();
                }
            }
        }
示例#15
0
 public override void Setup()
 {
     base.Setup();
     partyRepository = new PartyRepository(null, new PartyService());
 }