Exemplo n.º 1
0
        private async Task <Model.AuthUser> readQR(Image img, APIService apiService)
        {
            var result = QRCodeHelper.DecodeQRCode(img);

            if (result != string.Empty)
            {
                var search = new Model.SearchRequest.AuthUserSearchRequest()
                {
                    qrCode = result
                };
                var user = await apiService.Get <List <Model.AuthUser> >(search);

                if (user.Count > 0)
                {
                    return(user[0]);
                }
            }
            return(null);
        }
Exemplo n.º 2
0
        async void loadData()
        {
            userEvent = await apiService_event.GetById <Model.Event>(eventId);

            lblEventGroupId.Text = userEvent.EventGroupId;

            #region load_dates
            var eventSearch = new EventSearchRequest()
            {
                EventGroupId = userEvent.EventGroupId
            };
            var eventSearchResult = await apiService_event.Get <List <Model.Event> >(eventSearch);

            //taking only events that did not happen
            eventSearchResult = eventSearchResult.Where(e => e.EventDate >= DateTime.Now).OrderBy(e => e.EventDate).ToList();
            if (eventSearchResult.Count <= 1)
            {
                cbMultiple.Checked         = false;
                cbMultiple.Visible         = false;
                panelMultipleDates.Visible = false;
            }
            else
            {
                foreach (var x in eventSearchResult)
                {
                    var d = new Model.DateBasic()
                    {
                        Date = x.EventDate, eventId = x.Id
                    };
                    dates.Add(d);
                }


                for (int i = 0; i < dates.Count; i++)
                {
                    cblDates.Items.Add(dates[i]);
                    cblDates.SetItemChecked(i, true);
                }
                cblDates.DisplayMember = "Display";
            }
            #endregion load_dates

            var presenceSearch = new Model.SearchRequest.PresenceSearchRequest()
            {
                EventId = eventId
            };
            #region search parametres



            #endregion search parametres
            var presence = await apiService_presence.Get <List <Model.Presence> >(presenceSearch);

            var authUserSearch = new Model.SearchRequest.AuthUserSearchRequest();
            #region search parametres
            authUserSearch.FirstName   = txtFirstName.Text;
            authUserSearch.LastName    = txtLastName.Text;
            authUserSearch.UserName    = txtUserName.Text;
            authUserSearch.RoleId      = (int)cbRole.SelectedValue;
            authUserSearch.UserGroupId = (int)cbGroup.SelectedValue;
            #endregion search parametres
            var users = await apiService_authUser.Get <List <Model.AuthUser> >(authUserSearch);

            List <Model.presenceBasic> data = new List <Model.presenceBasic>();
            foreach (Model.AuthUser user in users)
            {
                var temp = new Model.presenceBasic()
                {
                    Id        = user.Id,
                    FirstName = user.FirstName,
                    LastName  = user.LastName,
                    UserName  = user.UserName,
                };
                temp.AttendingEvent = presence.Any(p => p.UserId == user.Id);
                data.Add(temp);
            }
            dgvPresence.DataSource = data;
        }