/// <summary> /// To create Master Solution and CRM Solutions. /// </summary> /// <param name="service">Organization service</param> /// <param name="solution"> CRM Solutions</param> /// <param name="tracingService">Tracing Service to trace error</param> public static void CreateSolutionRecords(IOrganizationService service, Solution solution, ITracingService tracingService) { bool isAlreadyExist = IsSolutionAvaialable(service, solution.Id, tracingService); if (isAlreadyExist == false) { ExecuteOperations.CreateMasterSolution(service, solution); } }
/// <summary> /// To delete Merge Solution records. /// </summary> /// <param name="service">Organization service</param> /// <param name="sourceControlQueue">Dynamic Source Control entity GUID</param> /// <param name="tracingService">Tracing Service to trace error</param> public static void CreateSolutionDetail(IOrganizationService service, syed_sourcecontrolqueue sourceControlQueue, ITracingService tracingService) { //Copy feilds from Template Record. EntityCollection copyDynamicsTemplate = SolutionHelper.RetrieveDynamicsSourceControlTemplate(service, tracingService); foreach (syed_sourcecontrolqueue syed_Sourcecontrolqueue in copyDynamicsTemplate.Entities) { syed_sourcecontrolqueue _sourcecontrolqueue = new syed_sourcecontrolqueue(); _sourcecontrolqueue.syed_Branch = syed_Sourcecontrolqueue.syed_Branch; _sourcecontrolqueue.syed_RemoteName = syed_Sourcecontrolqueue.syed_RemoteName; _sourcecontrolqueue.syed_RepositoryUrl = syed_Sourcecontrolqueue.syed_RepositoryUrl; _sourcecontrolqueue.syed_SourceControl = syed_Sourcecontrolqueue.syed_SourceControl; _sourcecontrolqueue.Id = sourceControlQueue.Id; _sourcecontrolqueue.syed_IsShedulled = syed_Sourcecontrolqueue.syed_IsShedulled; _sourcecontrolqueue.syed_overwritesolutionstxt = syed_Sourcecontrolqueue.syed_overwritesolutionstxt; service.Update(_sourcecontrolqueue); break; } //Copy Master Solution Record from Template. EntityCollection copyTemplate = SolutionHelper.RetrieveMasterSolutionTemplate(service, tracingService); foreach (syed_solutiondetail solutionDetail in copyTemplate.Entities) { ExecuteOperations.CreateSolutionDetail(service, solutionDetail, sourceControlQueue); break; } EntityCollection crmSolution = SolutionHelper.RetrieveMasterSolutionById(service, sourceControlQueue.syed_CheckInBySolutionId, tracingService); if (crmSolution.Entities.Count > 0) { foreach (syed_mastersolutions mastersolutions in crmSolution.Entities) { ExecuteOperations.CreateSolutionDetail(service, mastersolutions, sourceControlQueue); break; } } else { EntityCollection solutionCollection = SolutionHelper.RetrieveSolutionById(service, new Guid(sourceControlQueue.syed_CheckInBySolutionId), tracingService); foreach (Solution sol in solutionCollection.Entities) { Guid id = ExecuteOperations.CreateMasterSolution(service, sol); syed_mastersolutions syed_Mastersolutions = service.Retrieve(syed_mastersolutions.EntityLogicalName.ToString(), id, new ColumnSet(true)).ToEntity <syed_mastersolutions>(); ExecuteOperations.CreateSolutionDetail(service, syed_Mastersolutions, sourceControlQueue); break; } } }