HUD Section 1200

Discussions related to SoftPro Select user interface development.

Moderator: Phil Barton

bandorganman
Posts: 52
Joined: Tue Mar 03, 2020 5:23 pm

Re: HUD Section 1200

Post by bandorganman » Thu Sep 30, 2021 12:56 pm

I just had a chance to look at this. I still have a question though. How do I add a new fee to line 1202? The marvelous SDK documentation gives no clue of how to do this.

bandorganman
Posts: 52
Joined: Tue Mar 03, 2020 5:23 pm

Re: HUD Section 1200

Post by bandorganman » Thu Sep 30, 2021 3:28 pm

Please understand that I am only creating and populating new orders from an old access database. I really have no need to read existing orders as there are none. I already created the lines collection and can access line 1202 easily.

IOrderItem line1202 = (IOrderItem)lines[1202];

Now how do I populate the fees collection?

Thanks.

BobRichards
Posts: 1132
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: HUD Section 1200

Post by BobRichards » Thu Sep 30, 2021 5:26 pm

Alrighty. This code will create new fees by creating them, adding them to the charge object then populating the various required field. Use this in conjunction with the fee schedule search code from earlier in this post. This order has a Settlement Agent in the contacts.

Code: Select all

IFeeScheduleVersion match = {from prior code}
IOrderItem charge = {charge on line 1202}
IBillCode bc = {billcode}

charge.SetProperty("BillCode", bc);
charge.SetProperty("HUDTo", 
    order.GetProperty<IEnumerable<IOrderItem>>("Contacts")
        .Single(t => t.GetProperty<ContactType>("ContactType") == ContactType.SettlementAgent));

// Add a fee to charge and set properties.
IOrderItem fee = order.CreateNew("HUD1202ChargeFee");
charge.GetProperty<IList>("Fees").Add(fee);
fee.SetProperty("Amount", 111m); 
fee.SetProperty("DocumentType", DocumentType.Mortgage);
fee.SetProperty("SellerPayPercent", 1m);

// Add a second fee to charge and set properties.
fee = order.CreateNew("HUD1202ChargeFee");
charge.GetProperty<IList>("Fees").Add(fee);
fee.SetProperty("Amount", 222m);
fee.SetProperty("DocumentType", DocumentType.Release);
fee.SetProperty("SellerPayPercent", 0.5m);
In the IOrder.CreateNew() call, I had to pass the specific name for the object I wanted - HUD1202ChargeFee. The object names are available in the Order HUDs section of the SDK (i.e. How-To/Order HUDs/Section 1200 - Government Recording and Transfer Charges, Line 1202). Information is also available regarding lines that do not allow additional fees.
Bob Richards, Senior Software Developer, SoftPro

bandorganman
Posts: 52
Joined: Tue Mar 03, 2020 5:23 pm

Re: HUD Section 1200

Post by bandorganman » Mon Oct 04, 2021 2:41 pm

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);

}

results in the following error. Can you shed some light on this?

Severity Code Description Project File Line
Error CS0308 The non-generic method 'IOrderItem.GetProperty(string)' cannot be used with type arguments SoftProConversion C:\dev\SoftProConversion\SoftProConversion\Form1.cs 4942

bandorganman
Posts: 52
Joined: Tue Mar 03, 2020 5:23 pm

Re: HUD Section 1200

Post by bandorganman » Mon Oct 04, 2021 2:58 pm

It doesn't like .GetProperty<IList>()

bandorganman
Posts: 52
Joined: Tue Mar 03, 2020 5:23 pm

Re: HUD Section 1200

Post by bandorganman » Thu Oct 07, 2021 12:08 pm

Any answers as to why I am getting this error?

BobRichards
Posts: 1132
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: HUD Section 1200

Post by BobRichards » Sun Oct 10, 2021 5:31 pm

Sorry but I was out last week. Not sure what you mean by "It doesn't like .GetProperty<IList>()". What was the error?

Did you include

Code: Select all

using System.Collections;
Bob Richards, Senior Software Developer, SoftPro

bandorganman
Posts: 52
Joined: Tue Mar 03, 2020 5:23 pm

Re: HUD Section 1200

Post by bandorganman » Mon Oct 11, 2021 9:50 am

The error is listed above along with the code as copied from studio.

bandorganman
Posts: 52
Joined: Tue Mar 03, 2020 5:23 pm

Re: HUD Section 1200

Post by bandorganman » Mon Oct 11, 2021 9:55 am

System.Collections is there. I always include it as I use collections extensively.

BobRichards
Posts: 1132
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: HUD Section 1200

Post by BobRichards » Mon Oct 11, 2021 12:02 pm

The GetService<T>() method is defined in the Package classes (and SelectServer, etc.). However your code class does not inherit from these classes. You have two options:

1. Put your code in a new or partial class that inherits from a class that provides GetService<T>()

2. Put your code in a new or partial class that inherits from a class that provides GetService(Type) method and do the same logic.

Code: Select all

IList fees = (IList)charge.GetProperty("Fees");
fees.Add(newFee);
In this case, another thing that I frequently do if I create a class that doesn't have GetService<T>() is to add a method with the same signature to replace it. It is very handy.

Code: Select all

/// <summary>
/// Gets the service of type T.
/// </summary>
/// <typeparam name="T">The desired type.</typeparam>
/// <returns> A service object of type T or null if not found.</returns>
public T GetService<T>()
{
    return (T)GetService(typeof(T));
}
3. And the last option is to pass a copy of the service container to your class in a constructor and keep a copy of it. Then use it anywhere you would have used it previously.

Code: Select all

private ServiceContainer _serviceContainer;

public MyClass(ServiceContainer serviceContainer)
{
    _serviceContainer = serviceContainer;
}

public T GetService<T>()
{
    return (T)_serviceContainer.GetService(typeof(T));
}
Bob Richards, Senior Software Developer, SoftPro

Post Reply