partial void DeletePrincipalInvestigator(PrincipalInvestigator instance);
protected virtual void UpdateGrantInvestigators(Grant grant, XElement node) { IList<XElement> pis = node.Elements("PI").ToList(); if (pis.Count > 0) { foreach (XElement pi in pis) { if(String.IsNullOrWhiteSpace(pi.Element("PI_ID").Value)) { continue; } int principalInvestigatorId = Convert.ToInt32(pi.Element("PI_ID").Value.Replace("(contact)", "").Trim()); PrincipalInvestigator investigator = GetPrincipalInvestigator(principalInvestigatorId); if(investigator == null) { investigator = new PrincipalInvestigator { PrincipalInvestigatorId = Guid.NewGuid(), Name = pi.Element("PI_NAME").Value.SafeTrim(), PrincipalInvestigator_Id = principalInvestigatorId }; grant.GrantPrincipals.Add(new GrantPrincipal() { PrincipalInvestigator = investigator, GrantPrincipalId = Guid.NewGuid() }); } else { grant.GrantPrincipals.Add(new GrantPrincipal() { PrincipalInvestigatorId = investigator.PrincipalInvestigatorId, GrantPrincipalId = Guid.NewGuid() }); } } } }
partial void UpdatePrincipalInvestigator(PrincipalInvestigator instance);
partial void InsertPrincipalInvestigator(PrincipalInvestigator instance);
partial void DeletePrincipalInvestigator(PrincipalInvestigator instance);
partial void UpdatePrincipalInvestigator(PrincipalInvestigator instance);
partial void InsertPrincipalInvestigator(PrincipalInvestigator instance);