Пример #1
0
        static void CreateProjs(IProjectProvider prov, ProjectStatusType activeStatus)
        {
            Guid sysId = new Guid("{5914629d-dd2d-4f1f-a06f-1b199fe19b37}");
            Guid pnlId = new Guid("{f9e1d49f-0b91-41cc-a88f-a24afa1a669e}");
            Guid aceId = new Guid("{6ca626ef-aab6-4746-8f18-7d97097055df}");

            CompoundIdentity pnnlId  = new CompoundIdentity(sysId, pnlId);
            CompoundIdentity usaceId = new CompoundIdentity(sysId, aceId);

            string orgName;

            orgName = "Columbia River System Project";
            if (!prov.Exists(orgName))
            {
                Project org = prov.Create(orgName, usaceId);
                if (org != null)
                {
                    orgName = "Columbia River System Monitoring";
                    org     = prov.Create(orgName, usaceId, org);

                    if (org != null)
                    {
                        orgName = "PNNL USACE Columbia River Monitoring Support";
                        prov.Create(orgName, pnnlId, org);
                    }

                    if (!prov.Exists(orgName))
                    {
                        Console.WriteLine("Exists returns false after creating");
                    }
                }
            }

            if (activeStatus != null)
            {
                orgName = "Columbia River System Project";
                IEnumerable <Project> projs = prov.Get(orgName);
                Project org = null;
                foreach (Project cur in projs)
                {
                    org = cur;
                    break;
                }
                org.Affiliates.Add(pnnlId);
                org.Affiliates.Add(usaceId);
                prov.Update(org);

                prov.AddInfo(new ProjectInformation(org.Identity, Guid.NewGuid(), "Test info", null, null));
                prov.AddStatus(new ProjectStatus(org.Identity, Guid.NewGuid(), activeStatus.Identity, "Test status", DateTime.UtcNow));
            }
        }