public void CreateibContextFiles(string partnerName, AgreementMigrationItemViewModel agreementItem, string sourceSchemaId, string ibFlowId, string transformId, string txnType)
        {
            ibFlowPartnerContext ibctxt = new ibFlowPartnerContext();

            ibctxt.id          = CreateNewGuid();
            ibctxt.recordType  = AppConstants.ibFlowPartnerContext;
            ibctxt.description = agreementItem.Protocol + " " + txnType + " Message from " + partnerName;
            ibctxt.docKey      = new ibFlowPartnerDockey()
            {
                schemaXpathValue = AppConstants.schemaXpathValue,
                schemaId         = sourceSchemaId,
                partnerDetailId  = inboundPartnerDetails
            };
            ibctxt.ibFlowContextId          = ibFlowId;
            ibctxt.transformId              = transformId;
            ibctxt.preTransformProcessing   = new JArray();
            ibctxt.schemaValidationRequired = true;
            string fileName = string.Format(Resources.MetaDataContextPath, partnerName);

            fileName = fileName + partnerName + "_ibFlowPartnerContext_" + txnType + ".json";
            if (!File.Exists(fileName))
            {
                File.Create(fileName).Close();
                System.IO.File.WriteAllText(fileName, JObject.Parse(JsonConvert.SerializeObject(ibctxt).ToString()).ToString());
            }
            else
            {
                File.Delete(fileName);
                File.Create(fileName).Close();
                System.IO.File.WriteAllText(fileName, JObject.Parse(JsonConvert.SerializeObject(ibctxt).ToString()).ToString());
            }
        }
        public void CreateobX12ContextFiles(string partnerName, AgreementMigrationItemViewModel agreementItem, Server.X12ProtocolSettings protocolSettingsBA, string targetSchemaId, string obFlowId, string transformId, string documentKey, string txnType)
        {
            obFlowPartnerContext obCtxt = new obFlowPartnerContext();

            obCtxt.id          = CreateNewGuid();
            obCtxt.recordType  = AppConstants.obFlowPartnerContext;
            obCtxt.description = agreementItem.Protocol + " " + txnType + " Message from " + partnerName;
            obCtxt.schemaId    = targetSchemaId;
            obCtxt.transformId = transformId;
            obCtxt.docKey      = new obFlowPartnerDockey()
            {
                obFlowContextId        = obFlowId,
                partnerDetailsId       = outboundPartnerDetails,
                partnerIdentifierValue = txnType
            };
            obCtxt.documentKey              = documentKey;
            obCtxt.documentType             = AppConstants.DefaultDocumentType;
            obCtxt.preTransformProcessing   = new JArray();
            obCtxt.postTransformProcessing  = new JArray();
            obCtxt.schemaValidationRequired = true;
            obCtxt.ediOverrideDelimiters    = new Edioverridedelimiters()
            {
                dataElementSeparator    = protocolSettingsBA.FramingSettings.DataElementSeparator,
                componentSeparator      = protocolSettingsBA.FramingSettings.ComponentSeparator,
                replacementCharacter    = protocolSettingsBA.FramingSettings.ReplaceChar,
                segmentTerminator       = protocolSettingsBA.FramingSettings.SegmentTerminator,
                segmentTerminatorSuffix = protocolSettingsBA.FramingSettings.SegmentTerminatorSuffix.ToString()
            };
            string fileName = string.Format(Resources.MetaDataContextPath, partnerName);

            fileName = fileName + partnerName + "_obFlowPartnerContext_" + txnType + ".json";
            if (!File.Exists(fileName))
            {
                File.Create(fileName).Close();
                System.IO.File.WriteAllText(fileName, JObject.Parse(JsonConvert.SerializeObject(obCtxt).ToString()).ToString());
            }
            else
            {
                File.Delete(fileName);
                File.Create(fileName).Close();
                System.IO.File.WriteAllText(fileName, JObject.Parse(JsonConvert.SerializeObject(obCtxt).ToString()).ToString());
            }
        }
