コード例 #1
0
  /* (non-Javadoc)
   * @see com.adibrata.smartdealer.service.othertransactions.OtherReceive#Paging(int, java.lang.String, java.lang.String)
   */
  @SuppressWarnings("unchecked")
  @Override
  public List<OtherRcvHdr> Paging(int CurrentPage, String WhereCond, String SortBy)
      throws Exception {
    // TODO Auto-generated method stub
    StringBuilder hql = new StringBuilder();
    List<OtherRcvHdr> list = null;

    try {
      hql.append(strStatement);
      if (WhereCond != "") {
        hql.append(" where ");
        hql.append(WhereCond);
      }
      Query selectQuery = session.createQuery(hql.toString());
      long totalrecord = TotalRecord(WhereCond);
      selectQuery.setFirstResult((int) ((totalrecord - 1) * pagesize));
      selectQuery.setMaxResults(pagesize);
      list = selectQuery.list();

    } catch (Exception exp) {

      ExceptionEntities lEntExp = new ExceptionEntities();
      lEntExp.setJavaClass(Thread.currentThread().getStackTrace()[1].getClassName());
      lEntExp.setMethodName(Thread.currentThread().getStackTrace()[1].getMethodName());
      ExceptionHelper.WriteException(lEntExp, exp);
    }
    return list;
  }
コード例 #2
0
  @Override
  public List<Workshop> Paging(
      final int CurrentPage, final String WhereCond, final String SortBy, final boolean islast)
      throws Exception {
    // / TODO Auto-generated method stub
    final StringBuilder hql = new StringBuilder();
    List<Workshop> list = null;

    try {
      hql.append(this.strStatement);
      if (!WhereCond.equals("")) {
        hql.append(" where ");
        hql.append(WhereCond);
      }
      final Query selectQuery = this.session.createQuery(hql.toString());
      final long totalrecord = this.TotalRecord(this.strStatement, WhereCond);
      selectQuery.setFirstResult((int) ((totalrecord - 1) * this.pagesize));
      selectQuery.setMaxResults(this.pagesize);
      list = selectQuery.list();

    } catch (final Exception exp) {

      final ExceptionEntities lEntExp = new ExceptionEntities();
      lEntExp.setJavaClass(Thread.currentThread().getStackTrace()[1].getClassName());
      lEntExp.setMethodName(Thread.currentThread().getStackTrace()[1].getMethodName());
      ExceptionHelper.WriteException(lEntExp, exp);
    }
    return list;
  }
コード例 #3
0
  /* (non-Javadoc)
   * @see com.adibrata.smartdealer.service.othertransactions.OtherReceive#Save(com.adibrata.smartdealer.model.OtherRcvHdr, com.adibrata.smartdealer.model.OtherRcvDtl)
   */
  @SuppressWarnings("unused")
  @Override
  public void Save(String usrupd, OtherRcvHdr otherRcvHdr, List<OtherRcvDtl> lstotherRcvDtl)
      throws Exception {
    // TODO Auto-generated method stub
    session.getTransaction().begin();
    try {
      String transno =
          TransactionNo(
              session,
              TransactionType.otherreceive,
              otherRcvHdr.getPartner().getPartnerCode(),
              otherRcvHdr.getOffice().getId());
      otherRcvHdr.setOtherRcvNo(transno);
      otherRcvHdr.setDtmCrt(dtmupd.getTime());
      otherRcvHdr.setDtmUpd(dtmupd.getTime());
      session.save(otherRcvHdr);

      for (OtherRcvDtl arow : lstotherRcvDtl) {
        OtherRcvDtl otherRcvDtl = new OtherRcvDtl();
        otherRcvDtl.setOtherRcvHdr(otherRcvHdr);
        otherRcvDtl.setDtmCrt(dtmupd.getTime());
        otherRcvDtl.setDtmUpd(dtmupd.getTime());
        session.save(otherRcvDtl);
      }
      session.getTransaction().commit();

    } catch (Exception exp) {
      session.getTransaction().rollback();
      ExceptionEntities lEntExp = new ExceptionEntities();
      lEntExp.setJavaClass(Thread.currentThread().getStackTrace()[1].getClassName());
      lEntExp.setMethodName(Thread.currentThread().getStackTrace()[1].getMethodName());
      ExceptionHelper.WriteException(lEntExp, exp);
    }
  }
