public async Task <Participant> GetById(ParticipantFilter model)
        {
            var _participant = await this.SingleOrDefaultAsync(this.GetAll(this.DataAgregation(model))
                                                               .Where(_ => _.ParticipantId == model.ParticipantId));

            return(_participant);
        }
        public List <Participant> LoadParticipants(ParticipantFilter filter)
        {
            var queryable = getContext().Participants
                            .WhereIf(filter.Id.HasValue, x => x.Id == filter.Id)
                            .WhereIf(filter.RaceId.HasValue, x => x.Race.Id == filter.RaceId);

            if (filter.WithRacerHorceAndJockey)
            {
                queryable = queryable.Include(x => x.Racer).Include(x => x.Racer.Jockey).Include(x => x.Racer.Horse);
            }
            else
            {
                if (filter.WithRacer)
                {
                    queryable = queryable.Include(x => x.Racer);
                }

                if (filter.WithJockey)
                {
                    queryable = queryable.Include(x => x.Racer.Jockey);
                }

                if (filter.WithHorse)
                {
                    queryable = queryable.Include(x => x.Racer.Horse);
                }
            }

            var list = queryable.ToList();

            return(list);
        }
        private void initData()
        {
            participantController = new ParticipantController(dataFormDTO.db);
            //filter = new ConferenceFilter();

            crud = new ParticipantCrud(dataFormDTO.db);

            formDTO        = new CUParticipantFormDTO();
            formDTO.contex = dataFormDTO.db;

            filter = new ParticipantFilter();

            CheckBoxDataInit dataInit = new CheckBoxDataInit(dataFormDTO.db);

            dataInit.addConferences(cbConference);
            dataInit.addThemes(cbTheme);
            dataInit.addSubjects(cbSubject);
            dataInit.addDegrees(cbDegree);

            if (!(dataFormDTO.userData.userRole == UserRole.ADMIN ||
                  dataFormDTO.userData.userRole == UserRole.CONFERENCE_MANAGER))
            {
                AddParticipantButton.Visible = false;
                updateParticipant.Visible    = false;
                deleteParticipant.Visible    = false;
            }
            else
            {
                AddParticipantButton.Visible = true;
                updateParticipant.Visible    = true;
                deleteParticipant.Visible    = true;
            }

            //dataGridView1.DataSource = db.ViewConferencesWithParticipants.ToList();
        }
        public async Task <dynamic> GetDataCustom(ParticipantFilter filters)
        {
            var querybase = await this.ToListAsync(this.GetBySimplefilters(filters).Select(_ => new
            {
                Id = _.ParticipantId
            }));

            return(querybase);
        }
        public async Task <PaginateResult <dynamic> > GetDataListCustomPaging(ParticipantFilter filters)
        {
            var querybase = await this.PagingDataListCustom <dynamic>(filters, this.GetBySimplefilters(filters).Select(_ => new
            {
                Id = _.ParticipantId
            }));

            return(querybase);
        }
        public async Task <IEnumerable <dynamic> > GetDataItem(ParticipantFilter filters)
        {
            var querybase = await this.ToListAsync(this.GetBySimplefilters(filters).Select(_ => new
            {
                Id   = _.ParticipantId,
                Name = _.Name
            }));

            return(querybase);
        }
        public IQueryable <Participant> GetBySimplefilters(ParticipantFilter filters)
        {
            var querybase = this.GetAll(this.DataAgregation(filters))
                            .WithBasicFilters(filters)
                            .WithCustomFilters(filters)
                            .OrderByDomain(filters)
                            .OrderByProperty(filters);

            return(querybase);
        }
Пример #8
0
        public async Task <IActionResult> Get([FromQuery] ParticipantFilter filters)
        {
            var result = new HttpResult <ParticipantDto>(this._logger);

            try
            {
                var searchResult = await this._app.GetByFilters(filters);

                return(result.ReturnCustomResponse(this._app, searchResult, filters));
            }
            catch (Exception ex)
            {
                var responseEx = result.ReturnCustomException(ex, "Seed - Participant", filters, new ErrorMapCustom());
                return(responseEx);
            }
        }
