I have a piece of code in a program which I think would be much better if 
placed into a CFC.


Just wondering what is the best approach to take.

Want to be able to handle success and fail transactions.

The code that I am looking at is shown below.

Regards

T






<cfparam name="selemailopt" default="">
            <cfif isDefined("form.MailList") AND form.MailList NEQ "">
                <cfset selemailopt = 'I'>
                        <cfelse>
                <cfset selemailopt = 'O'>
                        </cfif>
            
            <!--- Assumptions 
                        
                        Mobile  - is empty as this data is not collected
                        Title   - is empty as this data is not collected
                        Active  - is set to False until such time as the user 
has been approved
                        2696812 - is set to NSW by default although it could be 
set to #trim(form.state)#
                        
                        --->
        
                
                        <cfset CustParams = "FIRSTNAME|" & 
"#trim(form.FirstName)#" & CHR(31) 
                  & "LASTNAME|" &  "#trim(form.LastName)#" & CHR(31) 
                  & "EMAIL|" &  "#trim(form.Email)#" & CHR(31) 
                  & "MOBILE|" &  "" & CHR(31)
                                  & "TITLE|" & "" & CHR(31)
                                  & "EMAILOPT|" &  "#selemailopt#" & CHR(31)
                                  & "ACTIVE|" &  "F" & CHR(31)
                  & "PASSWORD|" &  "#trim(form.password)#" & CHR(31) 
                                  & "2969822|" &  "#trim(form.country)#" & 
CHR(31)
                                  & "2969812|" &  "#trim(form.state)#" & CHR(31)
                                  & "2969824|" &  "#trim(form.gender)#" & 
CHR(31)
                                  & "2969828|" &  "#trim(form.UserAge)#" & 
CHR(31)
                                  & "2969811|" & "#trim(form.fldPostLookup)#" & 
CHR(31)
                                  & "2969823|" & "#trim(form.postCode)#" & 
CHR(31)
                                  & "2969830|" & "#trim(form.fldPostLookup2)#" 
& CHR(31)
                                  & "2969831|" & "#trim(form.postCode2)#" & 
CHR(31)>
             
             <!--- <cfdump var="#form#">
             <cfdump var="#CustParams#">
             <cfabort>  --->    
                  
            <!--- Additional code to add new community member details to 
traction --->
    
            <cfhttp method="post" 
url="http://au.api.tractionplatform.com/ext/AddCustomer"; result="myTest">
                <cfhttpparam name="USERID" type="formfield" value="street1231">
                <cfhttpparam name="PASSWORD" type="formfield" value="asdh4523">
                <cfhttpparam name="ENDPOINTID" type="formfield" value="6906">
                <cfhttpparam name="MATCHKEY" type="formfield" value="E">
                <cfhttpparam name="MATCHVALUE" type="formfield" 
value="#form.Email#">
                <cfhttpparam name="CUSTOMER" type="formfield" 
value="#CustParams#">   
            </cfhttp>
             
             <!--- Get the return ResultCode (Trac-Result) --->
             
             <cfparam name="return_trac_result" default="">
             <cfset return_trac_result = #myTest.Responseheader['TRAC-Result']#>
             
             <CFQUERY DATASOURCE="#request.AppDS#">
             INSERT INTO SC_Trac_Results
             (TR_ResultCode,
              TR_CustParams,
              TR_Date)
              VALUES
             (#return_trac_result#,
              '#CustParams#',
              '#trim(form.CreateDate)#')
              </CFQUERY>
             
        
            <CFQUERY DATASOURCE="#request.AppDS#">
            INSERT INTO SC_Metro_Users
            (FirstName, 
            LastName, 
            suburbID, 
            Email, 
            <!---PhoneNumber, --->
            city,
            ZipCode, 
            country,
            gender,
            UserAge, 
            Login, 
            Password, 
            signature, 
            backnews, 
            mailList, 
            ThirdEmail, 
            TOS,  
            BizLogin, 
            BizNews, 
            Staff, 
            CreateDate, 
            FirstLogin, 
            HasPosted)
            VALUES 
            ('#trim(form.FirstName)#', 
            '#trim(form.LastName)#', 
            '#trim(request.suburbID)#', 
            '#trim(form.Email)#', 
            
<!---'#trim(form.PhoneNumber1)#-#trim(form.PhoneNumber2)#-#trim(form.PhoneNumber3)#',
 --->
            '#trim(form.fldPostLookup)#',
            '#trim(form.postCode)#',
            '#trim(form.country)#',
            '#trim(form.gender)#', 
            '#trim(form.UserAge)#', 
            '#trim(form.Login)#', 
            '#trim(form.Password)#', 
            '#trim(form.signature)#',
            '0',<!---<cfif isDefined("form.backnews") AND form.backnews NEQ 
"">'#trim(form.backnews)#',<cfelse>'0',</cfif> --->
            <cfif isDefined("form.MailList") AND form.MailList NEQ 
"">'#trim(form.mailList)#',<cfelse>'0',</cfif> 
            <cfif isDefined("form.ThirdEmail") AND form.ThirdEmail NEQ 
"">'#trim(form.ThirdEmail)#',<cfelse>'0',</cfif>
            <cfif isDefined("form.TOS") AND form.TOS NEQ 
"">'#trim(form.TOS)#',<cfelse>'0',</cfif>
            '0',
            '0', 
            '0', 
            '#trim(form.CreateDate)#', 
            '#trim(form.FirstLogin)#', 
            '0')
            </CFQUERY> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314594
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to