Advertisement
altervisi0n

Untitled

Jun 25th, 2025
9
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. private async Task LoadParameters()
  2. {
  3. try
  4. {
  5. string sql = "SELECT * FROM process_activity_param_view1($1, $2)";
  6. var parameters = new List<object> { DbConnect.CodeUser, Id };
  7.  
  8. using (DataTable dataTable = await DbConnect.GetDataTableParamAsync(sql, parameters))
  9. {
  10. if (dataTable == null) return;
  11.  
  12. ObservableCollection<ParameterItem> temp = new ObservableCollection<ParameterItem>(
  13. dataTable.AsEnumerable().Select(r => new ParameterItem()
  14. {
  15. Code = r["code"] as int?,
  16. Name = r["name"].ToString(),
  17. Value = r["value"].ToString(),
  18. Date = r["date"] as DateTime?,
  19. User = r["user"].ToString()
  20. }));
  21.  
  22. foreach (ParameterItem i in temp)
  23. {
  24. if (!string.IsNullOrEmpty(i.User) && i.Date != null)
  25. {
  26. i.UserDateHint = i.User + " " + ((DateTime)i.Date).ToString("dd.MM.yyyy HH:mm");
  27. }
  28. if (string.IsNullOrEmpty(i.Hint))
  29. {
  30. i.Hint = null;
  31. }
  32. }
  33.  
  34. ItemsCombobox = temp;
  35. }
  36. }
  37. catch (Exception ex)
  38. {
  39. MessageBox.Show(ex.Message);
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement