Example #1
0
 public static BaseCurrencyDTO Entity2BaseCurrencyDto(this ADMIN_SaleSummaryToken entity)
 {
     return(new BaseCurrencyDTO
     {
         CurrencyId = entity.CurrencyId ?? -1
         , CurrencyName = entity.CurrencyName ?? string.Empty
         , ISO = entity.ISO ?? string.Empty
         , Symbol = entity.Symbol ?? string.Empty
     });
 }
Example #2
0
        public static PayoutUserMonthlyStatementDTO Entity2ReportRowDto(this ADMIN_SaleSummaryToken entity, int year, int month)
        {
            var token = new PayoutUserMonthlyStatementDTO
            {
                Sales        = entity.total.FormatMoney(2)
                , Refund     = entity.refund.FormatMoney(2)
                , Fees       = entity.fee.FormatMoney(2)
                , RefundFees = entity.refundFee.FormatMoney(2)
                , Balance    = entity.total.SalesToBalance(entity.fee, entity.refund, entity.refundFee)
                , Year       = year
                , Month      = month
                , Currency   = entity.Entity2BaseCurrencyDto()
            };

            if (entity.SellerUserId != null)
            {
                token.SellerId = (int)entity.SellerUserId;
                token.Seller   = new BaseUserInfoDTO
                {
                    UserId     = (int)entity.SellerUserId
                    , Email    = entity.Email
                    , FullName = entity.Entity2FullName()
                };
            }

            token.LfeCommission = token.Balance.BalanceToLfeCommission();

            token.Payout = token.Balance.BalanceToPayout(token.LfeCommission);//Sales.ToPayout(token.Fees , token.Commission , token.Refund);

            if (entity.PayoutTypeId == null)
            {
                return(token);
            }

            token.PayoutSettings = new PayoutSettingsDTO
            {
                PayoutType = Utils.ParseEnum <BillingEnums.ePayoutTypes>(entity.PayoutTypeId.ToString())
                , Email    = entity.PaypalEmail
            };

            if (entity.PayoutAddressID == null)
            {
                return(token);
            }

            token.PayoutSettings.Address = String.Format("{0} {1},{2}, {3} {4}, {5}, {6} {7}", entity.AddressFirstName, entity.AddressLastName, entity.PostalCode, entity.CountryName, entity.StateName, entity.CityName, entity.Street1, entity.Street2);

            return(token);
        }
Example #3
0
 public static string Entity2FullName(this ADMIN_SaleSummaryToken entity)
 {
     return(CombineFullName(entity.FirstName, entity.LastName, entity.Nickname));
 }