本文整理汇总了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);
}
}