当前位置: 首页>>代码示例>>C#>>正文


C# IHeader.AddReciever方法代码示例

本文整理汇总了C#中IHeader.AddReciever方法的典型用法代码示例。如果您正苦于以下问题:C# IHeader.AddReciever方法的具体用法?C# IHeader.AddReciever怎么用?C# IHeader.AddReciever使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IHeader的用法示例。


在下文中一共展示了IHeader.AddReciever方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PoulateHeaderSendersAndReceivers

        /// <summary>
        /// This method populates the Senders and Receivers of a <see cref="IHeader"/>
        /// </summary>
        /// <param name="mappingStoreDb">
        /// The <see cref="Database"/> instance for Mapping Store database
        /// </param>
        /// <param name="headerSysId">
        /// The header system identifier. In the database the column HEADER.HEADER_ID
        /// </param>
        /// <param name="header">
        /// The <see cref="IHeader"/> to be populated in terms of Senders and Receivers
        /// </param>
        private static void PoulateHeaderSendersAndReceivers(Database mappingStoreDb, long headerSysId, IHeader header)
        {
            string paramId = mappingStoreDb.BuildParameterName(ParameterNameConstants.IdParameter);

            var sqlCommand = new StringBuilder();
            sqlCommand.Append("SELECT PARTY.PARTY_ID, PARTY.ID, PARTY.HEADER_ID, PARTY.TYPE ");
            sqlCommand.Append("FROM PARTY ");
            sqlCommand.AppendFormat("WHERE PARTY.HEADER_ID = {0} ", paramId);

            using (DbCommand command = mappingStoreDb.GetSqlStringCommand(sqlCommand.ToString()))
            {
                mappingStoreDb.AddInParameter(command, ParameterNameConstants.IdParameter, DbType.Int64, headerSysId);

                using (IDataReader dataReader = mappingStoreDb.ExecuteReader(command))
                {
                    while (dataReader.Read())
                    {
                        var id = DataReaderHelper.GetString(dataReader, "ID");
                        long partySysId = DataReaderHelper.GetInt64(dataReader, "PARTY_ID");
                        string partyType = DataReaderHelper.GetString(dataReader, "TYPE");

                        var names = new List<ITextTypeWrapper>();
                        PopulatePartyLocalisedStrings(mappingStoreDb, partySysId, names);

                        var contacts = new List<IContact>();
                        PopulatePartyContacts(mappingStoreDb, partySysId, contacts);

                        var party = new PartyCore(names, id, contacts, null);

                        // is it a sender or a receiver?
                        if (partyType.Equals(SenderText, StringComparison.OrdinalIgnoreCase))
                        {
                            header.Sender = party;
                        }
                        else if (partyType.Equals(ReceiverText, StringComparison.OrdinalIgnoreCase))
                        {
                            header.AddReciever(party);
                        }
                    }
                }
            }
        }
开发者ID:alcardac,项目名称:SDMXRI_WS_OF,代码行数:54,代码来源:HeaderRetrieverEngine.cs


注:本文中的IHeader.AddReciever方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。