Example #1
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            SolutionComponentType type = (SolutionComponentType)value;
            string color = SolutionComponentBase.GetTypeColor(type);
            var    brush = (SolidColorBrush)(new BrushConverter().ConvertFrom(color));

            return(brush);
        }
Example #2
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            SolutionComponentType type = (SolutionComponentType)value;

            if (type == SolutionComponentType.Entity)
            {
                return(Visibility.Visible);
            }
            return(Visibility.Collapsed);
        }
Example #3
0
 /// <summary>
 /// Method to add a component to a solution.
 /// </summary>
 /// <param name="solutionComponentType">The component type.</param>
 /// <param name="componentId">The component's identifier.</param>
 /// <param name="solutionUniqueName">The solution's unique name.</param>
 /// <returns>The result of the execution.</returns>
 public AddSolutionComponentResponse AddComponentToSolution(SolutionComponentType solutionComponentType, Guid componentId, string solutionUniqueName)
 {
     try
     {
         AddSolutionComponentRequest addSolutionComponentRequest = new AddSolutionComponentRequest()
         {
             ComponentType      = (int)solutionComponentType,
             ComponentId        = componentId,
             SolutionUniqueName = solutionUniqueName
         };
         using (XrmService service = new XrmService(XRMConnectionString))
         {
             return((AddSolutionComponentResponse)service.Execute(addSolutionComponentRequest));
         }
     }
     catch (FaultException <Microsoft.Xrm.Sdk.OrganizationServiceFault> )
     {
         throw;
     }
 }
Example #4
0
 /// <summary>
 /// Method to Unregister a Plugin.
 /// </summary>
 /// <param name="xrmPlugin">The Plugin to Unregister.</param>
 /// <returns>Result.</returns>
 internal bool UnregisterPlugin(string xrmServerDetails, XrmPlugin xrmPlugin, Collection <string> errors, SolutionComponentType solutionComponentType)
 {
     try
     {
         Result = RegistrationService.Unregister(xrmServerDetails, PluginType.EntityLogicalName, xrmPlugin.PluginId, errors, solutionComponentType);
         return(Result);
     }
     catch (FaultException <Microsoft.Xrm.Sdk.OrganizationServiceFault> )
     {
         throw;
     }
 }
Example #5
0
 public List <SolutionComponentBase> SearchComponent(SolutionComponentType type, string displayName)
 {
     return(CrmProvider.SearchComponent(_service, type, displayName));
 }
Example #6
0
 public static string GetTypeColor(SolutionComponentType type)
 {
     if (type == SolutionComponentType.Entity)
     {
         return("#BAE1FF");
     }
     else if (type == SolutionComponentType.Field)
     {
         return("#ceeaff");
     }
     else if (type == SolutionComponentType.Relationship)
     {
         return("#e3f3ff");
     }
     else if (type == SolutionComponentType.Form)
     {
         return("#94b4cc");
     }
     else if (type == SolutionComponentType.View)
     {
         return("#9ebbd1");
     }
     else if (type == SolutionComponentType.Ribbon)
     {
         return("#52abf0");
     }
     else if (type == SolutionComponentType.Role)
     {
         return("#ffffba");
     }
     else if (type == SolutionComponentType.ConnectionRole)
     {
         return("#e5e5a7");
     }
     else if (type == SolutionComponentType.Workflow)
     {
         return("#ffb3ba");
     }
     else if (type == SolutionComponentType.PluginAssembly)
     {
         return("#E5A1A7");
     }
     else if (type == SolutionComponentType.PluginStep)
     {
         return("#c78d92");
     }
     else if (type == SolutionComponentType.WebResource)
     {
         return("#baffc9");
     }
     else if (type == SolutionComponentType.App)
     {
         return("#CC94B4");
     }
     else if (type == SolutionComponentType.OptionSet)
     {
         return("#FFDDBA");
     }
     else if (type == SolutionComponentType.Sitemap)
     {
         return("#ffb76e");
     }
     else if (type == SolutionComponentType.ConvertRule)
     {
         return("#E1FFBA");
     }
     else if (type == SolutionComponentType.RoutingRule)
     {
         return("#cae5a7");
     }
     else if (type == SolutionComponentType.Chart)
     {
         return("#f767bb");
     }
     else if (type == SolutionComponentType.EntityKey)
     {
         return("#f748ae");
     }
     else if (type == SolutionComponentType.HierarchyRule)
     {
         return("#f82ba3");
     }
     else if (type == SolutionComponentType.EmailTemplate)
     {
         return("#33a3ee");
     }
     return("#FFFFFF");
 }
Example #7
0
 /// <summary>
 /// Method to Unregister an Image.
 /// </summary>
 /// <param name="xrmPluginImage">The Image to Unregister.</param>
 /// <returns>Result.</returns>
 internal bool UnregisterImage(string xrmServerDetails, XrmPluginImage xrmPluginImage, Collection <string> errors, SolutionComponentType solutionComponentType)
 {
     try
     {
         Result = RegistrationService.Unregister(xrmServerDetails, SdkMessageProcessingStepImage.EntityLogicalName, xrmPluginImage.ImageId.Value, errors, solutionComponentType);
         return(Result);
     }
     catch (FaultException <Microsoft.Xrm.Sdk.OrganizationServiceFault> )
     {
         throw;
     }
 }
