public CrmPluginImage Clone(bool includeOrganization) { CrmPluginImage newImage; if (includeOrganization) { newImage = new CrmPluginImage(m_org); } else { newImage = new CrmPluginImage(null); } newImage.m_assemblyId = m_assemblyId; newImage.m_attributes = m_attributes; newImage.m_createdOn = m_createdOn; newImage.m_customizationLevel = m_customizationLevel; newImage.m_entityAlias = m_entityAlias; newImage.m_imageId = m_imageId; newImage.m_modifiedOn = m_modifiedOn; newImage.m_pluginId = m_pluginId; newImage.m_propertyName = m_propertyName; newImage.m_propertyTitle = m_propertyTitle; newImage.m_relatedAttribute = m_relatedAttribute; newImage.m_stepId = m_stepId; newImage.m_type = m_type; return newImage; }
public void ClearImages(Guid stepId) { CrmPluginImage[] imageList; if (stepId == Guid.Empty) { //Copy the list of images. Can't use the enumerator because we are changing the underlying data imageList = new CrmPluginImage[m_imageList.Count]; m_imageList.Values.CopyTo(imageList, 0); } else if (m_stepList.ContainsKey(stepId)) { //Copy the list of images. Can't use the enumerator because we are changing the underlying data imageList = m_stepList[stepId].Images.ToArray(); } else { throw new ArgumentException("Invalid Entity Id", "stepId"); } //Loop through the image id's foreach (CrmPluginImage image in imageList) { RemoveImage(image.StepId, image.ImageId); } }
private void ValidateEntity(CrmPluginImage image) { if (image == null) { throw new ArgumentNullException(); } else if (m_imageList.ContainsKey(image.ImageId)) { throw new ArgumentException("Image is already in the list"); } else if (image.Organization != this) { throw new ArgumentException("Organization must match"); } else if (image.AssemblyId == Guid.Empty) { throw new ArgumentException("AssemblyId must be set to valid Guid"); } else if (image.PluginId == Guid.Empty) { throw new ArgumentException("PluginId must be set to valid Guid"); } else if (image.StepId == Guid.Empty) { throw new ArgumentException("StepId must be set to valid Guid"); } else if (image.ImageId == Guid.Empty) { throw new ArgumentException("ImageId must be set to valid Guid"); } }
public CrmPluginStep Clone(bool includeOrganization) { CrmPluginStep newStep; if (includeOrganization) { newStep = new CrmPluginStep(m_org); } else { newStep = new CrmPluginStep(null); } newStep.m_assemblyId = m_assemblyId; newStep.UnsecureConfiguration = UnsecureConfiguration; newStep.m_createdOn = m_createdOn; newStep.m_customizationLevel = m_customizationLevel; newStep.Deployment = Deployment; newStep.Name = Name; newStep.Enabled = Enabled; newStep.MessageEntityId = MessageEntityId; newStep.m_filteringAttributes = m_filteringAttributes; newStep.ImpersonatingUserId = ImpersonatingUserId; newStep.InvocationSource = InvocationSource; newStep.MessageId = MessageId; newStep.Mode = Mode; newStep.m_modifiedOn = m_modifiedOn; newStep.m_pluginId = m_pluginId; newStep.Rank = Rank; newStep.SecureConfiguration = SecureConfiguration; newStep.SecureConfigurationId = SecureConfigurationId; newStep.Stage = Stage; newStep.StepId = StepId; newStep.m_serviceBusConfigurationId = m_serviceBusConfigurationId; //Create a new image list Dictionary <Guid, CrmPluginImage> newImageList = new Dictionary <Guid, CrmPluginImage>(); foreach (CrmPluginImage image in m_imageList.Values) { //Clone the image CrmPluginImage clonedImage = image.Clone(includeOrganization); //Add the image to the new list newImageList.Add(clonedImage.ImageId, clonedImage); } //Assign the list to the new object newStep.m_imageList = newImageList; return(newStep); }
public void AddImage(CrmPluginImage image) { if (image == null) { throw new ArgumentNullException("image"); } m_imageList.Add(image.ImageId, image); if (Organization != null) { Organization.AddImage(this, image); } }
public void AddImage(CrmPluginStep step, CrmPluginImage image) { if (image == null) { throw new ArgumentNullException("image"); } else if (step == null) { throw new ArgumentNullException("step"); } else if (!step.Images.ContainsKey(image.ImageId)) { step.AddImage(image); return; } else { ValidateEntity(image); } m_imageList.Add(image.ImageId, image); }