Package org.campware.dream.om

Examples of org.campware.dream.om.Dreturn


    protected boolean getEntry(Criteria criteria, Context context)
    {
        try
        {
            Dreturn entry = (Dreturn) DreturnPeer.doSelect(criteria).get(0);
            context.put("entry", entry);

//      Criteria orditemcrit = new Criteria();
//      orditemcrit.add(DorderItemPeer.DORDER_ID, new Integer(entry.getDorderId()), Criteria.EQUAL);
//      context.put("entryitems", DorderItemPeer.doSelect(orditemcrit));

      Criteria orditemcrit = new Criteria();
      orditemcrit.add(DorderItemPeer.DORDER_ID, entry.getDorderId());

      orditemcrit.addJoin(LocationPeer.LOCATION_ID, DorderItemPeer.LOCATION_ID);
      orditemcrit.addJoin(SalesDistrictPeer.SALES_DISTRICT_ID, LocationPeer.SALES_DISTRICT_ID);

      orditemcrit.addAscendingOrderByColumn(SalesDistrictPeer.SALES_DISTRICT_NAME);
      orditemcrit.addAscendingOrderByColumn(LocationPeer.LOCATION_DISPLAY);
      context.put("entryitems", DorderItemPeer.doSelect(orditemcrit));


            Criteria ordcrit = new Criteria();
            Criteria.Criterion a1 = ordcrit.getNewCriterion(DorderPeer.DORDER_ID, new Integer(1000), Criteria.EQUAL);
            Criteria.Criterion a2 = ordcrit.getNewCriterion(DorderPeer.DORDER_ID, new Integer(entry.getDorderId()), Criteria.EQUAL);
            Criteria.Criterion a3 = ordcrit.getNewCriterion(DorderPeer.DISTRIBUTOR_ID, new Integer(entry.getDistributorId()), Criteria.EQUAL);
            Criteria.Criterion a4 = ordcrit.getNewCriterion(DorderPeer.STATUS, new Integer(30), Criteria.EQUAL);

      String inSelect= new String("DORDER_ID IN (SELECT DORDER_ID FROM DSHIPMENT WHERE STATUS=" + new Integer(50).toString() + ")");
      Criteria.Criterion a5 = criteria.getNewCriterion(DorderPeer.DORDER_ID, (Object)inSelect, Criteria.CUSTOM);
View Full Code Here


    protected boolean getNew(Context context)
    {
        try
        {
            Dreturn entry = new Dreturn();
            context.put("entry", entry);

            Criteria ordcrit = new Criteria();
            ordcrit.add(DorderPeer.DORDER_ID, 1000, Criteria.EQUAL);
            context.put("orders", DorderPeer.doSelect(ordcrit));
View Full Code Here

     * wouldn't be secure.
     */
    public void doInsert(RunData data, Context context)
        throws Exception
    {
        Dreturn entry = new Dreturn();
        data.getParameters().setProperties(entry);

        entry.setDreturnCode(getTempCode());

        entry.setIssuedDate(parseDate(data.getParameters().getString("issueddate")));
        entry.setClosedDate(parseDate(data.getParameters().getString("closeddate")));
    entry.setReturnDate(parseDate(data.getParameters().getString("returndate")));
    int retStatus= data.getParameters().getInt("status");
   
        entry.setCreatedBy(data.getUser().getUserName());
        entry.setCreated(new Date());
        entry.setModifiedBy(data.getUser().getUserName());
        entry.setModified(new Date());
       
    ParameterParser pp= data.getParameters();
    Enumeration paramKeys= pp.keys();
        Dorder retDorder= entry.getDorder();
       
    while(paramKeys.hasMoreElements()) {
      String paramName = paramKeys.nextElement().toString();
      if(paramName.startsWith("locationid")) { 
        String suffix=paramName.substring(10, paramName.length());
        DorderItem entryItem= new DorderItem();

        entryItem.setLocationId(pp.getInt("locationid" + suffix));
        int itmShippQty= pp.getInt("shippedqty" + suffix);
        int itmUnsoldQty= pp.getInt("unsoldqty" + suffix);
        int itmLostQty= pp.getInt("lostqty" + suffix);
        entryItem.setOrderedQty(itmShippQty);
        entryItem.setShippedQty(itmShippQty);
        entryItem.setUnsoldQty(itmUnsoldQty);
        entryItem.setLostQty(itmLostQty);

        retDorder.addDorderItem(entryItem);
      }
    }


    if (retStatus==50){
      retDorder.setStatus(50);
    }
    retDorder.setModified(true);
    retDorder.setNew(false);

    Criteria crit = new Criteria();
    crit.add(DorderItemPeer.DORDER_ID, entry.getDorderId());

    Connection conn = Transaction.begin(DreturnPeer.DATABASE_NAME);
    boolean success = false;
    try {
      DorderItemPeer.doDelete(crit, conn);
      entry.save(conn);
      retDorder.save(conn);
      entry.setDreturnCode(getRowCode("SH", entry.getDreturnId()));
      entry.save(conn);
      Transaction.commit(conn);
      success = true;

        } finally {
            if (!success) Transaction.safeRollback(conn);
View Full Code Here

     * into the database.
     */
    public void doUpdate(RunData data, Context context)
        throws Exception
    {
        Dreturn entry = new Dreturn();
        data.getParameters().setProperties(entry);

        entry.setIssuedDate(parseDate(data.getParameters().getString("issueddate")));
        entry.setClosedDate(parseDate(data.getParameters().getString("closeddate")));
    entry.setReturnDate(parseDate(data.getParameters().getString("returndate")));
    int retStatus= data.getParameters().getInt("status");

        entry.setCreated(parseDateTime(data.getParameters().getString("created")));
        entry.setModifiedBy(data.getUser().getUserName());
        entry.setModified(new Date());

    ParameterParser pp= data.getParameters();
    Enumeration paramKeys= pp.keys();
    Dorder retDorder= entry.getDorder();
       
    while(paramKeys.hasMoreElements()) {
      String paramName = paramKeys.nextElement().toString();
      if(paramName.startsWith("locationid")) { 
        String suffix=paramName.substring(10, paramName.length());
        DorderItem entryItem= new DorderItem();

        entryItem.setLocationId(pp.getInt("locationid" + suffix));
        int itmShippQty= pp.getInt("shippedqty" + suffix);
        int itmUnsoldQty= pp.getInt("unsoldqty" + suffix);
        int itmLostQty= pp.getInt("lostqty" + suffix);
        entryItem.setOrderedQty(itmShippQty);
        entryItem.setShippedQty(itmShippQty);
        entryItem.setUnsoldQty(itmUnsoldQty);
        entryItem.setLostQty(itmLostQty);

        retDorder.addDorderItem(entryItem);
      }
    }


    if (retStatus==50){
      retDorder.setStatus(50);
    }
    retDorder.setModified(true);
    retDorder.setNew(false);
    entry.setModified(true);
    entry.setNew(false);

        Criteria crit = new Criteria();
        crit.add(DorderItemPeer.DORDER_ID, entry.getDorderId());

        Connection conn = Transaction.begin(DreturnPeer.DATABASE_NAME);
        boolean success = false;
        try {
            DorderItemPeer.doDelete(crit, conn);
            entry.save(conn);
      retDorder.save(conn);
            Transaction.commit(conn);
            success = true;

        } finally {
View Full Code Here

TOP

Related Classes of org.campware.dream.om.Dreturn

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.