Commerce Server General - Accessing ALL orders for ALL users?

This is Interesting: Free IT Magazines  
Home > Archive > Commerce Server General > October 2006 > Accessing ALL orders for ALL users?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Accessing ALL orders for ALL users?
briguy

2006-09-20, 1: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.

Tom Tausmann

2006-09-20, 1: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.CurrentUICulture.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.
>
>

briguy

2006-09-20, 1: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?

Nihit Kaul [MSFT]

2006-10-18, 7:28 pm

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

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

http://msdn.microsoft.com/library/d..._class_4016.asp
http://msdn.microsoft.com/library/d...401
6.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.microsoft.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; .NET 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!newsfeed00.sul.t-online.de!t-online.de!border2.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!
nntp.giganews.com!postnews.google.com!m7g2000cwm.googlegroups.com!not-for-mail
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?



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com