public void AddMasterPackages(List <PackageConfigRow> packs) { // not completed IEnumerable <string> mp = packs.Select(x => x.MasterPackage).Distinct(); foreach (string mpn in mp) { Package pt = new Package(); IModifierCF pm = new ModifierCF(pt); IEnumerable <int> sqn = packs.Where(x => x.MasterPackage == mpn) .Select(x => x.SeqOrder).Distinct() .OrderBy(x => x); Sequence seq1 = null, seq2 = null; foreach (int sqno in sqn) { seq1 = seq2; seq2 = pm.Add_Sequence(string.Format("SEQ_{0:D3}", sqno)); IEnumerable <string> exp = packs.Where(x => x.MasterPackage == mpn && x.SeqOrder == sqno) .Select(x => x.Name); foreach (string expn in exp) { pm.AddTask_ExecPackage("ExecPkg_" + expn, expn + ".dtsx", seq2); } if (seq1 != null) { pm.Add_PrecConstr(seq1, seq2); } } prj.PackageItems.Add(pt, mpn + ".dtsx"); } }