Пример #9
0
        public List <ViewConferencesWithParticipant> GetParticipants(ParticipantFilter filter)
        {
            IQueryable <ViewConferencesWithParticipant> participants = db.ViewConferencesWithParticipants;

            /*
             * 1) conference
             * 2) subject
             * 3) theme
             * 4) degree
             * */

            participants = GetViewConference(filter.conference, participants);
            participants = GetViewSubjects(filter.subject, participants);
            participants = GetViewThemes(filter.theme, participants);
            participants = GetViewDegrees(filter.degree, participants);

            return(participants.ToList());
        }
Пример #10
0
        /// <summary>
        /// Index action to display the Homepage.
        /// ViewBags are filled with data, which is provided by the filter methods from the models.
        /// </summary>
        /// <returns>The index.</returns>
        public ActionResult Index()
        {
            ParticipantFilter partfilter = new ParticipantFilter();
            SubventionFilter  subFilter  = new SubventionFilter();

            ViewBag.Subventions2011 = subFilter.DataByYear(year: 2011);
            ViewBag.Subventions2012 = subFilter.DataByYear(year: 2012);
            ViewBag.Subventions2013 = subFilter.DataByYear(year: 2013);
            ViewBag.Subventions2014 = subFilter.DataByYear(year: 2014);
            ViewBag.Subventions2015 = subFilter.DataByYear(year: 2015);
            ViewBag.Subventions2016 = subFilter.DataByYear(year: 2016);

            ViewBag.Subventions1  = subFilter.SubventionsByReligion("Evangelische Kirche Berlin - Brandenburg - schlesische Oberlausitz");
            ViewBag.Subventions2  = subFilter.SubventionsByReligion("Humanisitischer Verband Berlin - Brandenburg");
            ViewBag.Subventions3  = subFilter.SubventionsByReligion("Erzbistum Berlin");
            ViewBag.Subventions4  = subFilter.SubventionsByReligion("Islamische Föderation Berlin");
            ViewBag.Subventions5  = subFilter.SubventionsByReligion("Jüdische Gemeinde zu Berlin");
            ViewBag.Subventions6  = subFilter.SubventionsByReligion("Alevitische Gemeinde zu Berlin");
            ViewBag.Subventions7  = subFilter.SubventionsByReligion("Christengemeinschaft im Lande Berlin");
            ViewBag.Subventions8  = subFilter.SubventionsByReligion("Buddhistische Gesellschaft Berlin");
            ViewBag.Subventions9  = subFilter.SubventionsByReligion("Lauder Beth Zion");
            ViewBag.Subventions10 = subFilter.SubventionsByReligion("Jüdische Traditionsschule");

            ViewBag.Participants2011 = partfilter.ParticipantsByYear(year: 2011);
            ViewBag.Participants2012 = partfilter.ParticipantsByYear(year: 2012);
            ViewBag.Participants2013 = partfilter.ParticipantsByYear(year: 2013);
            ViewBag.Participants2014 = partfilter.ParticipantsByYear(year: 2014);
            ViewBag.Participants2015 = partfilter.ParticipantsByYear(year: 2015);
            ViewBag.Participants2016 = partfilter.ParticipantsByYear(year: 2016);

            ViewBag.Participants1 = partfilter.ParticipantsByReligionKey(1);
            ViewBag.Participants2 = partfilter.ParticipantsByReligionKey(2);
            ViewBag.Participants3 = partfilter.ParticipantsByReligionKey(3);
            ViewBag.Participants4 = partfilter.ParticipantsByReligionKey(4);
            ViewBag.Participants5 = partfilter.ParticipantsByReligionKey(5);
            ViewBag.Participants6 = partfilter.ParticipantsByReligionKey(6);
            ViewBag.Participants7 = partfilter.ParticipantsByReligionKey(7);
            ViewBag.Participants8 = partfilter.ParticipantsByReligionKey(8);
            ViewBag.Participants9 = partfilter.ParticipantsByReligionKey(9);

            return(View());
        }