コード例 #4
0
  /*
   * (non-Javadoc)
   * @see
   * com.adibrata.smartdealer.service.danatunai.DanaTunaiTransactions#Save
   * (com.adibrata.smartdealer.model.Customer)
   */
  @Override
  public void Save(final String usrupd, final DanaTunai danaTunai) throws Exception {
    // TODO Auto-generated method stub
    final Partner partner = danaTunai.getPartner();
    final Office office = danaTunai.getOffice();

    this.session.getTransaction().begin();
    try {
      final String transno =
          TransactionNo(
              this.session, partner.getPartnerCode(), office.getId(), TransactionType.danatunai);
      danaTunai.setDanaTunaiNo(transno);
      danaTunai.setDtmCrt(this.dtmupd.getTime());
      danaTunai.setDtmUpd(this.dtmupd.getTime());
      this.session.save(danaTunai);
      this.session.getTransaction().commit();

    } catch (final Exception exp) {
      this.session.getTransaction().rollback();
      final ExceptionEntities lEntExp = new ExceptionEntities();
      lEntExp.setJavaClass(Thread.currentThread().getStackTrace()[1].getClassName());
      lEntExp.setMethodName(Thread.currentThread().getStackTrace()[1].getMethodName());
      ExceptionHelper.WriteException(lEntExp, exp);
    }
  }
コード例 #5
0
  private void Paging() throws Exception {
    try {
      this.service = new CustomerDao();
      this.lstcustomer = this.service.Paging(this.getPagenumber(), this.WhereCond(), "");
    } catch (final Exception exp) {

      final ExceptionEntities lEntExp = new ExceptionEntities();
      lEntExp.setJavaClass(Thread.currentThread().getStackTrace()[1].getClassName());
      lEntExp.setMethodName(Thread.currentThread().getStackTrace()[1].getMethodName());
      ExceptionHelper.WriteException(lEntExp, exp);
    }
  }
コード例 #6
0
  public OtherReceiveDao() throws Exception {
    // TODO Auto-generated constructor stub
    try {
      session = HibernateHelper.getSessionFactory().openSession();
      pagesize = HibernateHelper.getPagesize();
      strStatement = " from Office ";

    } catch (Exception exp) {
      session.getTransaction().rollback();
      ExceptionEntities lEntExp = new ExceptionEntities();
      lEntExp.setJavaClass(Thread.currentThread().getStackTrace()[1].getClassName());
      lEntExp.setMethodName(Thread.currentThread().getStackTrace()[1].getMethodName());
      ExceptionHelper.WriteException(lEntExp, exp);
    }
  }
コード例 #7
0
  public RepairEntryDao() throws Exception {
    // TODO Auto-generated constructor stub
    try {
      this.session = HibernateHelper.getSessionFactory().openSession();
      this.pagesize = HibernateHelper.getPagesize();
      this.strStatement = " from ServiceHdr ";

    } catch (final Exception exp) {
      this.session.getTransaction().rollback();
      final ExceptionEntities lEntExp = new ExceptionEntities();
      lEntExp.setJavaClass(Thread.currentThread().getStackTrace()[1].getClassName());
      lEntExp.setMethodName(Thread.currentThread().getStackTrace()[1].getMethodName());
      ExceptionHelper.WriteException(lEntExp, exp);
    }
  }
コード例 #8
0
  @Override
  public ServiceHdr View(final Long id) throws Exception {
    // TODO Auto-generated method stub
    ServiceHdr serviceHdr = null;
    try {
      serviceHdr = (ServiceHdr) this.session.get(ServiceHdr.class, id);

    } catch (final Exception exp) {

      final ExceptionEntities lEntExp = new ExceptionEntities();
      lEntExp.setJavaClass(Thread.currentThread().getStackTrace()[1].getClassName());
      lEntExp.setMethodName(Thread.currentThread().getStackTrace()[1].getMethodName());
      ExceptionHelper.WriteException(lEntExp, exp);
    }
    return serviceHdr;
  }
コード例 #9
0
  @Override
  public DanaTunai viewDanaTunai(final Long id) throws Exception {
    // TODO Auto-generated method stub
    DanaTunai danaTunai = null;
    try {
      danaTunai = (DanaTunai) this.session.get(DanaTunai.class, id);

    } catch (final Exception exp) {

      final ExceptionEntities lEntExp = new ExceptionEntities();
      lEntExp.setJavaClass(Thread.currentThread().getStackTrace()[1].getClassName());
      lEntExp.setMethodName(Thread.currentThread().getStackTrace()[1].getMethodName());
      ExceptionHelper.WriteException(lEntExp, exp);
    }
    return danaTunai;
  }
