Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [HttpGet("[action]")]
- [Authorize]
- public ListResult ProblemsYTD(int year = "")
- {
- var sql = "SELECT DatePart(yyyy, CLL.Call_Log_Date) as [ProblemsYear], CLL.Service as [Service], Sum((DATEDIFF(dd, CLL.Call_Log_Date, GetDate()))) as [DaysOpen] " +
- "FROM VMWareSM_Test.dbo.RV_CALL as CLL " +
- "Where CLL.IPK_Stream_Ref = '19' And DatePart(yyyy, CLL.Call_Log_Date)";
- int myInt;
- if (!int.TryParse(year, out myInt))
- {
- year = "%" + year + "%";
- sql += " = @year";
- }
- sql += " Group by CLL.Service, DatePart(yyyy, CLL.Call_Log_Date) "+
- "Order by CLL.Service DESC; ";
- SqlParameter[] sqlParams =
- {
- new SqlParameter
- {
- ParameterName = "@year",
- Value = year,
- DbType = DbType.Int32,
- Direction = ParameterDirection.Input
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement