Advertisement
Guest User

Untitled

a guest
Jun 17th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.16 KB | None | 0 0
  1. package fptshop.com.vn.fmedicine.model;
  2.  
  3. import com.google.gson.Gson;
  4. import com.google.gson.reflect.TypeToken;
  5.  
  6. import java.io.Serializable;
  7. import java.util.List;
  8.  
  9. import io.realm.Realm;
  10. import io.realm.RealmObject;
  11. import io.realm.annotations.PrimaryKey;
  12.  
  13. /**
  14. * Created by tan on 8/22/17.
  15. */
  16.  
  17. public class MedicineSL extends RealmObject implements Serializable {
  18. @PrimaryKey
  19. private String idKey;
  20. private String BarCode;
  21. private String ItemName;
  22. private String DVT;
  23. private String ClientIp;
  24. private int SL;
  25. private String date;
  26.  
  27.  
  28. public MedicineSL() {
  29. }
  30.  
  31. public MedicineSL(String idKey,String barCode, String itemName, String DVT,String ClientIp,int Sl,String date) {
  32. this.idKey = idKey;
  33. this.BarCode = barCode;
  34. this.ItemName = itemName;
  35. this.DVT = DVT;
  36. this.ClientIp = ClientIp;
  37. this.SL = Sl;
  38. this.date = date;
  39. }
  40.  
  41. public static void addMedicinesSL(Realm realm,String idKey, String BarCode,String ItemName, String DVT, String ClientIp, int SL, String date) {
  42. MedicineSL medicines = new MedicineSL(idKey,BarCode,ItemName,DVT,ClientIp,SL,date);
  43. realm.beginTransaction();
  44. realm.copyToRealm(medicines);
  45. realm.commitTransaction();
  46. }
  47.  
  48. public static void addMedicinesSL(Realm realm, MedicineSL medicineSL) {
  49. realm.beginTransaction();
  50. realm.copyToRealm(medicineSL);
  51. realm.commitTransaction();
  52. }
  53.  
  54.  
  55. public static List<MedicineSL> getMedicineFromBarcodeSL(Realm realm, String BarCode) {
  56. List<MedicineSL> requestArray = realm.where(MedicineSL.class).equalTo("BarCode", BarCode).findAll();
  57. return requestArray;
  58. }
  59. public static List<MedicineSL> getMedicineFromBarcodeDVTSL(Realm realm, String BarCode,String DVT) {
  60. List<MedicineSL> requestArray = realm.where(MedicineSL.class).equalTo("BarCode", BarCode).equalTo("DVT",DVT).findAll();
  61. return requestArray;
  62. }
  63. public static List<MedicineSL> getAllMedicinesSL(Realm realm) {
  64. List<MedicineSL> requestArray = realm.where(MedicineSL.class).findAll();
  65. return requestArray;
  66. }
  67.  
  68. public String getDate() {
  69. return date;
  70. }
  71.  
  72. public void setDate(String date) {
  73. this.date = date;
  74. }
  75.  
  76. public String getIdKey() {
  77. return idKey;
  78. }
  79.  
  80. public void setIdKey(String idKey) {
  81. this.idKey = idKey;
  82. }
  83.  
  84. public int getSL() {
  85. return SL;
  86. }
  87.  
  88. public void setSL(int SL) {
  89. this.SL = SL;
  90. }
  91.  
  92. public String getClientIp() {
  93. return ClientIp;
  94. }
  95.  
  96. public void setClientIp(String clientIp) {
  97. ClientIp = clientIp;
  98. }
  99.  
  100.  
  101.  
  102. public String getBarCode() {
  103. return BarCode;
  104. }
  105.  
  106. public void setBarCode(String barCode) {
  107. BarCode = barCode;
  108. }
  109.  
  110. public String getItemName() {
  111. return ItemName;
  112. }
  113.  
  114. public void setItemName(String itemName) {
  115. ItemName = itemName;
  116. }
  117.  
  118. public String getDVT() {
  119. return DVT;
  120. }
  121.  
  122. public void setDVT(String DVT) {
  123. this.DVT = DVT;
  124. }
  125.  
  126. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement