Пример #1
0
        public InterfaceMember(Declaration member, IEnumerable <Declaration> declarations)
        {
            Member = member;
            Type   = member.AsTypeName;

            GetMethodType();

            MemberParams = declarations.Where(item => item.DeclarationType == DeclarationType.Parameter &&
                                              item.ParentScope == Member.Scope)
                           .OrderBy(o => o.Selection.StartLine)
                           .ThenBy(t => t.Selection.StartColumn)
                           .Select(p => new Parameter
            {
                ParamAccessibility = ((VBAParser.ArgContext)p.Context).BYREF() == null ? Tokens.ByVal : Tokens.ByRef,
                ParamName          = p.IdentifierName,
                ParamType          = p.AsTypeName
            })
                           .ToList();

            if (MemberType == "Property Get")
            {
                MemberParams = MemberParams.Take(MemberParams.Count() - 1);
            }

            IsSelected = false;
        }
Пример #2
0
        /// <summary>
        /// 会员查询接口
        /// </summary>
        /// <param name="member"></param>
        /// <param name="doPost"></param>
        /// <param name="queryType"></param>
        public async static void ValidMemberInfo(MemberParams member, Func <string, bool> doPost, MemberQueryType queryType = MemberQueryType.Mobile)
        {
            using (var client = new HttpClient())
            {
                bool isMobileQuery = queryType == MemberQueryType.Mobile;
                var  queryTypeName = isMobileQuery ? "mobile" : "cardid";
                var  interfaceName = isMobileQuery ? MemberInterface.mobile : MemberInterface.card;
                var  url           = string.Format(ConfigHelper.GetAppConfig("MemberGateway"), interfaceName);
                member.url        = url;
                member.appid      = ConfigHelper.GetAppConfig("appid");
                member.secret_key = ConfigHelper.GetAppConfig("Secretkey");
                var sign = Encodetool.Md5_32($"appid={member.appid}&{queryTypeName}={member.queryid}{member.secret_key}");
                member.sign = sign;
                var values = new List <KeyValuePair <string, string> >();
                values.Add(new KeyValuePair <string, string>(queryTypeName, member.queryid));
                values.Add(new KeyValuePair <string, string>("appid", member.appid));
                values.Add(new KeyValuePair <string, string>("sign", sign));
                var content  = new FormUrlEncodedContent(values);
                var response = await client.PostAsync(member.url, content);

                var resString = await response.Content.ReadAsStringAsync();

                doPost(resString);
            }
        }
Пример #3
0
        public InterfaceMember(Declaration member, IEnumerable <Declaration> declarations)
        {
            Member = member;
            Type   = member.AsTypeName;

            GetMethodType();

            var memberWithParams = member as IParameterizedDeclaration;

            if (memberWithParams != null)
            {
                MemberParams = memberWithParams.Parameters
                               .OrderBy(o => o.Selection.StartLine)
                               .ThenBy(t => t.Selection.StartColumn)
                               .Select(p => new Parameter
                {
                    ParamAccessibility =
                        ((VBAParser.ArgContext)p.Context).BYVAL() != null ? Tokens.ByVal : Tokens.ByRef,
                    ParamName = p.IdentifierName,
                    ParamType = p.AsTypeName
                })
                               .ToList();
            }
            else
            {
                MemberParams = new List <Parameter>();
            }

            if (MemberType == "Property Get")
            {
                MemberParams = MemberParams.Take(MemberParams.Count() - 1);
            }

            IsSelected = false;
        }
Пример #4
0
        public async Task <ActionResult <IEnumerable <MemberDto> > > GetMembers([FromQuery] MemberParams memberParams)
        {
            var members = await _unitOfWork.MemberRepository.GetMembersAsync(memberParams);

            Response.AddPaginationHeader(members.CurrentPage, members.PageSize, members.TotalCount, members.TotalPages);

            return(Ok(members));
        }
        public ParallelDropdownsBuilder <T> WithEnum <TProperty>(Expression <Func <T, TProperty> > expression,
                                                                 Func <IEnumerable <DropdownOption>, IEnumerable <DropdownOption> > filter = null)
        {
            var memberName = GetMemberParams(expression);

            _memberName = memberName;
            _optionBuilders[memberName.Key] = new EnumDropdownBuilder <TProperty>(filter, memberName.Name);
            return(this);
        }
        public ParallelDropdownsBuilder <T> With <TProperty>(Expression <Func <T, TProperty> > expression,
                                                             Func <IQueryable <T>, IServiceProvider, IQueryable <DropdownOption <TProperty> > > options)
        {
            var memberName = GetMemberParams(expression);

            _memberName = memberName;
            _optionBuilders[memberName.Key] = new ServiceProviderDropdownBuilder <T>(_serviceProvider, options, memberName.Name);
            return(this);
        }
        public ParallelDropdownsBuilder <T> With <TProperty, TSource>(Expression <Func <T, TProperty> > expression,
                                                                      Func <IQueryable <TSource>, IQueryable <DropdownOption> > options)
            where TSource : class
        {
            var memberName = GetMemberParams(expression);

            _memberName = memberName;
            _optionBuilders[memberName.Key] = new DbContextDropdownBuilder <TSource>(_serviceProvider, options, memberName.Name);
            return(this);
        }
        public ParallelDropdownBuilderConfiguration <T> With <TProperty>(Expression <Func <T, TProperty> > expression)
        {
            var memberName = GetMemberParams(expression);

            _memberName = memberName;
            var c = new ParallelDropdownBuilderConfiguration <T>(this, _serviceProvider, memberName.Name);

            _optionBuilders[memberName.Key] = c;
            return(c);
        }
        public async Task <IActionResult> GetMembers([FromQuery] MemberParams memberParams)
        {
            var members = await _repo.GetMembers(memberParams);

            var membersToReturn = _mapper.Map <IEnumerable <MemberForListDto> >(members);

            Response.AddPagination(members.CurrentPage, members.PageSize, members.TotalCount, members.TotalPages);

            return(Ok(membersToReturn));
            // return Ok(employees);
        }
Пример #10
0
        public IActionResult GetPointsdetails([FromQuery] MemberParams memberParams)
        {
            var ownpoints  = _repo.GetMemberIndividualPoints(memberParams.MemberId);
            var teamPoints = _repo.GetMemberTeamPoints(memberParams.MemberId, memberParams.TeamLeadId);
            PointsToReturnDto pointsToReturnDto = new PointsToReturnDto();

            pointsToReturnDto.IndividualPoints = ownpoints;
            pointsToReturnDto.TeamPoints       = teamPoints;
            if (pointsToReturnDto == null)
            {
                return(NotFound());
            }
            return(Ok(pointsToReturnDto));
        }
        public async Task <PageList <MemberDto> > GetMembersAsync(MemberParams memberParams)
        {
            var query = _context.Member.AsQueryable();

            if (memberParams.LastName?.Length > 0)
            {
                query = query.Where(member => member.LastName.ToLower().Contains(memberParams.LastName.ToLower()));
            }

            if (memberParams.FirstName?.Length > 0)
            {
                query = query.Where(member => member.FirstName.ToLower().Contains(memberParams.FirstName.ToLower()));
            }

            if (memberParams.PatrolId > 0)
            {
                query = query.Where(member => member.PatrolId == memberParams.PatrolId);
            }

            switch (memberParams.MemberType)
            {
            case eMemberType.Adult:
                query = query.Where(member => member.Scout == false);
                query = query.Where(member => member.PatrolId != 91272);
                break;

            case eMemberType.AgeScout:
                query = query.Where(member => member.Scout == false);
                query = query.Where(member => member.PatrolId == 91272);
                break;

            default:
                query = query.Where(member => member.Scout == true);
                break;
            }

            query = memberParams.OrderBy switch
            {
                "name" => query.OrderBy(member => member.LastName).ThenBy(member => member.FirstName),
                _ => query.OrderBy(member => member.Patrol).ThenBy(member => member.LastName)
            };

            var members = await PageList <MemberDto> .CreateAsync(
                query.ProjectTo <MemberDto>(_mapper.ConfigurationProvider)
                .AsNoTracking(),
                memberParams.PageNumber,
                memberParams.PageSize);

            return(members);
        }
