f1lam3ntx0

CList-CLS

Mar 20th, 2020
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. public class clist {
  2. private integer count=0;
  3. private integer listsize=10;
  4. public integer totalsize;
  5. public String cId {get; set;}
  6. public String firstName{get;set;}
  7. public String lastName{get;set;}
  8. public String phone{get;set;}
  9. public String Email{get;set;}
  10. list <contact> conList;
  11.  
  12. public List<Contact> getContact()
  13. {
  14. list<Contact> conlist=[select id, FirstName,LastName,Email,Phone,AccountId from Contact limit :listsize offset : count ];
  15. totalsize = [select count() from Contact];
  16. return conlist;
  17. }
  18.  
  19.  
  20. public PageReference Previous() {
  21. count -= listsize;
  22.  
  23. return null;
  24. }
  25.  
  26.  
  27. public PageReference Next() {
  28. count += listsize;
  29. getct();
  30.  
  31. return null;
  32. }
  33.  
  34.  
  35. public PageReference Last() {
  36. count = totalsize - math.mod(totalsize, listsize);
  37. return null;
  38. }
  39.  
  40.  
  41. public Boolean getDisablePrevious() {
  42.  
  43. if (count>0)
  44. return false;
  45. else
  46. return true;
  47. }
  48.  
  49.  
  50. public Boolean getDisableNext() {
  51. if (count + listsize < totalsize)
  52. return false;
  53. else
  54. return true;
  55. }
  56.  
  57.  
  58. public Integer getTotal_size() {
  59. return totalsize;
  60. }
  61. public Integer getPagect() {
  62. return count/listsize + 1;
  63. }
  64. public Integer getTotalPages() {
  65. if (math.mod(totalsize, listsize) > 0)
  66. {
  67. return totalsize/listsize + 1;
  68. }
  69. else
  70. {
  71. return (totalsize/listsize);
  72. }
  73. }
  74.  
  75.  
  76. public PageReference DeleteContact() {
  77. Contact del = new Contact();
  78. del=[select Id from Contact where id =:cId];
  79. delete del;
  80. PageReference ref=new PageReference('/apex/AccountinlineEdit');
  81. ref.setredirect(true);
  82. return ref;
  83. }
  84. public void save1() {
  85. upsert conlist;
  86.  
  87.  
  88.  
  89. }
  90. public clist(){
  91. conlist=new List<contact>();
  92.  
  93. }
  94.  
  95.  
  96. public pageReference Save(){
  97. Contact con = new Contact(firstname=firstname, lastname=lastname, phone=phone,email=email);
  98. conList.add(con);
  99. insert conList;
  100. return null;
  101. }
  102.  
  103. }
Add Comment
Please, Sign In to add comment