public static BaseListDTO BundleEntity2BaseListDto(this CRS_Bundles entity) { return(new BaseListDTO { id = entity.BundleId , name = entity.BundleName }); }
public static BaseEntityDTO BundleEntity2BaseEntityDTO(this CRS_Bundles entity) { return(new BaseEntityDTO { id = entity.BundleId , Uid = entity.uid , name = entity.BundleName }); }
public static Payment BasePaymentDto2RestApiPayment(this BasePaymentDTO dto, BillingEnums.ePaymentAction action, BillingEnums.ePaymentMethods method, bool keepDecimal, RedirectUrls urls = null, Courses entity = null, CRS_Bundles bundleEntity = null, Payer payer = null) { var payment = new Payment { intent = action.EnumToLowerString(), payer = new Payer { payment_method = method.EnumToLowerString() }, transactions = new List <Transaction> { dto.PaymentDto2TransactionToken(keepDecimal) } }; if (urls != null) { payment.redirect_urls = urls; } if (entity != null) { payment.transactions[0].item_list = new ItemList { items = new List <Item> { entity.CourseEntity2PaypalRestApiItem(dto, keepDecimal) } }; } else if (bundleEntity != null) { payment.transactions[0].item_list = new ItemList { items = new List <Item> { bundleEntity.BundleEntity2PaypalRestApiItem(dto, keepDecimal) } }; } if (payer != null) { payment.payer = payer; } return(payment); }
public static BaseItemListDTO BundleEntity2BaseItemListDto(this CRS_Bundles entity) { return(new BaseItemListDTO { id = entity.BundleId , name = entity.BundleName , desc = entity.BundleDescription , type = BillingEnums.ePurchaseItemTypes.BUNDLE }); }
private static Item BundleEntity2PaypalRestApiItem(this CRS_Bundles entity, BasePaymentDTO dto, bool keepDecimal) { return(new Item { name = entity.BundleName , price = dto.amount.FormatMoney(keepDecimal ? 2 : 0).ToString(CultureInfo.InvariantCulture) , currency = dto.currency , quantity = "1" , sku = entity.BundleId.ToString() }); }
public static BundlePriceDTO Entity2BundlePriceDTO(this CRS_Bundles entity, CurrencyDTO currency) { return(new BundlePriceDTO { BundleId = entity.BundleId // ,Price = entity.Price.ItemPrice2DisplayPrice() // ,MonthlySubscriptionPrice = entity.MonthlySubscriptionPrice.ItemPrice2DisplayPrice() , AffiliateCommission = entity.AffiliateCommission , Currency = currency.ToBaseCurrencyDto() }); }
public static BaseBundleDTO BundleEntity2BaseBundleDto(this CRS_Bundles entity) { return(new BaseBundleDTO { BundleId = entity.BundleId , BundleName = entity.BundleName , AuthorId = entity.AuthorId , Description = entity.BundleDescription , PromoVideoIdentifier = String.IsNullOrEmpty(entity.OverviewVideoIdentifier) ? (long?)null : Int64.Parse(entity.OverviewVideoIdentifier) }); }
public static ItemPurchaseDataToken BundleToken2ItemPurchaseDataToken(this CRS_Bundles token, decimal?price, decimal?monthlySubscriptionPrice) { return(new ItemPurchaseDataToken { ItemId = token.BundleId , ItemName = token.BundleName , Type = BillingEnums.ePurchaseItemTypes.BUNDLE , Price = price.FormatPrice() , MonthlySubscriptionPrice = monthlySubscriptionPrice.FormatPrice() , Author = new UserBaseDTO { userId = token.AuthorId , fullName = token.Users.Entity2FullName() } }); }
public static void UpdateBundleEntity(this CRS_Bundles entity, BundleEditDTO dto) { entity.BundleName = dto.BundleName.TrimString(); entity.BundleUrlName = dto.BundleName.TrimString().OptimizedUrl(); entity.BundleDescription = dto.Description.TrimString(); entity.OverviewVideoIdentifier = dto.PromoVideoIdentifier.ToString(); entity.BannerImage = dto.ThumbName; entity.StatusId = (short)dto.Status; entity.MetaTags = dto.MetaTags; entity.UpdateDate = DateTime.Now; entity.UpdatedBy = DtoExtensions.CurrentUserId; if (entity.PublishDate == null && dto.Status == CourseEnums.CourseStatus.Published) { entity.PublishDate = DateTime.Now; } }
public static BundlePurchaseDTO BundleEntity2BundlePurchaseDto(this CRS_Bundles entity, decimal?price, decimal?monthlySubscriptionPrice) { return(new BundlePurchaseDTO { BundleId = entity.BundleId , BundleName = entity.BundleName , MetaTags = entity.MetaTags , ThumbUrl = String.IsNullOrEmpty(entity.BannerImage) ? string.Empty : Constants.ImageBaseUrl + entity.BannerImage , NumSubscribers = entity.USER_Bundles.Count , Price = price.FormatNullablePrice() , MonthlySubscriptionPrice = monthlySubscriptionPrice.FormatNullablePrice() , IsFreeCourse = false , IntroHtml = entity.BundleDescription , OverviewVideoIdentifier = entity.OverviewVideoIdentifier , BundleUrlName = entity.BundleUrlName }); }
public static ItemInfoToken BundleEntity2ItemInfoToken(this CRS_Bundles entity, Users author, bool isUnderRGP) { return(new ItemInfoToken { ItemId = entity.BundleId , ItemName = entity.BundleName , ItemType = BillingEnums.ePurchaseItemTypes.BUNDLE , Uid = entity.uid , IntroHtml = entity.BundleDescription , OverviewVideoIdentifier = string.IsNullOrEmpty(entity.OverviewVideoIdentifier) ? (long?)null : long.Parse(entity.OverviewVideoIdentifier) , ThumbUrl = entity.BannerImage.ToThumbUrl(Constants.ImageBaseUrl) , Author = new BaseUserInfoDTO { UserId = author.Id , FullName = author.Entity2FullName() } , IsAuthorUnderRGP = isUnderRGP }); }
public static BundleEditDTO BundleEntity2BundleEditDto(this CRS_Bundles entity, bool isAnyPrices) { var token = new BundleEditDTO { BundleId = entity.BundleId , Uid = entity.uid , AuthorId = entity.AuthorId , BundleName = entity.BundleName , Description = entity.BundleDescription , MetaTags = entity.MetaTags , Status = Utils.ParseEnum <CourseEnums.CourseStatus>(entity.StatusId.ToString()) , ThumbName = entity.BannerImage , ThumbUrl = entity.BannerImage.ToThumbUrl(Constants.ImageBaseUrl) , IsBundlePurchased = entity.USER_Bundles.ToList().Any() , IsPriceDefined = isAnyPrices , HasCourses = entity.CRS_BundleCourses.ToList().Any() , Categories = new List <int>() }; if (String.IsNullOrEmpty(entity.OverviewVideoIdentifier)) { token.PromoVideoIdentifier = null; } else { long bcId; var parsed = Int64.TryParse(entity.OverviewVideoIdentifier, out bcId); if (parsed) { token.PromoVideoIdentifier = bcId; } } return(token); }
public static ItemPurchaseCompleteToken BundleEntity2ItemPurchaseCompleteToken(this CRS_Bundles entity, vw_SALE_OrderLines orderLineEntity, BaseUserInfoDTO buyer) { return(new ItemPurchaseCompleteToken { ItemId = entity.BundleId , ItemName = entity.BundleName , ItemType = BillingEnums.ePurchaseItemTypes.COURSE , ThumbUrl = entity.BannerImage.ToThumbUrl(Constants.ImageBaseUrl) , FinalPrice = 0 , PriceToken = null , BuyerInfo = buyer , Author = new BaseUserInfoDTO { UserId = orderLineEntity.SellerUserId , FullName = orderLineEntity.Entity2SellerFullName() } }); }
public static void UpdateBundleAffiliateCommission(this CRS_Bundles entity, decimal?commission) { entity.AffiliateCommission = commission ?? entity.AffiliateCommission; entity.UpdateDate = DateTime.Now; entity.UpdatedBy = DtoExtensions.CurrentUserId; }
public static void UpdateBundleEntityPrice(this CRS_Bundles entity, BundlePriceDTO token) { entity.AffiliateCommission = token.AffiliateCommission ?? entity.AffiliateCommission; entity.UpdateDate = DateTime.Now; entity.UpdatedBy = DtoExtensions.CurrentUserId; }