Accessing ALL orders for ALL users?
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Microsoft Commerce Server > Commerce Server General > Accessing ALL orders for ALL users?




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Accessing ALL orders for ALL users?  
briguy


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-20-06 06:25 AM

I need to write an administration tool that will allow me to access all
new orders (regardless of the user) for a Commerce Server site.  I know
that Business Desk already has this but I need to write a custom one
that reads all the order information (including line information) and
call a custom web service to pass the information to a 3rd party
business system.  Is there a way to get all the orders without setting
a user ID?  I tried using OrderGroupSearch but that requires that I set
a UserID which I don't want to do since I won't know which users have
created the new orders.






[ Post a follow-up to this message ]



    RE: Accessing ALL orders for ALL users?  
Tom Tausmann


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-20-06 06:22 PM

Hi,
do it with the Serviceagents search:
*** SAMPLE Searchs for an User ... an in a  Comment one which gets all Users
.. then binding to a Datagrid - use at own risk ***


String searchstring="Mr. Fokker";
String searchkey = "SoldToName";
//This creates the OrderManagementContext in an Out-of-proc mode and
all the APIs go over the web service - so this is more flexible and portable

/*OrderServiceAgent orderAgent = new
OrderServiceAgent(settings.OrdersWebServiceURL);

OrderManagementContext outOfProcOrderMgtContext =
OrderManagementContext.Create(orderAgent);


*/
//This creates the OrderManagementContext in an in-proc mode (Commerce
Server has to be installed locally) and is therefore faster

OrderSiteAgent orderSiteAgent = new
OrderSiteAgent(CommerceContext.Current.SiteName);  //Or whatever your site
name is

OrderManagementContext inProcOrderMgtContext =
OrderManagementContext.Create(orderSiteAgent);



//Now you can access the particular manager object you are interested in

//depending on what you want to do and you can use one of the
management context objects created above - you would have created either one
or the other

/*BasketManager basketMgr = outOfProcOrderMgtContext.BasketManager;

PurchaseOrderManager poMgr =
outOfProcOrderMgtContext.PurchaseOrderManager;

PaymentMethodManager pmtMethodMgr =
outOfProcOrderMgtContext.PaymentMethodManager;

ShippingMethodManager shipMethodMgr =
outOfProcOrderMgtContext.ShippingMethodManager;*/

PurchaseOrderManager poMgr = inProcOrderMgtContext.PurchaseOrderManager;

// Clause gets all Users
//SearchClause clause =
poMgr.GetSearchClauseFactory(poMgr.GetSearchableProperties(CultureInfo.Curre
ntUICulture.ToString()),
"PurchaseOrder").CreateClause(ExplicitComparisonOperator.NotEqual, "Status",
"");
//poMgr.GetSearchableProperties("en").Tables[0].Select(searchstring);

// Clause looking for 1 User

SearchClause clause =
poMgr.GetSearchClauseFactory(poMgr.GetSearchableProperties("en"),
"PurchaseOrder").CreateClause(ExplicitComparisonOperator.Contains, searchkey
,
searchstring);
DataSet searchResults = poMgr.SearchPurchaseOrders(clause);



List<Guid> purchaseOrderIds = new List<Guid>();
DataTable dt = searchResults.Tables[0];
foreach (DataRow dr in dt.Rows)
{
purchaseOrderIds.Add(new Guid(dr[0].ToString()));
}
String xmlString =
poMgr.GetPurchaseOrdersAsXml(purchaseOrderIds.ToArray()).OuterXml;
System.IO.StringReader sr = new System.IO.StringReader(xmlString);
DataSet ds2 = new DataSet();
ds2.ReadXml(sr);


Gridview1.DataSource=ds2;
Gridview1.DataBind();

"briguy" wrote:

> I need to write an administration tool that will allow me to access all
> new orders (regardless of the user) for a Commerce Server site.  I know
> that Business Desk already has this but I need to write a custom one
> that reads all the order information (including line information) and
> call a custom web service to pass the information to a 3rd party
> business system.  Is there a way to get all the orders without setting
> a user ID?  I tried using OrderGroupSearch but that requires that I set
> a UserID which I don't want to do since I won't know which users have
> created the new orders.
>
>





[ Post a follow-up to this message ]



    Re: Accessing ALL orders for ALL users?  
briguy


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-20-06 06:22 PM

Thanks but I should have explained that I'm using CS2002 SP1.  The code
you've attached looks like it's only for CS2007.  Do you know what the
corresponding CS2002 objects are called?






[ Post a follow-up to this message ]



    Re: Accessing ALL orders for ALL users?  
Nihit Kaul [MSFT]


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-19-06 12:28 AM

I don't see where the the userId is required when using OrderGroupSearch?

You should be able to do this using OrderGroupSearch and OrderGroupSearchOpt
ions classes.

http://msdn.microsoft.com/library/d..._class_4016.asp
http://msdn.microsoft.com/library/d..._class_4016.asp

Thanks,

Nihit Kaul[MSFT]
Commerce Server
http://blogs.msdn.com/nihitk

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at http://www.mi
crosoft.com/info/cpyright.htm
--------------------
From: "briguy" <brian@webmetro.com>
Newsgroups: microsoft.public.commerceserver.general
Subject: Re: Accessing ALL orders for ALL users?
Date: 20 Sep 2006 08:47:59 -0700
Organization: http://groups.google.com
Lines: 4
Message-ID: <1158767279.421121.306310@m7g2000cwm.googlegroups.com>
References: <1158712798.820280.141430@d34g2000cwd.googlegroups.com>
<2770F39B-1E36-4FD7-8428-E1F8B563B9C9@microsoft.com>
NNTP-Posting-Host: 63.147.18.79
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1158767284 19467 127.0.0.1 (20 Sep 2006 15:48:04
 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 20 Sep 2006 15:48:04 +0000 (UTC)
In-Reply-To: <2770F39B-1E36-4FD7-8428-E1F8B563B9C9@microsoft.com>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .N
ET CLR 1.1.4322; .NET CLR 1.0.3705; InfoPath.1),gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: m7g2000cwm.googlegroups.com; posting-host=63.147.18.79;
posting- account=msDG2Q0AAAD3w4MwZyKSYlPmT19E9gCm

Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTFEEDS01.phx.gbl!news
feed00.sul.t-online.de!t-online.de!border2.nntp.dca.giganews.com!border1.nnt
p.dca.giganews.com!
nntp.giganews.com!postnews.google.com!m7g2000cwm.googlegroups.com!not-for-ma
il
Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.commerceserver.general:18476
X-Tomcat-NG: microsoft.public.commerceserver.general

Thanks but I should have explained that I'm using CS2002 SP1.  The code
you've attached looks like it's only for CS2007.  Do you know what the
corresponding CS2002 objects are called?






Attachment:
This has been downloaded 0 time(s).



[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 05:08 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register