Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package fptshop.com.vn.fmedicine.model;
- import com.google.gson.Gson;
- import com.google.gson.reflect.TypeToken;
- import java.io.Serializable;
- import java.util.List;
- import io.realm.Realm;
- import io.realm.RealmObject;
- import io.realm.annotations.PrimaryKey;
- /**
- * Created by tan on 8/22/17.
- */
- public class MedicineSL extends RealmObject implements Serializable {
- @PrimaryKey
- private String idKey;
- private String BarCode;
- private String ItemName;
- private String DVT;
- private String ClientIp;
- private int SL;
- private String date;
- public MedicineSL() {
- }
- public MedicineSL(String idKey,String barCode, String itemName, String DVT,String ClientIp,int Sl,String date) {
- this.idKey = idKey;
- this.BarCode = barCode;
- this.ItemName = itemName;
- this.DVT = DVT;
- this.ClientIp = ClientIp;
- this.SL = Sl;
- this.date = date;
- }
- public static void addMedicinesSL(Realm realm,String idKey, String BarCode,String ItemName, String DVT, String ClientIp, int SL, String date) {
- MedicineSL medicines = new MedicineSL(idKey,BarCode,ItemName,DVT,ClientIp,SL,date);
- realm.beginTransaction();
- realm.copyToRealm(medicines);
- realm.commitTransaction();
- }
- public static void addMedicinesSL(Realm realm, MedicineSL medicineSL) {
- realm.beginTransaction();
- realm.copyToRealm(medicineSL);
- realm.commitTransaction();
- }
- public static List<MedicineSL> getMedicineFromBarcodeSL(Realm realm, String BarCode) {
- List<MedicineSL> requestArray = realm.where(MedicineSL.class).equalTo("BarCode", BarCode).findAll();
- return requestArray;
- }
- public static List<MedicineSL> getMedicineFromBarcodeDVTSL(Realm realm, String BarCode,String DVT) {
- List<MedicineSL> requestArray = realm.where(MedicineSL.class).equalTo("BarCode", BarCode).equalTo("DVT",DVT).findAll();
- return requestArray;
- }
- public static List<MedicineSL> getAllMedicinesSL(Realm realm) {
- List<MedicineSL> requestArray = realm.where(MedicineSL.class).findAll();
- return requestArray;
- }
- public String getDate() {
- return date;
- }
- public void setDate(String date) {
- this.date = date;
- }
- public String getIdKey() {
- return idKey;
- }
- public void setIdKey(String idKey) {
- this.idKey = idKey;
- }
- public int getSL() {
- return SL;
- }
- public void setSL(int SL) {
- this.SL = SL;
- }
- public String getClientIp() {
- return ClientIp;
- }
- public void setClientIp(String clientIp) {
- ClientIp = clientIp;
- }
- public String getBarCode() {
- return BarCode;
- }
- public void setBarCode(String barCode) {
- BarCode = barCode;
- }
- public String getItemName() {
- return ItemName;
- }
- public void setItemName(String itemName) {
- ItemName = itemName;
- }
- public String getDVT() {
- return DVT;
- }
- public void setDVT(String DVT) {
- this.DVT = DVT;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement