public string QueryobFlowContext(string partnerName, string sourceGuid, string docType, string txnType, string transformId, MetadataRecordTypes recordType)
        {
            string obFlowGuid       = string.Empty;
            string recordTypeString = Enum.GetName(typeof(MetadataRecordTypes), recordType);
            // Get the Source Schema Details
            var queryResults = (from r in DocumentDbClass.metadataDictionary
                                where (r.Value.Value <string>("recordType") == recordTypeString &&
                                       r.Value.Value <string>("schemaId") == sourceGuid &&
                                       r.Value["docKey"].Value <string>("docType") == docType)
                                select r.Value).ToArray();

            if (queryResults.Length > 0)
            {
                obFlowGuid = queryResults[0].Value <string>("id").ToString();
            }
            else
            {
                obFlowGuid = GenerateObFlowContext(partnerName, sourceGuid, docType, txnType, transformId);
            }
            return(obFlowGuid);
        }
        public string QueryTransform(string partnerName, string sourceGuid, string targetGuid, string mapName, MetadataRecordTypes recordType)
        {
            string transformGuid = string.Empty;

            try
            {
                string recordTypeString = Enum.GetName(typeof(MetadataRecordTypes), recordType);
                // Get the Source Schema Details
                var queryResults = (from r in DocumentDbClass.metadataDictionary
                                    where (r.Value.Value <string>("recordType") == recordTypeString &&
                                           r.Value["docKey"].Value <string>("sourceSchemaId") == sourceGuid &&
                                           r.Value["docKey"].Value <string>("targetSchemaId") == targetGuid)
                                    select r.Value).ToArray();
                if (queryResults.Count() > 0)
                {
                    transformGuid = queryResults[0].Value <string>("id").ToString();
                }
                else
                {
                    transformGuid = GenerateTransformJson(partnerName, sourceGuid, targetGuid, mapName);
                }
            }
            catch (Exception)
            {
                // Do Nothing
            }
            return(transformGuid);
        }
        public string QueryibFlowContext(string partnerName, string targetGuid, string schemaXpath, string txnType, string transformId, MetadataRecordTypes recordType)
        {
            string ibFlowGuid = string.Empty;

            try
            {
                string recordTypeString = Enum.GetName(typeof(MetadataRecordTypes), recordType);
                // Get the Source Schema Details
                var queryResults = (from r in DocumentDbClass.metadataDictionary
                                    where (r.Value.Value <string>("recordType") == recordTypeString &&
                                           r.Value["docKey"].Value <string>("schemaId") == targetGuid &&
                                           r.Value["docKey"].Value <string>("schemaXpathValue") == schemaXpath)
                                    select r.Value).ToArray();
                if (queryResults.Length > 0)
                {
                    ibFlowGuid = queryResults[0].Value <string>("id").ToString();
                }
                else
                {
                    ibFlowGuid = GenerateibFlowContext(partnerName, targetGuid, schemaXpath, txnType, transformId);
                }
            }
            catch (Exception)
            {
                // Do Nothing
            }
            return(ibFlowGuid);
        }
        public string QuerySchema(string partnerName, string nameSpace, string rootNode, string fileName, MetadataRecordTypes recordType)
        {
            string schemaGuid = string.Empty;

            try
            {
                string recordTypeString = Enum.GetName(typeof(MetadataRecordTypes), recordType);
                // Get the Source Schema Details
                var queryResults = (from r in DocumentDbClass.metadataDictionary
                                    where (r.Value.Value <string>("recordType") == recordTypeString &&
                                           r.Value["docKey"].Value <string>("namespace") == nameSpace &&
                                           r.Value["docKey"].Value <string>("rootnode").Contains(rootNode))
                                    select r.Value).ToArray();
                if (queryResults.Count() > 0)
                {
                    schemaGuid = queryResults[0].Value <string>("id").ToString();
                }
                else
                {
                    queryResults = (from r in DocumentDbClass.metadataDictionary
                                    where (r.Value.Value <string>("recordType") == recordTypeString &&
                                           r.Value.Value <string>("fileName") == fileName)
                                    select r.Value).ToArray();
                    if (queryResults.Count() > 0)
                    {
                        schemaGuid = queryResults[0].Value <string>("id").ToString();
                    }
                    else
                    {
                        schemaGuid = GenerateSchemaJson(nameSpace, rootNode, fileName, partnerName);
                    }
                }
            }
            catch (Exception)
            {
                // Do Nothing
            }
            return(schemaGuid);
        }