예제 #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();
 }