Пример #12
0
        public async Task <PagedList <Member> > GetMembersWithMembershipTypeAsync(MemberParams memberParams)
        {
            IQueryable <Member> query = _context.Members
                                        .Include(m => m.MembershipType);

            query = memberParams.Filter switch
            {
                "membershiptype" => query.OrderBy(m => m.MembershipType.Id),
                "lastlogin" => query.OrderByDescending(m => m.LastLogin),
                "booksremaining" => query.OrderByDescending(m => m.BooksRemaining),
                _ => query.OrderBy(m => m.Name)
            };

            return(await PagedList <Member> .CreateAsync(query, memberParams.PageNumber, memberParams.PageSize));
        }
Пример #13
0
        public async Task<ActionResult<IEnumerable<Member>>> Index(int? pageNumber, int? pageSize, string memberFilter)
        {
            var memberParams = new MemberParams
            {
                PageNumber = pageNumber ?? 1,
                PageSize = pageSize ?? Convert.ToInt32(_config.GetValue<string>("MemberPagination:PageSize")),
                Filter = memberFilter ?? "none"
            };

            var memberFilterViewModel = new MemberFilterViewModel
            {
                Members = await _unitOfWork.Members.GetMembersWithMembershipTypeAsync(memberParams),
                MemberFilters = Utility.MemberFilters.GetMemberFilters()
            };

            return View(memberFilterViewModel);
        }
Пример #14
0
        /// <summary>
        /// 会员查询
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void searchMember_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            var member = new MemberParams {
                queryid = searchMember.Text.Trim()
            };
            Func <string, JObject> doSetdata = res =>
            {
                Newtonsoft.Json.Linq.JObject jobject = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(res);
                int error_code = int.Parse(jobject["error_code"].ToString());
                if (!(error_code > 0))
                {
                    string name = jobject["name"].ToString() == "" ? jobject["nickname"].ToString() : jobject["name"].ToString();
                    lblMemberLevel.Text        = $"会员等级:{jobject["level"].ToString()}";
                    lblMemberName.Text         = $"会员姓名:{name}";
                    lblScore.Text              = $"会员积分:{jobject["point"].ToString()}";
                    crashierParams.member_id   = jobject["uid"].ToString();
                    crashierParams.member_name = jobject["name"].ToString();
                    splitContainerControl2.SplitterPosition = splitContainerControl2.Height - 70;
                }
                return(jobject);
            };

            ExternalAPI.ValidMemberInfo(member, (response) =>
            {
                var jObject    = doSetdata(response);
                int error_code = int.Parse(jObject["error_code"].ToString());
                if (error_code > 0)
                {
                    ExternalAPI.ValidMemberInfo(member, res =>
                    {
                        var obj    = doSetdata(res);
                        error_code = int.Parse(jObject["error_code"].ToString());
                        if (error_code > 0)
                        {
                            ShowMessage(jObject["msg"].ToString());
                            lblMemberLevel.Text = "";
                            lblMemberName.Text  = "";
                            lblScore.Text       = "";
                        }
                        return(true);
                    }, MemberQueryType.CardId);
                }
                return(true);
            });
        }
        public async Task <PagedList <Member> > GetMembers(MemberParams memberParams)
        {
            var members = _context.Members.AsQueryable();

            members = members.Where(e => e.IsDelete == false);

            if (memberParams.Name != null)
            {
                members = members.Where(e => e.Name.ToLower().Contains(memberParams.Name));
            }

            if (memberParams.Phone != null)
            {
                if (memberParams.Phone.All(char.IsDigit))
                {
                    members = members.Where(e => e.Phone.Contains(memberParams.Phone));
                }
            }

            if (memberParams.Address != null)
            {
                members = members.Where(e => e.Address.ToLower().Contains(memberParams.Address));
            }

            if (memberParams.Gender != null)
            {
                members = members.Where(e => e.Gender.Contains(memberParams.Gender));
            }

            if (memberParams.Age != 0)
            {
                members = members.Where(e => e.DateOfBirth.CalculateAge() == memberParams.Age);
            }

            return(await PagedList <Member> .CreateAsync(members, memberParams.PageNumber, memberParams.PageSize));
        }