当前位置: 首页>>代码示例>>C#>>正文


C# Subscriber.MapTo方法代码示例

本文整理汇总了C#中Subscriber.MapTo方法的典型用法代码示例。如果您正苦于以下问题:C# Subscriber.MapTo方法的具体用法?C# Subscriber.MapTo怎么用?C# Subscriber.MapTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Subscriber的用法示例。


在下文中一共展示了Subscriber.MapTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetSubscriber

        public Dtos.SubscribersDto GetSubscriber(Dtos.GetSubscribersInput input)
        {
            //Get the Subscriber(s)  
            //NOTE:  If multiple subscribers come back than we need to filter based on subscribers associated to criteria for a company
            //NOTE:  May need to refactor by adding CompanyRefId to Subscriber
            List<Subscriber> subscribers = new List<Subscriber>();
            Subscriber subscriber = new Subscriber();
            SubscribersDto subscriberDto = new SubscribersDto();
            try
            {
                if (input.SubscribersEmail != string.Empty)
                {
                    subscribers = _subscribersRepository.GetSubscriberByEmail(input.SubscribersEmail);
                    if (subscribers.Count > 1)
                    {
                        int subscriberId = 0;
                        foreach (var item in subscribers)
                        {
                            List<SubscriberCriteria> scList =
                                _subscribersValuesRepository.GetSubscribersCriteriaValues(item.Id, input.CompanyId.Value);
                            if (scList != null)
                            {
                                if (scList.Count > 0)
                                {
                                    subscriberId = item.Id;
                                }
                            }
                        }
                        subscriber = subscribers.Where(s => s.Id == subscriberId).FirstOrDefault();
                        subscriberDto = subscriber.MapTo<SubscribersDto>();
                    }
                    else
                    {
                        subscriber = subscribers.FirstOrDefault();
                        subscriberDto = subscriber.MapTo<SubscribersDto>();
                        if (subscriber != null)
                        {
                            //Get subscriber images from DocumentHero
                            #region Get Subscriber Image
                            var inputFileExt = new List<FileExtDto>();
                            var inputFileExtValue = new FileExtDto()
                            {
                                Key = "SubscriberId",
                                Value = subscriber.Id.ToString(),
                                FileRefId = input.CompanyId.Value
                            };
                            inputFileExt.Add(inputFileExtValue);
                            GetFileInput fileInput = new GetFileInput();
                            fileInput.ApiKey = input.CompanyId;
                            fileInput.FileMetadata = inputFileExt;
                            //var _fileExtRepository = _iocResolver.Resolve<IFileExtRepository>();
                            //var fileService = IocManager.Instance.Resolve<FileAppService>();
                            //var imageUri = fileService.GetFiles(fileInput);

                            //DocumentHero.Files.FileAppService fileAppService = new FileAppService();
                            var resultsImage = _documentHeroService.GetAllByKeyValue(fileInput);
                            if (resultsImage.Files != null)
                            {
                                subscriberDto.ImageUri = resultsImage.Files[0].Uri;
                            }
                        }
                        #endregion

                    }
                }

                return subscriberDto;
            }
            catch(System.Exception exc)
            {
                Logger.ErrorFormat("CH_SAS_000", exc.StackTrace);
                throw exc;
            }
        }
开发者ID:gjimenez523,项目名称:CreditsHero,代码行数:74,代码来源:SubscribersAppService.cs


注:本文中的Subscriber.MapTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。