Пример #11
0
        public async Task <IActionResult> Get(int id, [FromQuery] ParticipantFilter filters)
        {
            var result = new HttpResult <ParticipantDto>(this._logger);

            try
            {
                if (id.IsSent())
                {
                    filters.ParticipantId = id;
                }
                var returnModel = await this._app.GetOne(filters);

                return(result.ReturnCustomResponse(this._app, returnModel));
            }
            catch (Exception ex)
            {
                var responseEx = result.ReturnCustomException(ex, "Seed - Participant", id);
                return(responseEx);
            }
        }
        public async Task <IActionResult> Get([FromQuery] ParticipantFilter filters)
        {
            var result = new HttpResult <dynamic>(this._logger);

            try
            {
                if (filters.FilterBehavior == FilterBehavior.GetDataItem)
                {
                    var searchResult = await this._rep.GetDataItem(filters);

                    return(result.ReturnCustomResponse(searchResult, filters));
                }

                if (!this._user.GetClaims().GetTools().VerifyClaimsCanRead("Participant"))
                {
                    return(new ObjectResult(null)
                    {
                        StatusCode = (int)HttpStatusCode.Forbidden
                    });
                }


                if (filters.FilterBehavior == FilterBehavior.GetDataCustom)
                {
                    var searchResult = await this._rep.GetDataCustom(filters);

                    return(result.ReturnCustomResponse(searchResult, filters));
                }

                if (filters.FilterBehavior == FilterBehavior.GetDataListCustom)
                {
                    var searchResult = await this._rep.GetDataListCustom(filters);

                    return(result.ReturnCustomResponse(searchResult, filters));
                }

                if (filters.FilterBehavior == FilterBehavior.GetDataListCustomPaging)
                {
                    var paginatedResult = await this._rep.GetDataListCustomPaging(filters);

                    return(result.ReturnCustomResponse(paginatedResult.ToSearchResult <dynamic>(), filters));
                }


                if (filters.FilterBehavior == FilterBehavior.Export)
                {
                    var searchResult = await this._rep.GetDataListCustom(filters);

                    var export = new ExportExcelCustom <dynamic>(filters);
                    var file   = export.ExportFile(this.Response, searchResult, "Participant", this._env.RootPath);
                    return(File(file, export.ContentTypeExcel(), export.GetFileName()));
                }

                throw new InvalidOperationException("invalid FilterBehavior");
            }
            catch (Exception ex)
            {
                var responseEx = result.ReturnCustomException(ex, "Seed - Participant", filters, new ErrorMapCustom());
                return(responseEx);
            }
        }
