public override void CreateCombinations()
        {
            LoadCombinations();
            var lastCombList = CreateLastCombinationList();
            var actions = EventsDependingActionListViewModel.EventsDependingActions;
            foreach (var eventsDependingAction in actions)
            {
                var events = eventsDependingAction.EventListViewModel.Events;
                if(events.Count == 0)
                    events.Add(null);
                foreach (var ev in events)
                {
                    if (!HaveAction(eventsDependingAction.Action, lastCombList) || !HaveEvent(ev, lastCombList))
                    {
                        var combination = new Combination();
                        base.BaseLayer.BaseMethods.AddCombination(combination, eventsDependingAction.Action, ev, BaseLayer.Task, 0);
                        var debit = new CombinParam { Combination = combination, };
                        var credit = new CombinParam { Combination = combination, };
                        BaseLayer.BaseMethods.AddCombinationParams(new List<CombinParam> { debit, credit });

                        CombinationWithParamViews.Add(new CombinationWithParamView
                            {
                                Combination = combination,
                                Procent = debit,
                                NominalPrice = credit
                            });
                    }
                }
            }
            CreateFictiveCombinationsList();
        }
 public void AddCombinationParam(Combination combination, CombinParam param, CombinParamName name, decimal value)
 {
     if (param == null || combination == null) return;
     param.Combination = combination;
     param.Value = value;
     param.CombinParamName = name;
     dssDbContext.CombinParams.Local.Add(param);
 }
        public virtual void CreateCombinations()
        {
            LoadCombinations();
            var lastCombList = CreateLastCombinationList();
            var actions = BaseLayer.DssDbContext.Actions.Local.ToList();
            var events = BaseLayer.DssDbContext.Events.Local.ToList();
            foreach (var action in actions)
                foreach (var eEvent in events)
                    if (!HaveAction(action, lastCombList) || !HaveEvent(eEvent, lastCombList))
                    {
                        var combination = new Combination();
                        BaseLayer.BaseMethods.AddCombination(combination, action, eEvent, BaseLayer.Task, 0);
                        var procent = new CombinParam { Combination = combination, };
                        var nominalprice = new CombinParam { Combination = combination, };
                        BaseLayer.BaseMethods.AddCombinationParams(new List<CombinParam> { procent, nominalprice });

                        CombinationWithParamViews.Add(new CombinationWithParamView
                        {
                            Combination = combination,
                            Procent = procent,
                            NominalPrice = nominalprice
                        });
                    }
        }
        //*******
        protected void LoadCombinations()
        {
            var combins = BaseLayer.DssDbContext.Combinations.Local;
            CombinParam procent, nominalprice;
            CombinationWithParamViews.Clear();

                foreach (var combin in combins)
                {
                    if (combin.CombinParams.Count > 0)
                    {
                        //******+
                        procent = combin.CombinParams.ToList()[0];
                        nominalprice = combin.CombinParams.ToList()[1];
                        //******-
                    }
                    else
                    {
                        procent = new CombinParam{Combination = combin};
                        nominalprice = new CombinParam { Combination = combin };
                        BaseLayer.BaseMethods.AddCombinationParam(combin, procent, null, 0);
                        BaseLayer.BaseMethods.AddCombinationParam(combin, nominalprice, null, 0);
                    }
                    //******+
                    CombinationWithParamViews.Add(new CombinationWithParamView
                        {
                            Combination = combin,
                            Procent = procent,
                            NominalPrice = nominalprice
                        });
                    //******-
                }
        }