コード例 #1
0
ファイル: Cache.cs プロジェクト: hahaking119/vienna-add-in
        public void LoadASCCs(ICctsRepository repository, IDictionary <string, cBIELibrary> biels)
        {
            // TODO: temporarily disabled to forace ASCCs
            //if (!HasASCCs())
            //{
            ASCCs.Clear();

            IAcc acc = repository.GetAccById(Id);

            foreach (IAscc ascc in acc.Asccs)
            {
                IDictionary <string, cABIE> relevantABIEs = new Dictionary <string, cABIE>();

                foreach (cBIELibrary biel in biels.Values)
                {
                    foreach (cABIE abie in biel.ABIEs.Values)
                    {
                        if (abie.BasedOn == ascc.AssociatedAcc.Id)
                        {
                            relevantABIEs.Add(abie.Name, new cABIE(abie.Name, abie.Id, abie.BasedOn));
                        }
                    }
                }

                if (relevantABIEs.Count > 0)
                {
                    if (!(ascc.Name.Equals("")))
                    {
                        if (!ASCCs.ContainsKey(ascc.Name))
                        {
                            //todo: change Checkstate to real state of potential ASBIE
                            ASCCs.Add(ascc.Name, new cASCC(ascc.Name, ascc.Id, CheckState.Unchecked, relevantABIEs));
                        }
                        else
                        {
                            throw new CacheException("The wizard encountered two ASCCs having identical target role names. Please make sure that all ASCCs for a particular ACC have unique target role names before proceeding with the wizard.");
                        }
                    }
                    else
                    {
                        throw new CacheException("The wizard encountered an association whose target role name is not set properly. Please make sure that all ASCC's target names are set properly before proceeding with the wizard.");
                    }
                }
            }
            //}
        }
コード例 #2
0
ファイル: Cache.cs プロジェクト: hahaking119/vienna-add-in
        public void LoadBCCsAndCreateDefaults(ICctsRepository repository, IDictionary <string, cBDTLibrary> bdtls)
        {
            if (!HasBCCs())
            {
                IAcc acc = repository.GetAccById(Id);

                foreach (IBcc bcc in acc.Bccs)
                {
                    if (BCCs.ContainsKey(bcc.Name))
                    {
                        BCCs.Clear();
                        throw new CacheException("The wizard encountered two BCCs within one ACC having identical names. Please verify your model!");
                    }

                    BCCs.Add(bcc.Name, new cBCC(bcc.Name, bcc.Id, bcc.Cdt.Id, CheckState.Unchecked));

                    BCCs[bcc.Name].BBIEs.Add(bcc.Name, new cBBIE(bcc.Name, -1, bcc.Cdt.Id, CheckState.Unchecked));

                    BCCs[bcc.Name].BBIEs[bcc.Name].SearchAndAssignRelevantBDTs(bcc.Cdt.Id, bdtls, CheckState.Unchecked);
                }
            }
        }