public void setTableItem(String pasport, int column, String text) { DBWrapper dbw = new DBWrapper(); Db db = dbw.openConnection(); Clients c = new Clients(); switch (column) { case 0: db.from(c).set(c.Surname).to(text).where(c.Passport).is(pasport).update(); break; case 1: db.from(c).set(c.Name).to(text).where(c.Passport).is(pasport).update(); break; case 2: db.from(c).set(c.Ochestvo).to(text).where(c.Passport).is(pasport).update(); break; case 3: db.from(c).set(c.Mphone).to(text).where(c.Passport).is(pasport).update(); break; case 4: db.from(c).set(c.Passport).to(text).where(c.Passport).is(pasport).update(); break; case 5: db.from(c).set(c.Prava).to(text).where(c.Passport).is(pasport).update(); break; default: } }
public static int addNullWarranty() { DBWrapper dbw = new DBWrapper(); Db db = dbw.openConnection(); Warranty w = new Warranty(); w.Note = "неопределено"; w.Warr = "нет"; db.insert(w); w = db.from(w).orderByDesc(w.Kodwarr).selectFirst(); return w.Kodwarr; }
public static int addWarranty(String warr) { DBWrapper dbw = new DBWrapper(); Db db = dbw.openConnection(); Warranty w = new Warranty(); if (warr.isEmpty()) { w.Warr = "нет"; } else w.Warr = warr; db.insert(w); w = db.from(w).orderByDesc(w.Kodwarr).selectFirst(); return w.Kodwarr; }
public static Map<Integer, String> getClientCarsList(int clientId) { DBWrapper dbw = new DBWrapper(); Db db = dbw.openConnection(); Car c = new Car(); Map<Integer, String> mp = new HashMap<Integer, String>(); List<Car> ls = db.from(c).where(c.Kodclient).is(clientId).select(); Iterator<Car> it = ls.iterator(); while (it.hasNext()) { Car temp = (Car) it.next(); mp.put(temp.Kodavto, temp.Mark); } return mp; }
public static void addClient( String phone, String name, String middleName, String passport, String prava, String Surname) { DBWrapper dbw = new DBWrapper(); Db db = dbw.openConnection(); Clients c = new Clients(); c.Mphone = phone; c.Name = name; c.Ochestvo = middleName; c.Passport = passport; c.Prava = prava; c.Surname = Surname; db.insert(c); }
public static Map<Integer, String> getClientsList() { DBWrapper dbw = new DBWrapper(); Db db = dbw.openConnection(); Clients c = new Clients(); Map<Integer, String> mp = new HashMap<Integer, String>(); List<Clients> ls = db.from(c).select(); Iterator<Clients> it = ls.iterator(); while (it.hasNext()) { Clients temp = (Clients) it.next(); mp.put(temp.Kodclient, temp.Surname + " " + temp.Name + " " + temp.Ochestvo); } return mp; }
public void fillingTable(Table table) { DBWrapper dbw = new DBWrapper(); Db db = dbw.openConnection(); Clients c = new Clients(); List<Clients> idd = db.from(c).select(); Iterator<Clients> it1 = idd.iterator(); while (it1.hasNext()) { Clients temp = (Clients) it1.next(); TableItem item = new TableItem(table, SWT.NONE); item.setText(0, temp.Surname); item.setText(1, temp.Name); item.setText(2, temp.Ochestvo); item.setText(3, temp.Mphone); item.setText(4, temp.Passport); item.setText(5, temp.Prava); } }
public static void delWarranty(int id) { DBWrapper dbw = new DBWrapper(); Db db = dbw.openConnection(); Warranty w = new Warranty(); db.from(w).where(w.Kodwarr).is(id).delete(); }
public void deleteTableItem(String pasport) { DBWrapper dbw = new DBWrapper(); Db db = dbw.openConnection(); Clients cc = new Clients(); db.from(cc).where(cc.Passport).is(pasport).delete(); }