コード例 #1
0
        public string GetImageUrl(ProgramInfoDto item, ImageOptions options)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            options.Tag = item.ImageTags[options.ImageType];

            return(GetImageUrl(item.Id, options));
        }
コード例 #2
0
        public ProgramInfoDto GetProgramInfoDto(LiveTvProgram item, LiveTvChannel channel, User user = null)
        {
            var dto = new ProgramInfoDto
            {
                Id              = GetInternalProgramId(item.ServiceName, item.ExternalId).ToString("N"),
                ChannelId       = GetInternalChannelId(item.ServiceName, item.ExternalChannelId).ToString("N"),
                Overview        = item.Overview,
                Genres          = item.Genres,
                ExternalId      = item.ExternalId,
                Name            = item.Name,
                ServiceName     = item.ServiceName,
                StartDate       = item.StartDate,
                OfficialRating  = item.OfficialRating,
                IsHD            = item.IsHD,
                OriginalAirDate = item.PremiereDate,
                Audio           = item.Audio,
                CommunityRating = GetClientCommunityRating(item.CommunityRating),
                IsRepeat        = item.IsRepeat,
                EpisodeTitle    = item.EpisodeTitle,
                IsMovie         = item.IsMovie,
                IsSeries        = item.IsSeries,
                IsSports        = item.IsSports,
                IsLive          = item.IsLive,
                IsNews          = item.IsNews,
                IsKids          = item.IsKids,
                IsPremiere      = item.IsPremiere,
                Type            = "Program"
            };

            if (item.EndDate.HasValue)
            {
                dto.EndDate = item.EndDate.Value;

                dto.RunTimeTicks = (item.EndDate.Value - item.StartDate).Ticks;
            }

            if (channel != null)
            {
                dto.ChannelName = channel.Name;

                if (!string.IsNullOrEmpty(channel.PrimaryImagePath))
                {
                    dto.ChannelPrimaryImageTag = GetImageTag(channel);
                }
            }

            var imageTag = GetImageTag(item);

            if (imageTag.HasValue)
            {
                dto.ImageTags[ImageType.Primary] = imageTag.Value;
            }

            if (user != null)
            {
                dto.UserData = _dtoService.GetUserItemDataDto(_userDataManager.GetUserData(user.Id, item.GetUserDataKey()));

                dto.PlayAccess = item.GetPlayAccess(user);
            }

            return(dto);
        }
コード例 #3
0
        public async Task <string> AddEditProgramInfo(ProgramInfoDto model, string clientIpAddress)
        {
            try
            {
                string prgTp   = string.Empty;
                var    id      = model.JPOS_IssuerId;
                var    prgType = (await _programTypeService.GetProgramTypesDetailByIds(new List <int> {
                    model.ProgramTypeId.Value
                })).ToList();
                if (prgType.Count > 0)
                {
                    prgTp = prgType.Select(x => x.ProgramTypeName).FirstOrDefault();
                }
                var oIssuerJPOS = new IssuerJPOSDto()
                {
                    active         = true,
                    programId      = model.ProgramCodeId,
                    name           = model.name,
                    tz             = model.timeZone,
                    organizationId = model.OrganisationJPOSId,
                    address1       = model.address,
                    city           = model.city,
                    country        = model.country,
                    programType    = prgTp,
                    state          = model.state,
                    website        = model.website,
                    zip            = model.zipcode
                };
                int result = await _sharedJPOSService.PostRespectiveDataJPOS(JPOSAPIURLConstants.Issuers, oIssuerJPOS, id, clientIpAddress, JPOSAPIConstants.Issuers);

                if (result > 0 && model.id <= 0)
                {
                    model.JPOS_IssuerId = result.ToString();
                }
                var chkExist = await FindAsync(new { model.id });

                if (chkExist == null)
                {
                    chkExist = new Program();
                }
                if (model.name != null)
                {
                    chkExist.name = model.name;
                }
                chkExist.organisationId        = model.organisationId;
                chkExist.AccountHolderGroups   = model.AccountHolderGroups;
                chkExist.AccountHolderUniqueId = model.AccountHolderUniqueId;
                chkExist.address   = model.address;
                chkExist.city      = model.city;
                chkExist.colorCode = model.colorCode;
                chkExist.country   = model.country;
                if (model.createdBy != null)
                {
                    chkExist.createdBy = model.createdBy;
                }
                if (model.createdDate != null)
                {
                    chkExist.createdDate = model.createdDate;
                }
                chkExist.customErrorMessaging = model.customErrorMessaging;
                chkExist.customInputMask      = model.customInputMask;
                chkExist.customInstructions   = model.customInstructions;
                chkExist.customName           = model.customName;
                chkExist.description          = model.description;
                if (model.isActive != null)
                {
                    chkExist.isActive = model.isActive;
                }
                if (model.isDeleted != null)
                {
                    chkExist.isDeleted = model.isDeleted;
                }
                if (model.modifiedBy != null)
                {
                    chkExist.modifiedBy = model.modifiedBy;
                }
                if (model.modifiedDate != null)
                {
                    chkExist.modifiedDate = model.modifiedDate;
                }
                if (model.ProgramCodeId != null)
                {
                    chkExist.ProgramCodeId = model.ProgramCodeId;
                }
                chkExist.programCustomFields = model.programCustomFields;
                chkExist.ProgramTypeId       = model.ProgramTypeId;
                chkExist.state    = model.state;
                chkExist.timeZone = model.timeZone;
                chkExist.website  = model.website;
                chkExist.zipcode  = model.zipcode;
                chkExist.id       = model.id;
                chkExist.IsAllNotificationShow = model.IsAllNotificationShow;
                chkExist.IsRewardsShowInApp    = model.IsRewardsShowInApp;
                chkExist.JPOS_IssuerId         = model.JPOS_IssuerId;
                var resultPrg = await InsertOrUpdateAsync(chkExist, new { model.id });

                await _orgProgram.AddSpecificOrganisationProgram(resultPrg, model.organisationId);

                return(Cryptography.EncryptPlainToCipher(Convert.ToString(resultPrg)));
            }
            catch (Exception)
            {
                throw;
            }
        }