Example #1
0
        public static Subscription DecorateSubscription(SUBSCRIPTION_V sub)
        {
            var sb = new Subscription
            {
                User        = sub.User,
                RenewAuto   = sub.RenewAuto ?? true,
                Service     = sub.Service,
                TimeEnd     = sub.TimeEnd,
                TimeStarted = sub.TimeStarted
            };

            sb.PaidService = new PaidService
            {
                Id          = sub.Service,
                Comment     = sub.Comment,
                FixedPrice  = sub.FixedPrice ?? 0,
                AccountId   = sub.AccountId,
                Currency    = sub.Currency,
                ServiceType = (PaidServiceType)sub.ServiceType
            };
            if (sub.AutoTrade.HasValue)
            {
                sb.AutoTradeSettings = new AutoTradeSettings
                {
                    TradeAuto            = sub.AutoTrade.Value,
                    VolumeRound          = (VolumeRoundType?)sub.VolumeRound,
                    FixedVolume          = sub.FixedVolume,
                    HedgingOrdersEnabled = sub.HedgingOrdersEnabled,
                    MaxLeverage          = sub.MaxLeverage,
                    MaxVolume            = sub.MaxVolume,
                    MinVolume            = sub.MinVolume,
                    PercentLeverage      = sub.PercentLeverage ?? 100,
                    StepVolume           = sub.StepVolume,
                    TargetAccount        = sub.TargetAccount
                };
            }

            return(sb);
        }
Example #2
0
        public static Subscription DecorateSubscription(SUBSCRIPTION_V sub)
        {
            var sb = new Subscription
            {
                User = sub.User,
                RenewAuto = sub.RenewAuto ?? true,
                Service = sub.Service,
                TimeEnd = sub.TimeEnd,
                TimeStarted = sub.TimeStarted
            };
            sb.PaidService = new PaidService
                {
                    Id = sub.Service,
                    Comment = sub.Comment,
                    FixedPrice = sub.FixedPrice ?? 0,
                    AccountId = sub.AccountId,
                    Currency = sub.Currency,
                    ServiceType = (PaidServiceType) sub.ServiceType
                };
            if (sub.AutoTrade.HasValue)
            {
                sb.AutoTradeSettings = new AutoTradeSettings
                    {
                        TradeAuto = sub.AutoTrade.Value,
                        VolumeRound = (VolumeRoundType?) sub.VolumeRound,
                        FixedVolume = sub.FixedVolume,
                        HedgingOrdersEnabled = sub.HedgingOrdersEnabled,
                        MaxLeverage = sub.MaxLeverage,
                        MaxVolume = sub.MaxVolume,
                        MinVolume = sub.MinVolume,
                        PercentLeverage = sub.PercentLeverage ?? 100,
                        StepVolume = sub.StepVolume,
                        TargetAccount = sub.TargetAccount
                    };
            }

            return sb;
        }