Example #8
0
 public CRMSolutionComponent(Guid id, string logicalName, SolutionComponentType type)
 {
     ID          = id;
     Type        = type;
     LogicalName = logicalName; // doesn't exist for all component types
 }
Example #9
0
        public static List <SolutionComponentBase> SearchComponent
            (IOrganizationService service, SolutionComponentType type, string value)
        {
            List <SolutionComponentBase> components = new List <SolutionComponentBase>();
            List <Guid> componentsId = new List <Guid>();

            if (type == SolutionComponentType.App)
            {
                componentsId = GetAppsWithName(service, value);
            }
            else if (type == SolutionComponentType.Chart)
            {
                componentsId = GetChartWithName(service, value);
            }
            else if (type == SolutionComponentType.ConnectionRole)
            {
                componentsId = GetConnectionRoleWithName(service, value);
            }
            else if (type == SolutionComponentType.ConvertRule)
            {
                componentsId = GetConvertRuleWithName(service, value);
            }
            else if (type == SolutionComponentType.EmailTemplate)
            {
                componentsId = GetEmailTemplateWithName(service, value);
            }
            else if (type == SolutionComponentType.Form)
            {
                componentsId = GetFormWithName(service, value);
            }
            else if (type == SolutionComponentType.HierarchyRule)
            {
                componentsId = GetHierarchyRuleWithName(service, value);
            }
            else if (type == SolutionComponentType.PluginAssembly)
            {
                componentsId = GetPlugginAssemblyWithName(service, value);
            }
            else if (type == SolutionComponentType.PluginStep)
            {
                componentsId = GetPlugginStepWithName(service, value);
            }
            else if (type == SolutionComponentType.Ribbon)
            {
                componentsId = GetRibbonWithName(service, value);
            }
            else if (type == SolutionComponentType.Role)
            {
                componentsId = GetRoleWithName(service, value);
            }
            else if (type == SolutionComponentType.RolePrivilege)
            {
                componentsId = GetRolePrivilegeWithName(service, value);
            }
            else if (type == SolutionComponentType.RoutingRule)
            {
                componentsId = GetRoutingRuleWithName(service, value);
            }
            else if (type == SolutionComponentType.Sitemap)
            {
                componentsId = GetSitemapWithName(service, value);
            }
            else if (type == SolutionComponentType.View)
            {
                componentsId = GetViewWithName(service, value);
            }
            else if (type == SolutionComponentType.WebResource)
            {
                componentsId = GetWebResourceWithName(service, value);
            }
            else if (type == SolutionComponentType.Workflow)
            {
                componentsId = GetWorkflowWithName(service, value);
            }
            return(componentsId.Count > 0 ? GetComponentsWithId(service, componentsId) : new List <SolutionComponentBase>());
        }
Example #10
0
 internal bool Unregister(string xrmServerDetails, string entityLogicalName, Guid id, Collection <string> errors, SolutionComponentType solutionComponentType)
 {
     try
     {
         Result = false;
         using (xrmService = GetService(xrmServerDetails))
         {
             try
             {
                 if (solutionComponentType != SolutionComponentType.SDKMessageProcessingStepSecureConfig)
                 {
                     RetrieveDependenciesForDeleteRequest retrieveDependenciesForDeleteRequest = new RetrieveDependenciesForDeleteRequest();
                     retrieveDependenciesForDeleteRequest.ComponentType = (int)solutionComponentType;
                     retrieveDependenciesForDeleteRequest.ObjectId      = id;
                     RetrieveDependenciesForDeleteResponse retrieveDependenciesForDeleteResponse = (RetrieveDependenciesForDeleteResponse)xrmService.Execute(retrieveDependenciesForDeleteRequest);
                     if (retrieveDependenciesForDeleteResponse.EntityCollection.Entities.Count == 0)
                     {
                         xrmService.Retrieve(entityLogicalName, id, new ColumnSet(true));
                         xrmService.Delete(entityLogicalName, id);
                     }
                     else
                     {
                         errors.Add(solutionComponentType.ToString() + " with id = " + id.ToString() + "exists!");
                     }
                 }
                 else
                 {
                     xrmService.Retrieve(entityLogicalName, id, new ColumnSet(true));
                     xrmService.Delete(entityLogicalName, id);
                 }
             }
             catch (FaultException <Microsoft.Xrm.Sdk.OrganizationServiceFault> e)
             {
                 IdString = id.ToString().Trim();
                 IdString = IdString.Replace("{", string.Empty);
                 IdString = IdString.Replace("}", string.Empty);
                 if (e.Message == entityLogicalName + " With Id = " + id.ToString().Trim() + " Does Not Exist")
                 {
                     errors.Add(e.Message);
                 }
                 else
                 {
                     throw;
                 }
             }
         }
         Result = true;
         return(Result);
     }
     catch (FaultException <Microsoft.Xrm.Sdk.OrganizationServiceFault> )
     {
         throw;
     }
 }