コード例 #10
0
  @Override
  public void Save(
      final String usrupd,
      final ServiceHdr serviceHdr,
      final List<ServiceDtl> lstserviceDtls,
      final List<ServiceItem> lstserviceItem)
      throws Exception {
    // TODO Auto-generated method stub
    this.session.getTransaction().begin();
    try {
      final String transno =
          TransactionNo(
              this.session,
              serviceHdr.getPartner().getPartnerCode(),
              serviceHdr.getOffice().getId(),
              TransactionType.service);
      serviceHdr.setServiceNo(transno);
      serviceHdr.setDtmCrt(this.dtmupd);
      serviceHdr.setDtmUpd(this.dtmupd);
      this.session.save(serviceHdr);
      for (final ServiceDtl arow : lstserviceDtls) {
        ServiceDtl serviceDtl = new ServiceDtl();

        serviceDtl = arow;
        serviceDtl.setServiceHdr(serviceHdr);
        serviceDtl.setDtmCrt(this.dtmupd);
        serviceDtl.setDtmUpd(this.dtmupd);
        this.session.save(serviceDtl);
        for (final ServiceItem arow1 : lstserviceItem) {
          ServiceItem serviceItem = new ServiceItem();
          serviceItem = arow1;
          serviceItem.setServiceDtl(serviceDtl);
          serviceItem.setDtmCrt(this.dtmupd);
          serviceItem.setDtmUpd(this.dtmupd);
          this.session.save(serviceItem);
        }
      }
      this.session.getTransaction().commit();

    } catch (final Exception exp) {
      this.session.getTransaction().rollback();
      final ExceptionEntities lEntExp = new ExceptionEntities();
      lEntExp.setJavaClass(Thread.currentThread().getStackTrace()[1].getClassName());
      lEntExp.setMethodName(Thread.currentThread().getStackTrace()[1].getMethodName());
      ExceptionHelper.WriteException(lEntExp, exp);
    }
  }
コード例 #11
0
  @SuppressWarnings("unchecked")
  public void Del() throws Exception {
    try {
      this.lstshareinfo = (List<CoyCustShareInfo>) this.session.get("lstShareInfoSession");
      this.seqno = this.seqno - 1;
      this.lstshareinfo.remove(this.seqno);

      this.session.put("lstShareInfoSession", this.lstshareinfo);
      this.lstshareinfo = (List<CoyCustShareInfo>) this.session.get("lstShareInfoSession");
    } catch (final Exception exp) {

      this.setMessage(BaseAction.ErrorMessage());
      final ExceptionEntities lEntExp = new ExceptionEntities();
      lEntExp.setJavaClass(Thread.currentThread().getStackTrace()[1].getClassName());
      lEntExp.setMethodName(Thread.currentThread().getStackTrace()[1].getMethodName());
      ExceptionHelper.WriteException(lEntExp, exp);
    }
  }
コード例 #12
0
 public String View() throws Exception {
   try {
     if (this.getId() != null) {
       this.customer = new Customer();
       this.customer = this.service.ViewCustomer(this.getId());
     } else {
       this.Paging();
       this.mode = INPUT;
       this.setMessage(BaseAction.SelectFirst());
     }
   } catch (final Exception exp) {
     this.setMessage(BaseAction.ErrorMessage());
     final ExceptionEntities lEntExp = new ExceptionEntities();
     lEntExp.setJavaClass(Thread.currentThread().getStackTrace()[1].getClassName());
     lEntExp.setMethodName(Thread.currentThread().getStackTrace()[1].getMethodName());
     ExceptionHelper.WriteException(lEntExp, exp);
   }
   return this.mode;
 }
コード例 #13
0
  public void Save() throws Exception {
    try {
      for (final CoyCustShareInfo shareinfo : this.lstshareinfo) {
        shareinfo.setCustomer(this.getCustomer());
        shareinfo.setName(this.getName());
        shareinfo.setIdnumber(this.getIdnumber());
        shareinfo.setJobPositionId(this.getJobpositionid());
        shareinfo.setAddress(this.getAddress());
        shareinfo.setPhone(this.getPhone());
        shareinfo.setSharePercentage(this.getSharepercentage());
      }

      this.customermaintservice.SaveCompanyCustomerShare(sesLoginName(), this.lstshareinfo);
    } catch (final Exception exp) {

      this.setMessage(BaseAction.ErrorMessage());
      final ExceptionEntities lEntExp = new ExceptionEntities();
      lEntExp.setJavaClass(Thread.currentThread().getStackTrace()[1].getClassName());
      lEntExp.setMethodName(Thread.currentThread().getStackTrace()[1].getMethodName());
      ExceptionHelper.WriteException(lEntExp, exp);
    }
  }
コード例 #14
0
  public void Add() throws Exception {
    try {
      final CoyCustShareInfo shareinfo = new CoyCustShareInfo();

      shareinfo.setName(this.getName());
      shareinfo.setIdnumber(this.getIdnumber());
      shareinfo.setJobPositionId(this.getJobpositionid());
      shareinfo.setAddress(this.getAddress());
      shareinfo.setPhone(this.getPhone());
      shareinfo.setSharePercentage(this.getSharepercentage());

      this.lstshareinfo.add(shareinfo);
      this.session.put("lstShareInfoSession", this.lstshareinfo);
    } catch (final Exception exp) {

      this.setMessage(BaseAction.ErrorMessage());
      final ExceptionEntities lEntExp = new ExceptionEntities();
      lEntExp.setJavaClass(Thread.currentThread().getStackTrace()[1].getClassName());
      lEntExp.setMethodName(Thread.currentThread().getStackTrace()[1].getMethodName());
      ExceptionHelper.WriteException(lEntExp, exp);
    }
  }