Page 3 of 3

Re: HUD Section 1200

Posted: Mon Oct 11, 2021 12:49 pm
by bandorganman
Here are my using statements and constructor. What am I missing?

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Data.Odbc;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using SoftPro.Select.Client;
using SoftPro.OrderTracking;
using SoftPro.ClientModel;
using SoftPro.ProceedsTracking;
using SoftPro.Accounting;
using SoftPro.EntityModel.Collections;
using SoftPro.OrderTracking.Client.Orders;
using System.Collections;

namespace SoftProConversion
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

string strOConn = @"DSN=jks32";

Re: HUD Section 1200

Posted: Mon Oct 11, 2021 2:50 pm
by BobRichards
If this is a standalone application (not a Shell Package), you would need to create a connection to the Select mid-tier somewhere using the steps at the beginning of "How-To/Standalone Application Development/Create an Order" in the SDK to create a SelectServer instance. That instance would be passed around to whatever methods need it. Be sure the dispose of the object when you no longer need it. While it is open, it will consume a SoftPro license if you touch a ProForm, ProTrust, etc. interface or object until the connection is disposed.

I really can't advise on where the object should be instantiated since I don't know the particulars of your logic. If you need the connection from the very beginning of the dialog then put it in the Form1() constructor:

Code: Select all

private SelectServer _ss = null;
public Form1()
{
    InitializeComponent();
    
    // Create SelectServer instance and save it to _ss. If fails, global _ss will be null.
    SelectServer ss = ...
    string reason;
    if (ss.TryAuthenticate(out reason)
    {
        // We got a connection to server.
        _ss = ss;
    }
    else
    {
        // Display error message to user for some type of corrective action
        MessageBox.Show (reason, "Failed to get connection");
    }
}

Re: HUD Section 1200

Posted: Mon Oct 11, 2021 3:05 pm
by bandorganman
Thanks, but I am already doing this. Here is the CreateOrder method on Form1.cs which has been tested and it works:

private void CreateOrder()
{
using (SelectServer ss = new SelectServer(new Uri("http://localhost:8080")))
{
string reason;
if (!ss.TryAuthenticate(out reason))
{
Results.Text = reason;
return;
}
else
{
Results.Text = "Success";

}


List<Master> lMaster = getMaster();
foreach(Master ms in lMaster)
{
OrderCreationSpec spec = new OrderCreationSpec();
spec.BaseNumber = ms.LINKNO + " HUD Test 1";
spec.SettlementType = SettlementType.HUD1;
try
{

IOrderStore os = ss.GetService<IOrderStore>();
IOrder order = os.NewOrder(spec);
dynamic o = (dynamic)order;
o.Project = "RAL Test";
o.ReceivedDate = ms.DATEOPEN;

NEWMAST nms = getNewmast(ms.LINKNO);

o.SalesContract.SalesPrice = nms.SALESPRICE;
o.DissbursementDate = nms.DistributionDate;

Re: HUD Section 1200

Posted: Mon Oct 11, 2021 3:48 pm
by BobRichards
I'm sorry but I don't understand the question you are asking. Could you please ask again?

Re: HUD Section 1200

Posted: Mon Oct 11, 2021 5:00 pm
by bandorganman
Yes, Studio gives me this error for the code you sent me to add fees to line 1202:
Screenshot - 10_11_2021 , 4_53_15 PM.jpg
Line 4946 throws the error shown in the attachment. Why is this happening?

Re: HUD Section 1200

Posted: Mon Oct 11, 2021 5:09 pm
by bandorganman
The code:

IOrderItem line1202 = (IOrderItem)lines[1202];

if (hb2.Hud1201D > 0 || hb2.Hud1201M > 0 || hb2.Hud1201R > 0)
{
IOrderItem charge = (IOrderItem)line1202.GetProperty("Charge");
IOrderItem fee = o.CreateNew("Hud1202ChargeFee");
charge.GetProperty<IList>("Fees").Add(fee);
}
The last line gives the following error:

Severity Code Description Project File Line
Error CS0308 The non-generic method 'IOrderItem.GetProperty(string)' cannot be used with type arguments

Question: Why? This is the code you gave me in an earlier post in this topic. How do I make it work?