示例#3
0
 public AgreementMigrationItemViewModel(AgreementMigrationItemViewModel agreementItem) : base(agreementItem)
 {
 }
        public void CreatePartnerFiles(string partnerName, AgreementMigrationItemViewModel agreementItem)
        {
            string directroyPathForJsonFiles = Resources.MetaDataContextPath;
            string fileName = string.Format(directroyPathForJsonFiles, partnerName);

            if (!Directory.Exists(fileName))
            {
                FileOperations.CreateFolder(fileName);
            }
            else
            {
                Directory.Delete(fileName, true);
                FileOperations.CreateFolder(fileName);
            }
            // Inbound Partner Details
            string         newGuid    = CreateNewGuid();
            PartnerContext partnrCtxt = new PartnerContext();

            partnrCtxt.id          = newGuid;
            inboundPartnerDetails  = newGuid;
            partnrCtxt.recordType  = AppConstants.partnerDetails;
            partnrCtxt.description = "EDI AS2 Partner Details For " + partnerName;
            partnrCtxt.docKey      = new Dockey()
            {
                messageFormat      = agreementItem.MigrationEntity.Protocol.ToUpper(),
                senderQualifier    = agreementItem.GuestPartnerQualifer,
                senderIdentifier   = agreementItem.GuestPartnerId,
                receiverQualifier  = agreementItem.HostPartnerQualifier,
                receiverIdentifier = agreementItem.HostPartnerId
            };
            partnrCtxt.as2Config = new As2config()
            {
                as2From = "NA",
                as2To   = "NA"
            };
            partnrCtxt.preserveInterchange = new Preserveinterchange()
            {
                IB = true,
                PT = true
            };
            partnrCtxt.preDecodeProcessing  = new JArray();
            partnrCtxt.postDecodeProcessing = new JArray();
            partnrCtxt.preEncodeProcessing  = new PreEncodeprocessing[0];
            partnrCtxt.postEncodeProcessing = new PostEncodeprocessing[0];
            partnrCtxt.epDetailId           = CreateNewGuid();
            fileName = fileName + partnerName + "_InboundPartnerDetails.json";
            if (!File.Exists(fileName))
            {
                File.Create(fileName).Close();
                System.IO.File.WriteAllText(fileName, JObject.Parse(JsonConvert.SerializeObject(partnrCtxt)).ToString());
            }

            // Outbound Partner Details
            newGuid = CreateNewGuid();
            PartnerContext obpartnrCtxt = new PartnerContext();

            obpartnrCtxt.id          = newGuid;
            outboundPartnerDetails   = newGuid;
            obpartnrCtxt.recordType  = AppConstants.partnerDetails;
            obpartnrCtxt.description = "EDI AS2 Partner Details For " + partnerName;
            obpartnrCtxt.docKey      = new Dockey()
            {
                messageFormat      = agreementItem.MigrationEntity.Protocol.ToUpper(),
                senderQualifier    = agreementItem.HostPartnerQualifier,
                senderIdentifier   = agreementItem.HostPartnerId,
                receiverQualifier  = agreementItem.GuestPartnerQualifer,
                receiverIdentifier = agreementItem.GuestPartnerId
            };
            obpartnrCtxt.as2Config = new As2config()
            {
                as2From = "NA",
                as2To   = "NA"
            };
            obpartnrCtxt.preDecodeProcessing  = new JArray();
            obpartnrCtxt.postDecodeProcessing = new JArray();
            obpartnrCtxt.preEncodeProcessing  = new PreEncodeprocessing[0];
            obpartnrCtxt.postEncodeProcessing = new PostEncodeprocessing[0];
            obpartnrCtxt.epDetailId           = CreateNewGuid();
            fileName = string.Empty;
            fileName = string.Format(directroyPathForJsonFiles, partnerName);
            fileName = fileName + partnerName + "_OutboundPartnerDetails.json";
            if (!File.Exists(fileName))
            {
                File.Create(fileName).Close();
                System.IO.File.WriteAllText(fileName, JObject.Parse(JsonConvert.SerializeObject(obpartnrCtxt)).ToString());
            }
        }