Example #1
0
 public ProcessBaseVm(AdminLevel a, ProcessDetails s, ICalcIndicators c)
 {
     r = new ProcessRepository();
     this.model = r.GetById(s.Id);
     adminLevel = a;
     calc = c;
 }
Example #2
0
        private void SplittingSaes_Load(object sender, EventArgs e)
        {
            if (!DesignMode)
            {
                Localizer.TranslateControl(this);

                ProcessRepository repo = new ProcessRepository();

                if (options.SplitType == SplittingType.Split)
                {
                    var saes = repo.GetAllForAdminLevel(options.Source.Id).Where(i => i.TypeId == (int)StaticProcessType.SAEs);

                    foreach (var s in saes)
                    {
                        var sae = repo.GetById(s.Id);
                        var index = tblNewUnits.RowStyles.Add(new RowStyle { SizeType = SizeType.AutoSize });
                        var chooser = new SaeMatcher(sae, options.SplitDestinations.Select(d => d.Unit).ToList(), options.Source);
                        chooser.Margin = new Padding(0, 5, 10, 5);
                        tblNewUnits.Controls.Add(chooser, 0, index);
                        matchers.Add(chooser);
                    }
                }
                else if (options.SplitType == SplittingType.SplitCombine)
                {
                    foreach (var source in options.MergeSources)
                    {
                        var saes = repo.GetAllForAdminLevel(source.Id).Where(i => i.TypeId == (int)StaticProcessType.SAEs);

                        foreach (var s in saes)
                        {
                            var sae = repo.GetById(s.Id);
                            var index = tblNewUnits.RowStyles.Add(new RowStyle { SizeType = SizeType.AutoSize });
                            List<AdminLevel> dests = new List<AdminLevel> { source, options.MergeDestination };
                            var chooser = new SaeMatcher(sae, dests, options.Source);
                            chooser.Margin = new Padding(0, 5, 10, 5);
                            tblNewUnits.Controls.Add(chooser, 0, index);
                            matchers.Add(chooser);
                        }
                    }
                }

                if (matchers.Count() == 0)
                    DoNextStep();
            }
        }