Package com.centraview.marketing

Examples of com.centraview.marketing.ItemLines


    info.put( "EndAtparam" , new Integer( 10 ) ) ;
    info.put( "searchString" , "" ) ;
    info.put( "sortmem" , "PromotionID" ) ;
    info.put( "sortType" , new Character('A') ) ;

    ItemLines itemlines = getItemLines( PromotionID , info  );

    promotionvo.setItemlines( itemlines );


    cvdl.destroy();
View Full Code Here


    if(!CVUtility.isModuleVisible("Promotion",promotionID, this.dataSource))
      throw new AuthorizationFailedException("Promotion - getItemLines");
*/
    CVDal cvdl = new CVDal(dataSource);
    cvdl.clearParameters();
    ItemLines  itemlineslist = new  ItemLines();


    try
      {
      Integer startATparam = (Integer) info.get( "startATparam" ) ;
      Integer EndAtparam =  (Integer) info.get( "EndAtparam" ) ;
      String  searchString =  (String) info.get( "searchString" ) ;
      String sortmem =  (String) info.get( "sortmem" ) ;
      Character chr = ( Character ) info.get( "sortType" ) ;

      char sorttype =  chr.charValue();
      int startat = startATparam.intValue();
      int endat = EndAtparam.intValue();
          int beginindex  = Math.max( startat- 100 , ) ;
          int endindex  = endat + 100   ;

      itemlineslist.setSortMember( sortmem );



      String strSQL = "";
      String appendStr = "";
      if ( sorttype == 'A' )
         {
           strSQL = "select * from `promoitem` pi , `item` i where PromotionID ="+promotionID + " and pi.itemid = i.itemid order by "+ sortmem + " limit "+(beginindex-1) +" , "+ (endindex+1) +";" ;
         }else
         {
           strSQL = "select * from `promoitem` pi , `item` i where PromotionID ="+promotionID +" and pi.itemid = i.itemid order by "+ sortmem + " desc limit "+(beginindex-1) +" , "+ (endindex+1) +";" ;
         }

      cvdl.setSqlQuery( strSQL );
      Collection col = cvdl.executeQuery();

        Iterator it = col.iterator();
      int i=0 ;
      int count=0 ;

      while( it.hasNext() )
        {
            i++;
            count++;

            HashMap hm = ( HashMap  )it.next();
            promotionID = ((Long)hm.get("PromotionID")).intValue();
            int ItemID = ((Long)hm.get("ItemID")).intValue();
            int Quantity = ((Long)hm.get("Quantity")).intValue();
            float price = ((Number)hm.get("Price")).floatValue();
            float lprice = 0.0f;
            if (hm.get("listprice") != null ){
              lprice = ((Number )hm.get("listprice")).floatValue();
            }
            float costprice = 0.0f;
            if (hm.get("cost") != null ){
              costprice = ((Number )hm.get("cost")).floatValue();
            }

            IntMember lineid  = new IntMember( "LineId"  , count , 10 , "URL", 'T' , false , 10 );
            StringMember desc  = new StringMember( "Description", (String) hm.get( "description" ) ,10 , "", 'T' , true  );
            StringMember sku  = new StringMember( "SKU", (String) hm.get( "sku" ) ,10 , "", 'T' , true  );
            IntMember one  = new IntMember( "PromotionID"  , promotionID , 10 , "URL", 'T' , false , 10 );
            IntMember two  = new IntMember( "ItemID"  , ItemID , 10 , "URL", 'T' , false , 10 );
            IntMember three  = new IntMember( "Quantity"  , Quantity , 10 , "URL", 'T' , false , 10 );
            StringMember Rule  = new StringMember( "Rule", (String) hm.get( "Rule" ) ,10 , "", 'T' , true  );
            FloatMember four = new  FloatMember "Price" , new Float( price ) , 10 , "", 'T' , true , 10 );

            FloatMember listprice = new  FloatMember "ListPrice" , new Float( lprice ) , 10 , "", 'T' , true , 10 );
            FloatMember cost = new  FloatMember "Cost" , new Float( costprice ) , 10 , "", 'T' , true , 10 );

            ItemElement ele = new ItemElement( promotionID );
            ele.put("LineId", lineid );
            ele.put("PromotionID", one );
            ele.put("ItemId", two );
            ele.put("Value" ,  three );// Quantity
            ele.put("Type" , Rule );//Rule
            ele.put("DiscountedPrice" , four );//Price
            ele.put("Description" , desc );//Desc
            ele.put("SKU" , sku );//SKU

            ele.put("ListPrice" , listprice );//ListPrice
            ele.put("Cost" , cost );//Cost

            StringBuffer sb = new StringBuffer("00000000000");
            sb.setLength(11);
            String str = (new Integer(i)).toString();
            sb.replace((sb.length()-str.length()),(sb.length()),str);
            String newOrd = sb.toString();
            itemlineslist.put( newOrd , ele );
            itemlineslist.setListType( "PromotionItem" );
            cvdl.clearParameters();
            cvdl.destroy();
        }

      }
View Full Code Here

    dl.setInt( 7 , userId );
    dl.executeUpdate();
    promotionid = dl.getAutoGeneratedKey();

    //ItemLines itemlines = null;
    ItemLines itemlines = promotionvo.getItemlines();


    if ( itemlines!= null )
    {

      Set s = itemlines.keySet();
      Iterator itr = s.iterator();

      while ( itr.hasNext())
      {
        Object o = itr.next();
        ItemElement ele = (ItemElement) itemlines.get(o);

        dl.clearParameters();
        dl.setSql( "promotion.addpromotion2" );

        //PromotionID
View Full Code Here

    dl.clearParameters();



    //ItemLines itemlines = null;
    ItemLines itemlines = promotionvo.getItemlines();
    if ( itemlines!= null )
    {

      Set s = itemlines.keySet();
      Iterator itr = s.iterator();

      while ( itr.hasNext())
      {
        Object o = itr.next();
        ItemElement ele = (ItemElement) itemlines.get(o);
        dl.clearParameters();
        dl.setSql( "promotion.addpromotion2" );

        //PromotionID
        dl.setInt( 1 , PromotionID );
View Full Code Here

TOP

Related Classes of com.centraview.marketing.ItemLines

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.