Exemplo n.º 1
0
 public bool AreSame(Subscription s)
 {
     var areSame = Service == s.Service && User == s.User && TimeEnd == s.TimeEnd && TimeStarted == s.TimeStarted &&
                   RenewAuto == s.RenewAuto;
     if (!areSame) return false;
     if (AutoTradeSettings == null && s.AutoTradeSettings == null) return true;
     if (AutoTradeSettings == null || s.AutoTradeSettings == null) return false;
     return AutoTradeSettings.AreSame(s.AutoTradeSettings);
 }
Exemplo n.º 2
0
 public void ModifySubscription(Subscription cat)
 {
     var existCatIndex = categories.FindIndex(c => c.Service == cat.Service);
     if (existCatIndex < 0) return;
     categories[existCatIndex] = cat;
     WasModified = true;
     if (modelIsLoaded != null)
         modelIsLoaded(categories);
 }
Exemplo n.º 3
0
 public void RemoveSubscription(Subscription cat)
 {
     var existCat = categories.FirstOrDefault(c => c.Service == cat.Service);
     if (existCat == null) return;
     categories.Remove(existCat);
     WasModified = true;
     if (modelIsLoaded != null)
         modelIsLoaded(categories);
 }
Exemplo n.º 4
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;
        }