本文整理汇总了C#中OpenCbsCommand.GetDateTime方法的典型用法代码示例。如果您正苦于以下问题:C# OpenCbsCommand.GetDateTime方法的具体用法?C# OpenCbsCommand.GetDateTime怎么用?C# OpenCbsCommand.GetDateTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenCbsCommand
的用法示例。
在下文中一共展示了OpenCbsCommand.GetDateTime方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LastLoanTransitionEventDate
// public Dictionary<int, decimal> GetListOfTransitionToGoodLoan(DateTime launchDate)
// {
// const string q = @"SELECT a1.id,a1.olb,a1.late_days
// FROM dbo.ActiveLoans(@date, 0) a1
// INNER JOIN dbo.ActiveLoans(DATEADD(dd,-1,@date), 0) a2 ON a2.id = a1.id
// WHERE a1.late_days = 0 and a2.late_days>0";
// using (var connection = GetConnection())
// using (var c = new OpenCbsCommand(q, connection))
// {
// c.AddParam("date", launchDate);
// using (var r = c.ExecuteReader())
// {
// var dict = new Dictionary<int, decimal>();
// while (r.Read())
// dict.Add(r.GetInt("id"), r.GetDecimal("olb"));
// return dict;
// }
// }
// }
public DateTime LastLoanTransitionEventDate()
{
const string q = @"SELECT TOP 1 ce.event_date
FROM dbo.LoanTransitionEvents AS tr
LEFT JOIN dbo.ContractEvents AS ce ON ce.id=tr.id
ORDER BY ce.id DESC";
using (var connection = GetConnection())
using (var r = new OpenCbsCommand(q, connection).ExecuteReader())
{
return !r.Read() ? DateTime.Today.AddDays(-1) : r.GetDateTime("event_date");
}
}