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


C# IDateTime.GetCurrentDateTime方法代码示例

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


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

示例1: SmileStatementHeader

        /// <summary>
        /// Populate the statement header values (by dumbly walking the TD elements).
        /// This is brittle: if eg Smile change sort code to even Sort Code, then this will break.
        /// And yet we don't want to make it case-insensitive, as that is guessing about the nature
        /// of the change - if ANYTHING changes re metadata, it should rightly break.
        /// The blocks of if/if below are because the label element is immediately followed by the 
        /// data element
        /// </summary>
        /// <param name="xml">the (now) well-formed XML document to be parsed for these header values</param>
        /// <param name="dateTime">Holds server/system date values for header purposes</param>
        public SmileStatementHeader(XDocument xml, IDateTime dateTime)
        {
            if (dateTime != null) {
             			_serverDate = dateTime.GetCurrentDateTime().ToString("yyyyMMddHHmmss");
             		}

             	// painful way to get element after sortcode, etc...
            var sortcodeCandidates = xml.Descendants("td");
            var getSortCode = false;
            var getAccountCode = false;
            var getStatementDate = false;

            foreach (var td in sortcodeCandidates) {

                if (getSortCode) {
                    _sortCode = td.Value.Trim();
                    getSortCode = false;
                }
                if (td.Value.Equals("sort code")) {
                    getSortCode = true;
                }

                if (getAccountCode) {
                    _accountCode = td.Value.Trim();
                    getAccountCode = false;
                }
                if (td.Value.Equals("account number")) {
                    getAccountCode = true;
                }

                if (getStatementDate) {
                    _statementDate = td.Value.Trim();
                    getStatementDate = false;
                }
                if (td.Value.Equals("statement date")) {
                    getStatementDate = true;
                }

                if (!td.Value.Contains("of your current account")) continue;
                var y = td.Value.IndexOf("page",StringComparison.InvariantCulture);
                var blockContainingPageNumber = td.Value.Substring(y, 30);
                AccountPageNumber = StringUtils.RemoveNonIntegerChars(blockContainingPageNumber);

            }
        }
开发者ID:aadennis,项目名称:BankStatementManager,代码行数:55,代码来源:StatementHeader.cs


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