Conversion issue with OrderURI, OrderKind
Conversion issue with OrderURI, OrderKind
Hello - Conversion issue on OrderURI and OrderKind
I am using the following declarations.Failing on error below.
using SoftPro.OrderTracking.Client.Orders;
using SoftPro.Select.Client;
using SoftPro.OrderTracking;
using SoftPro.Select.Shell;
protected void OpenOrderPane(Guid orderID)
{
IShell objShell = (IShell)m_objServiceProvider.GetService(typeof(IShell));
if (objShell != null)
{
try
{
objShell.OpenStandardEditor(new OrderUri(OrderKind.Order, orderID));
Error 3 The type or namespace name 'OrderUri' could not be found (are you missing a using directive or an assembly reference?) Also OrderKind is not recognized?
I am using the following declarations.Failing on error below.
using SoftPro.OrderTracking.Client.Orders;
using SoftPro.Select.Client;
using SoftPro.OrderTracking;
using SoftPro.Select.Shell;
protected void OpenOrderPane(Guid orderID)
{
IShell objShell = (IShell)m_objServiceProvider.GetService(typeof(IShell));
if (objShell != null)
{
try
{
objShell.OpenStandardEditor(new OrderUri(OrderKind.Order, orderID));
Error 3 The type or namespace name 'OrderUri' could not be found (are you missing a using directive or an assembly reference?) Also OrderKind is not recognized?
-
- Posts: 1377
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
- Contact:
Re: Conversion issue with OrderURI, OrderKind
The OrderUri and OrderKind definitions are in SoftPro.Select.OrderTracking.Shared.dll. What are you trying to accomplish?
Bob Richards, Senior Software Developer, SoftPro
-
- Posts: 1377
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
- Contact:
Re: Conversion issue with OrderURI, OrderKind
I assume you want to open the order in Select client. You can use the following code. In this case, I am opening order "2014110004" for the user.
Code: Select all
// Get the guid for the order by getting it's IOrderInfo from the server.
SelectServer ss = GetService<SelectServer>();
IOrderStore orderStore = ss.GetService<IOrderStore>();
IOrderInfo orderInfo = orderStore.Orders.FirstOrDefault(t => t.Number == "2014110004");
// Now create an OrderUri and have Select open it for the user.
IShell shell = GetService<IShell>();
OrderUri uri = new OrderUri(OrderKind.Order, new OrderIdentifier(orderInfo.Identifier.Guid));
shell.OpenStandardEditor(uri);
Bob Richards, Senior Software Developer, SoftPro
Re: Conversion issue with OrderURI, OrderKind
following this post and yet the Shell object
IShell shell = GetService<IShell>();
is null after this point...
Why is that?
I am doing a ss.GetService<IShell>()
where ss is my SelectServer object.
IShell shell = GetService<IShell>();
is null after this point...
Why is that?
I am doing a ss.GetService<IShell>()
where ss is my SelectServer object.
-
- Posts: 1377
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
- Contact:
Re: Conversion issue with OrderURI, OrderKind
If IShell is null, then it is not available. IShell is an interface available to Select Shell packages only (shell packages are described in the SDK in How-To/Shell Package Development). I suspect you are not a shell package or something non-standard is going on with your design.
Assuming you have created a shell package, I would need to see your source for the event (button) invocation and the surrounding logic for this attempt to get IShell.
Assuming you have created a shell package, I would need to see your source for the event (button) invocation and the surrounding logic for this attempt to get IShell.
Bob Richards, Senior Software Developer, SoftPro
-
- Posts: 27
- Joined: Tue Jun 28, 2016 2:26 pm
Re: Conversion issue with OrderURI, OrderKind
Hi Bob, I also ran into this problem today. I sent a sample project to Brian Bradley to forward to you. It is a shell package and shows the shell service is null.
-
- Posts: 1377
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
- Contact:
Re: Conversion issue with OrderURI, OrderKind
I have received the code from kkirkfield and it has two basic issues - (1) You should never get the SelectServer object in a Select Shell package and (2) IShell is never available from the SelectServer object.
(1) While creating a custom Editor window, the following incorrect code was created. You never need to get your own connection to the Select mid-tier in a Shelll package - you already have one. When you get an additional SelectServer object, you have simply consumed a second license.The corrected code would be:
(2) You can only get the IShell interface from the Select Shell local service provider. See below for the correct method.
(1) While creating a custom Editor window, the following incorrect code was created. You never need to get your own connection to the Select mid-tier in a Shelll package - you already have one. When you get an additional SelectServer object, you have simply consumed a second license.
Code: Select all
protected override Control OnCreateControl()
{
using (var server = new SelectServer("http://localhost:8080"))
{
string reason;
if (!server.TryAuthenticate(out reason))
{
Trace.TraceError(reason);
return null;
}
// Get order from order store.
var orderStore = server.GetService<IOrderStore>().Where(t => ...);
// Continue with Select Shell package code...
}
}
Code: Select all
protected override Control OnCreateControl()
{
// Get SelectServer object that already exists in Select Shell.
SelectServer server = GetService<SelectServer>();
// Get order from order store.
var orderStore = server.GetService<IOrderStore>().Where(t => ...);
// Continue with Select Shell package code...
}
Code: Select all
public MiscShellPackageFxn()
{
//var shell = server.GetService<IShell>(); // INCORRECT: IShell is never in the SelectServer service container.
var shell = GetService<IShell>(); // CORRECT: Get IShell from shell package service container.
}
Bob Richards, Senior Software Developer, SoftPro
-
- Posts: 27
- Joined: Tue Jun 28, 2016 2:26 pm
Re: Conversion issue with OrderURI, OrderKind
Thanks Bob. I'll try that later tonight. One more question, does the SelectServer retrieved through the package service provider need to be disposed, or is it automatically handled by the client when it closes?
-
- Posts: 1377
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
- Contact:
Re: Conversion issue with OrderURI, OrderKind
The client will take care of disposing it.
Bob Richards, Senior Software Developer, SoftPro
Re: Conversion issue with OrderURI, OrderKind
Thanks I had figured it out before even reading this.