public void WriteOptionSetToFile(IOrganizationService service, string solutionName)
        {
            DumpOptionSetInfo app = new DumpOptionSetInfo();

            app.Run(service, solutionName);
        }
Example #2
0
        /// <summary>
        /// Procedure: Main
        /// Handles: Entry point for application
        /// Created By: Will Wilson
        /// Created Date: 01/01/2016
        /// Changes By: Steve Weinberger
        /// Changes Date: 06/07/2016
        /// Changes Made: Added to TFS and added EWM global option sets
        /// </summary>
        static void Main()
        {
            try
            {
                //online version
                string serverName = "https://workflow.crm.dynamics.com/";

                //on prem version
                //string serverName = "https://pidemo.crm.dynamics.com";

                Uri organizationUri           = new Uri(string.Format("{0}/XRMServices/2011/Organization.svc", serverName));
                Uri homeRealmUri              = null;
                ClientCredentials credentials = new ClientCredentials();

                //  use UserName object for CRM Online
                credentials.UserName.UserName = "******";
                credentials.UserName.Password = "******";

                //  use default for OnPrem...
                //credentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials;

                IOrganizationService service = new OrganizationServiceProxy(organizationUri, homeRealmUri, credentials, null);

                string solutionName = string.Empty;
                Console.WriteLine("Please enter a Solution Name argument.");
                solutionName = Console.ReadLine();

                if (string.IsNullOrEmpty(solutionName))
                {
                    Console.WriteLine("Please enter a Solution Name argument.");
                    solutionName = Console.ReadLine();
                }
                else
                {
                    //for (int i = 0; i < args.Length; i++)
                    //{
                    //    System.Diagnostics.Debug.WriteLine("args[{0}] == {1}", i, args[i]);
                    //    solutionName = args[0];
                    //}
                    //EWMRelated ewm = new EWMRelated();
                    string entityName       = string.Empty;
                    string attributeCreated = string.Empty;
                    switch (solutionName)
                    {
                    case "us29628":
                        MissouriRelated mr = new MissouriRelated();
                        mr.CreateMissouriGlobalOptionSets();
                        break;

                    case "eSanteWorkflowManagerBase":
                        #region base
                        ////Create Global OptionSets
                        //ewm.CreateEWMGlobalOptionSets();

                        ////Dump OptionSets to excel file
                        //DumpOptionSetInfo dosi = new DumpOptionSetInfo();
                        //dosi.WriteOptionSetToFile();

                        // Create storage for new attributes being created
                        //List<AttributeMetadata> addedAttributes = ewm.CreateClaimsAttributeList();

                        //entityName = "cog_detailclaim";
                        //foreach (AttributeMetadata anAttribute in addedAttributes)
                        //{
                        //    // Create the request.
                        //    CreateAttributeRequest createAttributeRequest = new CreateAttributeRequest
                        //    {
                        //        EntityName = entityName,
                        //        Attribute = anAttribute,
                        //        SolutionUniqueName = solutionName
                        //    };
                        //    // Execute the request.
                        //    service.Execute(createAttributeRequest);
                        //    Console.WriteLine("Created the attribute {0}.", anAttribute.SchemaName);
                        //}
                        #endregion
                        break;

                    case "Claims":
                        #region Detail Claim
                        ////Create Global OptionSets
                        //ewm.CreateEWMGlobalOptionSets();

                        ////Dump OptionSets to excel file
                        //DumpOptionSetInfo dosi = new DumpOptionSetInfo();
                        //dosi.WriteOptionSetToFile();

                        // Create storage for new attributes being created
                        //List<AttributeMetadata> addedClaimsAttributes = ewm.CreateClaimsAttributeList();
                        //entityName = "cog_detailclaim";
                        //attributeCreated = CreateAttribute("cog_detailclaim", addedClaimsAttributes, solutionName, service);
                        //Console.WriteLine(attributeCreated);

                        //List<AttributeMetadata> addedClaimEobAttributes = ewm.CreateClaimEobAttributeList();
                        //entityName = "cog_claimeob";
                        //attributeCreated = CreateAttribute("cog_claimeob", addedClaimEobAttributes, solutionName, service);
                        //Console.WriteLine(attributeCreated);

                        //List<AttributeMetadata> addedClaimRuleAttributes = ewm.CreateClaimRuleAttributeList();
                        //entityName = "cog_claimrule";
                        //attributeCreated = CreateAttribute("cog_claimrule", addedClaimRuleAttributes, solutionName, service);
                        //Console.WriteLine(attributeCreated);

                        //List<AttributeMetadata> addedClaimStatusCodeAttributes = ewm.CreateClaimStatusCodeAttributeList();
                        //entityName = "cog_claimstatuscode";
                        //attributeCreated = CreateAttribute("cog_claimstatuscode", addedClaimStatusCodeAttributes, solutionName, service);
                        //Console.WriteLine(attributeCreated);

                        //List<AttributeMetadata> addedClaimTypeCodeAttributes = ewm.CreateClaimTypeCodeAttributeList();
                        //attributeCreated = CreateAttribute("cog_claimtypecode", addedClaimTypeCodeAttributes, solutionName, service);
                        //Console.WriteLine(attributeCreated);

                        //List<AttributeMetadata> addedDiagnosisAttributes = ewm.CreateDiagnosisAttributeList();
                        //entityName = "cog_diagnosis";
                        //attributeCreated = CreateAttribute("cog_diagnosis", addedDiagnosisAttributes, solutionName, service);
                        //Console.WriteLine(attributeCreated);

                        //List<AttributeMetadata> addedDiagnosisTypeCodeAttributes = ewm.CreateDiagnosisTypeCodeAttributeList();
                        //entityName = "cog_diagnosistypecode";
                        //attributeCreated = CreateAttribute("cog_diagnosistypecode", addedDiagnosisTypeCodeAttributes, solutionName, service);
                        //Console.WriteLine(attributeCreated);

                        //List<AttributeMetadata> addedDrugAttributes = ewm.CreateDrugAttributeList();
                        //entityName = "cog_drug";
                        //attributeCreated = CreateAttribute("cog_drug", addedDrugAttributes, solutionName, service);
                        //Console.WriteLine(attributeCreated);

                        //List<AttributeMetadata> addedProcedureAttributes = ewm.CreateProcedureAttributeList();
                        //entityName = "cog_procedure";
                        //attributeCreated = CreateAttribute("cog_procedure", addedProcedureAttributes, solutionName, service);
                        //Console.WriteLine(attributeCreated);

                        //List<AttributeMetadata> addedSurgicalProcedureAttributes = ewm.CreateSurgicalProcedureAttributeList();
                        //entityName = "cog_surgicalprocedure";
                        //attributeCreated = CreateAttribute("cog_surgicalprocedure", addedSurgicalProcedureAttributes, solutionName, service);
                        //Console.WriteLine(attributeCreated);

                        //List<AttributeMetadata> addedUBOccurrenceAttributes = ewm.CreateUBOccurrenceAttributeList();
                        //attributeCreated = CreateAttribute("cog_uboccurrence", addedUBOccurrenceAttributes, solutionName, service);
                        //Console.WriteLine(attributeCreated);
                        #endregion

                        #region Header Claims
                        // Create storage for new attributes being created
                        //List<AttributeMetadata> addedHeaderClaimsAttributes = ewm.CreateHeaderClaimAttributeList();
                        //entityName = "cog_headerclaim";
                        //attributeCreated = CreateAttribute("cog_headerclaim", addedHeaderClaimsAttributes, solutionName, service);
                        //Console.WriteLine(attributeCreated);
                        #endregion
                        break;

                    case "Findings":
                        #region Create Entities

                        //// Create storage for new attributes being created
                        //List<AttributeMetadata> addedFindingErrorAttributes = ewm.CreateFindingErrorAttributeList();
                        //entityName = "cog_findingerrorcode";
                        //attributeCreated = CreateAttribute("cog_findingerrorcode", addedFindingErrorAttributes, solutionName, service);
                        //Console.WriteLine(attributeCreated);

                        //// Create storage for new attributes being created
                        //List<AttributeMetadata> addedFindingReferenceAttributes = ewm.CreateFindingReferenceAttributeList();
                        //entityName = "cog_findingreferencecode";
                        //attributeCreated = CreateAttribute("cog_findingreferencecode", addedFindingReferenceAttributes, solutionName, service);
                        //Console.WriteLine(attributeCreated);
                        #endregion

                        #region Create Findings Global Option Sets
                        //ewm = new EWMRelated();

                        //ewm.CreateFindingsGlobalOptionSets();
                        #endregion
                        break;

                    case "Workflow_10312017":
                        //FindMissingFields fm = new FindMissingFields();
                        //fm.CodeNow(service, solutionName);
                        //Dump OptionSets to excel file
                        DumpOptionSetInfo dosi = new DumpOptionSetInfo();
                        dosi.WriteOptionSetToFile(service, solutionName);
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            Console.WriteLine("process completed....");
            Console.ReadLine();
        }