Пример #1
0
        private void buttonGenerateBDT_Click(object sender, EventArgs e)
        {
            GatherUserInput();

            if ((cache.PathIsValid(CacheConstants.PATH_CDTs, new[] { selectedCDTLName, selectedCDTName })) &&
                (cache.PathIsValid(CacheConstants.PATH_BDTLs, new[] { selectedBDTLName })))
            {
                ICdt        cdt  = repository.GetCdtById(cache.CDTLs[selectedCDTLName].CDTs[selectedCDTName].Id);
                IBdtLibrary bdtl = repository.GetBdtLibraryById(cache.BDTLs[selectedBDTLName].Id);

                BdtSpec bdtSpec = BdtSpec.CloneCdt(cdt, textBDTName.Text);

                var sups = new List <BdtSupSpec>(bdtSpec.Sups);
                foreach (cSUP sup in cache.CDTLs[selectedCDTLName].CDTs[selectedCDTName].SUPs.Values)
                {
                    if (sup.State == CheckState.Unchecked)
                    {
                        var name = sup.Name;
                        sups.RemoveAll(s => s.Name == name);
                    }
                }
                bdtSpec.Sups = sups;

                IBdt newBDT = bdtl.CreateBdt(bdtSpec);

                cache.BDTLs[selectedBDTLName].BDTs.Add(newBDT.Name, new cBDT(newBDT.Name, newBDT.Id, newBDT.BasedOn.Id, CheckState.Unchecked));

                textBDTName.Text = "";
                textBDTName.Text = newBDT.Name;
            }
        }
Пример #2
0
        public void LoadCONAndSUPs(ICctsRepository repository)
        {
            if ((CON.Name.Equals("") && SUPs.Count < 1))
            {
                int  cdtId = Id;
                ICdt cdt   = repository.GetCdtById(cdtId);

                CON.Name  = cdt.Con.Name;
                CON.Id    = cdt.Con.Id;
                CON.State = CheckState.Checked;

                foreach (var sup in cdt.Sups)
                {
                    SUPs.Add(sup.Name, new cSUP(sup.Name, sup.Id, CheckState.Unchecked));
                }
            }
        }