Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1.  
  2. public Dictionary<string, object> getByTagihan(int type)
  3. {
  4. try
  5. {
  6. var sql = @"SELECT [DACode]
  7. ,[Sequence]
  8. ,[DueDate]
  9. ,[SettValue]
  10. ,[InterestVal]
  11. ,[TotalBill]
  12. ,[IsPaid]
  13. From (select [DACode]
  14. ,[Sequence]
  15. ,[DueDate]
  16. ,[SettValue]
  17. ,[InterestVal]
  18. ,[TotalBill]
  19. ,[IsPaid] ,row_number() over(partition by DACode order by sequence) rn
  20. from InstSchedule where IsPaid = 0) t
  21. where rn = 1 ";
  22. if (type == 1) { sql += "AND Month(DueDate) <= Month(getDate()) + 1 "; }
  23. else if (type == 2) { sql += "AND Month(DueDate) > Month(getDate()) "; }
  24. var data =
  25. _db.Query<InstSchedule>(sql).ToList();
  26. return _message.SuccessData(true, data, _message.MessageSuccess);
  27. }
  28. catch (Exception ex)
  29. {
  30. return _message.Failed(true, ex.Message);
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement