コード例 #1
0
 @Override
 public Long receive(Long id, int amount, double price) {
   Notebook notebook = menu.getNotebookDao().read(id);
   Store store = new Store(notebook, amount, price);
   Long id2 = storeDao.create(store);
   return id2;
 }
コード例 #2
0
  @Override
  public boolean removeFromStore(Store store, int amount) {

    Integer newQuant = store.getQuantity() - amount;
    store.setQuantity(newQuant);
    return menu.getStoreDao().update(store);
  }
コード例 #3
0
  @Override
  public Long sale(Long storeId, int amount) {
    Store store = menu.getStoreDao().read(storeId);
    Integer curAmount = store.getQuantity();
    Integer newAmount = curAmount - amount;
    store.setQuantity(newAmount);

    Sales nwSale = new Sales(store, new java.util.Date(), amount);
    Long id = salesDao.create(nwSale);

    return id;
  }
コード例 #4
0
 @Override
 public List getNotebooksFromStore() {
   return menu.getStoreDao().getNotebooksFromStore();
 }
コード例 #5
0
 @Override
 public List getNotebooksByCpuVendor(Vendor cpuVendor) {
   return menu.getStoreDao().getNotebooksByCpuVendor(cpuVendor);
 }
コード例 #6
0
 @Override
 public List getNotebooksGtAmount(int amount) {
   return menu.getStoreDao().getNotebooksGtAmount(amount);
 }
コード例 #7
0
 @Override
 public List getNotebooksByPortion(int size) {
   return menu.getStoreDao().getNotebooksByPortion(size);
 }
コード例 #8
0
 @Override
 public boolean updateNotebook(Notebook notebook) {
   return menu.getNotebookDao().update(notebook);
 }
コード例 #9
0
 @Override
 public boolean updateVendor(Vendor vendor) {
   return menu.getVendorDao().update(vendor);
 }
コード例 #10
0
 @Override
 public boolean updateMemory(Memory memory) {
   return menu.getMemoryDao().update(memory);
 }
コード例 #11
0
 @Override
 public boolean updateCPU(CPU cpu) {
   return menu.getCpuDao().update(cpu);
 }
コード例 #12
0
 public NotebookServiceImpl() {
   salesDao = menu.getSalesDao();
   storeDao = menu.getStoreDao();
 }
コード例 #13
0
/** Created by ПК on 25.06.2015. */
public class NotebookServiceImpl implements NotebookService {
  Menu menu = Menu.getMenuInstance();
  private SalesDaoImpl salesDao;

  private StoreDaoImpl storeDao;

  public NotebookServiceImpl() {
    salesDao = menu.getSalesDao();
    storeDao = menu.getStoreDao();
  }

  public Date dateSet(int year, int month, int day) {
    Calendar cal = Calendar.getInstance();
    cal.set(year, month, day);
    Date date = cal.getTime();
    return date;
  }

  @Override
  public Long receive(Long id, int amount, double price) {
    Notebook notebook = menu.getNotebookDao().read(id);
    Store store = new Store(notebook, amount, price);
    Long id2 = storeDao.create(store);
    return id2;
  }

  @Override
  public Long sale(Long storeId, int amount) {
    Store store = menu.getStoreDao().read(storeId);
    Integer curAmount = store.getQuantity();
    Integer newAmount = curAmount - amount;
    store.setQuantity(newAmount);

    Sales nwSale = new Sales(store, new java.util.Date(), amount);
    Long id = salesDao.create(nwSale);

    return id;
  }

  @Override
  public boolean updateCPU(CPU cpu) {
    return menu.getCpuDao().update(cpu);
  }

  @Override
  public boolean updateMemory(Memory memory) {
    return menu.getMemoryDao().update(memory);
  }

  @Override
  public boolean updateVendor(Vendor vendor) {
    return menu.getVendorDao().update(vendor);
  }

  @Override
  public boolean updateNotebook(Notebook notebook) {
    return menu.getNotebookDao().update(notebook);
  }

  @Override
  public boolean removeFromStore(Store store, int amount) {

    Integer newQuant = store.getQuantity() - amount;
    store.setQuantity(newQuant);
    return menu.getStoreDao().update(store);
  }

  @Override
  public List getNotebooksByPortion(int size) {
    return menu.getStoreDao().getNotebooksByPortion(size);
  }

  @Override
  public List getNotebooksGtAmount(int amount) {
    return menu.getStoreDao().getNotebooksGtAmount(amount);
  }

  @Override
  public List getNotebooksByCpuVendor(Vendor cpuVendor) {
    return menu.getStoreDao().getNotebooksByCpuVendor(cpuVendor);
  }

  @Override
  public List getNotebooksFromStore() {
    return menu.getStoreDao().getNotebooksFromStore();
  }

  @Override
  public Map getNotebooksStorePresent() {
    return menu.getStoreDao().getNotebooksStorePresent();
  }

  @Override
  public Map getSalesByDays() {
    return menu.getSalesDao().getSalesByDays();
  }
}
コード例 #14
0
 @Override
 public Map getSalesByDays() {
   return menu.getSalesDao().getSalesByDays();
 }
コード例 #15
0
 @Override
 public Map getNotebooksStorePresent() {
   return menu.getStoreDao().getNotebooksStorePresent();
 }