/// <summary> /// Read Requirements of _pkg into dictionary _dictPackageRequirements. /// - Key: ID according to ReqIF /// - Value: EA ElementID of the requirements /// </summary> protected void ReadEaPackageRequirements() { // Read all existing EA Requirements of package // Note: In DOORS it's impossible that are there more than an ID(stored in multiplicity) using (var db = new EaDataModel(_provider, _connectionString)) { try { //var notUniqueRequirements = (from r in db.q_object DictPackageRequirements = (from r in db.q_object where r.Object_Type == "Requirement" && r.Package_ID == _pkg.PackageID group r by r.Multiplicity into grp select new { Name = grp.Key ?? "", //Multiplicity, Value = grp.Max(x => x.Object_ID) }).ToDictionary(x => x.Name, x => x.Value); } catch (Exception e) { MessageBox.Show($@"Package: '{_pkg.Name}{Environment.NewLine}{Environment.NewLine}'{e}", @"Can't determine EA Requirements of Doors Requirements."); } } }
/// <summary> /// Check requirements of package /// </summary> /// <returns></returns> public bool CheckRequirements() { using (var db = new EaDataModel(_provider, _connectionString)) { try { var falseRequirements = (from o in db.t_object where o.Package_ID == _pkg.PackageID && o.Object_Type == "Requirement" group o by o.Multiplicity into grp where grp.Count() > 1 join o1 in db.t_object on grp.Key equals o1.Multiplicity where o1.Package_ID == _pkg.PackageID && o1.Object_Type == "Requirement" orderby o1.Multiplicity select new { CLASSGUID = o1.ea_guid, CLASSTYPE = o1.Object_Type, Name = o1.Name, Type = o1.Object_Type, DoorsID = o1.Multiplicity, Error = "DoorsID not unique" }).ToDataTable(); // Make EA xml string xml = Xml.MakeXmlFromDataTable(falseRequirements); // Output to EA _rep.RunModelSearch("", "", "", xml); return(falseRequirements.Rows.Count == 0); } catch (Exception e) { MessageBox.Show($@"{e}", @"Error reading EA Repository, break!!"); return(false); } } }