Пример #13
0
        public static IQueryable <Participant> WithBasicFilters(this IQueryable <Participant> queryBase, ParticipantFilter filters)
        {
            var queryFilter = queryBase;

            if (filters.Ids.IsSent())
            {
                queryFilter = queryFilter.Where(_ => filters.GetIds().Contains(_.ParticipantId));
            }

            if (filters.ParticipantId.IsSent())
            {
                queryFilter = queryFilter.Where(_ => _.ParticipantId == filters.ParticipantId);
            }
            if (filters.UserId.IsSent())
            {
                queryFilter = queryFilter.Where(_ => _.UserId == filters.UserId);
            }
            if (filters.GroupParticipantId.IsSent())
            {
                queryFilter = queryFilter.Where(_ => _.GroupParticipantId != null && _.GroupParticipantId.Value == filters.GroupParticipantId);
            }
            if (filters.PhotoPerfil.IsSent())
            {
                queryFilter = queryFilter.Where(_ => _.PhotoPerfil.Contains(filters.PhotoPerfil));
            }
            if (filters.Name.IsSent())
            {
                queryFilter = queryFilter.Where(_ => _.Name.Contains(filters.Name));
            }
            if (filters.Description.IsSent())
            {
                queryFilter = queryFilter.Where(_ => _.Description.Contains(filters.Description));
            }
            if (filters.DocumentNumber.IsSent())
            {
                queryFilter = queryFilter.Where(_ => _.DocumentNumber == filters.DocumentNumber);
            }
            if (filters.UserCreateId.IsSent())
            {
                queryFilter = queryFilter.Where(_ => _.UserCreateId == filters.UserCreateId);
            }
            if (filters.UserCreateDate.IsSent())
            {
                queryFilter = queryFilter.Where(_ => _.UserCreateDate >= filters.UserCreateDate.AddHours(-filters.UserCreateDate.Hour).AddMinutes(-filters.UserCreateDate.Minute).AddSeconds(-filters.UserCreateDate.Second) && _.UserCreateDate <= filters.UserCreateDate.AddDays(1).AddHours(-filters.UserCreateDate.Hour).AddMinutes(-filters.UserCreateDate.Minute).AddSeconds(-filters.UserCreateDate.Second));
            }
            if (filters.UserCreateDateStart.IsSent())
            {
                queryFilter = queryFilter.Where(_ => _.UserCreateDate >= filters.UserCreateDateStart);
            }
            if (filters.UserCreateDateEnd.IsSent())
            {
                filters.UserCreateDateEnd = filters.UserCreateDateEnd.AddDays(1).AddMilliseconds(-1);
                queryFilter = queryFilter.Where(_ => _.UserCreateDate <= filters.UserCreateDateEnd);
            }

            if (filters.UserAlterId.IsSent())
            {
                queryFilter = queryFilter.Where(_ => _.UserAlterId != null && _.UserAlterId.Value == filters.UserAlterId);
            }
            if (filters.UserAlterDate.IsSent())
            {
                queryFilter = queryFilter.Where(_ => _.UserAlterDate != null && _.UserAlterDate >= filters.UserAlterDate.Value.AddHours(-filters.UserAlterDate.Value.Hour).AddMinutes(-filters.UserAlterDate.Value.Minute).AddSeconds(-filters.UserAlterDate.Value.Second) && _.UserAlterDate <= filters.UserAlterDate.Value.AddDays(1).AddHours(-filters.UserAlterDate.Value.Hour).AddMinutes(-filters.UserAlterDate.Value.Minute).AddSeconds(-filters.UserAlterDate.Value.Second));
            }
            if (filters.UserAlterDateStart.IsSent())
            {
                queryFilter = queryFilter.Where(_ => _.UserAlterDate != null && _.UserAlterDate.Value >= filters.UserAlterDateStart.Value);
            }
            if (filters.UserAlterDateEnd.IsSent())
            {
                filters.UserAlterDateEnd = filters.UserAlterDateEnd.Value.AddDays(1).AddMilliseconds(-1);
                queryFilter = queryFilter.Where(_ => _.UserAlterDate != null && _.UserAlterDate.Value <= filters.UserAlterDateEnd);
            }



            return(queryFilter);
        }
 public static IQueryable <Participant> OrderByDomain(this IQueryable <Participant> queryBase, ParticipantFilter filters)
 {
     return(queryBase.OrderBy(_ => _.ParticipantId));
 }
 public virtual async Task <Participant> GetOne(ParticipantFilter filters)
 {
     return(await this._rep.GetById(filters));
 }
        public static IQueryable <Participant> WithCustomFilters(this IQueryable <Participant> queryBase, ParticipantFilter filters)
        {
            var queryFilter = queryBase;


            return(queryFilter);
        }
        public virtual Task <PaginateResult <Participant> > GetByFiltersPaging(ParticipantFilter filters)
        {
            var queryBase = this._rep.GetBySimplefilters(filters);

            return(this._rep.PagingAndDefineFields(filters, queryBase));
        }
        public virtual async Task <IEnumerable <Participant> > GetByFilters(ParticipantFilter filters)
        {
            var queryBase = this._rep.GetBySimplefilters(filters);

            return(await this._rep.ToListAsync(queryBase));
        }