IBuyerSellerRelationship

Discussions related to custom development with Select.
Post Reply
User avatar
uwdoug79
Posts: 78
Joined: Wed Aug 07, 2013 12:43 pm
Location: Earth
Contact:

IBuyerSellerRelationship

Post by uwdoug79 »

Cameron 3.7

I need to set the BuySellerRelationship type on a Individual collection of fields. I am unsure how to set this to "Husband and Wife" for example: (see last line of Code)

Code: Select all

                                            seller.BuyerSellerType = BuyerSellerType.Individual;
                                            seller.Individual1.FirstName = Convert.ToString(dtParty.Rows[iPartyRow].ItemArray[5]);
                                            seller.Individual1.MiddleName = Convert.ToString(dtParty.Rows[iPartyRow].ItemArray[6]);
                                            seller.Individual1.LastName = Convert.ToString(dtParty.Rows[iPartyRow].ItemArray[7]);
                                            seller.Individual1.Email = Convert.ToString(dtParty.Rows[iPartyRow].ItemArray[24]);
                                            if (Convert.ToString(dtParty.Rows[iPartyRow].ItemArray[8]) != "")
                                            {
                                                seller.BuyerSellerType = BuyerSellerType.Joint;
                                                seller.Individual2.FirstName = Convert.ToString(dtParty.Rows[iPartyRow].ItemArray[8]);
                                                seller.Individual2.MiddleName = Convert.ToString(dtParty.Rows[iPartyRow].ItemArray[9]);
                                                seller.Individual2.LastName = Convert.ToString(dtParty.Rows[iPartyRow].ItemArray[10]);
                                            }
                                            if ((Convert.ToString(dtParty.Rows[iPartyRow].ItemArray[57]) != "") && (Convert.ToString(dtParty.Rows[iPartyRow].ItemArray[8]) == ""))
                                            {
                                                seller.Individual1.Relationship = Convert.ToString(dtParty.Rows[iPartyRow]);
                                            }
                                            if ((Convert.ToString(dtParty.Rows[iPartyRow].ItemArray[57]) != "") && (Convert.ToString(dtParty.Rows[iPartyRow].ItemArray[8]) != ""))
                                            {
                                                seller.Individual2.Relationship = IBuyerSellerRelationship.  (???????????????? I know this doesn't work here)
                                            }
Doug Hamilton
CHICAGO TITLE
20825 SWENSON DR SUITE 300 WAUKESHA, WI 53186
P: 262-796-3808 F: 262-796-3888
EMAIL: Doug.Hamilton@fnf.com
www.wi.ctic.com | www.chicagoagent.com | www.etitle.ws
BobRichards
Posts: 1376
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: IBuyerSellerRelationship

Post by BobRichards »

The SoftPro.Select.Client.Enumerations namespace contains around 30 enums that can all be accessed in this manner.

Code: Select all

void IBuyerSellerRelationship_Demo(IOrder order)
{
	SelectServer ss = GetService<SelectServer>();
	IEnumManager enumMgr = ss.GetService<IEnumManager>();
	IEnum<IBuyerSellerRelationship> relationship = enumMgr.GetEnum<IBuyerSellerRelationship>();

	// Create a joint buyer.
	dynamic buyer = order.CreateNew("Buyer");
	buyer.BuyerSellerType = BuyerSellerType.Joint;

	dynamic person = buyer.Individual1;
	person.FirstName = "John";
	person.LastName = "Smith";
	// Search for the text I want to insert.
	person.Relationship = relationship.Values.Where(t => t.Name == "and").First();
			
	person = buyer.Individual2;
	person.FirstName = "Jane";
	person.LastName = "Smith";
	// I already know the index for ", husband and wife" is 14.
	person.Relationship = relationship.Values[14];

	// Save new buyer to order.
	dynamic contacts = order["Contacts"];
	contacts.Add(buyer);
}
Bob Richards, Senior Software Developer, SoftPro
User avatar
uwdoug79
Posts: 78
Joined: Wed Aug 07, 2013 12:43 pm
Location: Earth
Contact:

Re: IBuyerSellerRelationship

Post by uwdoug79 »

Thanks Bob, That worked like a charm!

On a somewhat related question....

When setting the BuyerSellerType it operates a little differently and is it working for me

Code: Select all

                                            buyer.BuyerSellerType = BuyerSellerType.Organization;
Question is, when I set the value of this property, it seems to be automatically setting the value of IsIndividual to either Individual or Organization depending on the BuyerSellerType.?????? that I set the Type to. Is that a correct statement? Should I also be setting the value of buyer.IsIndividual to True/False based on the type of contact record being created? Currently I am only setting the value to Organization but I am going to be adding logic to set it to the other 7 org types (Limited Liability Corporation, ... Corp, Estate, etc) and want to make sure that the other options would operate similarly.
Doug Hamilton
CHICAGO TITLE
20825 SWENSON DR SUITE 300 WAUKESHA, WI 53186
P: 262-796-3808 F: 262-796-3888
EMAIL: Doug.Hamilton@fnf.com
www.wi.ctic.com | www.chicagoagent.com | www.etitle.ws
BobRichards
Posts: 1376
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: IBuyerSellerRelationship

Post by BobRichards »

Code: Select all

bool i = buyer.IsIndividual;
bool o = buyer.IsOrganization;
You do not have to initialize these properties. The framework handles these readonly properties for you. They are derived directly from the BuyerSellerType enum value.
Bob Richards, Senior Software Developer, SoftPro
Post Reply