19 neenan 1.1 </p>
20
21
22 <cfquery name="dorg" datasource="#programsdb#">
23 Select * from Organization where Orgid = #URL.Orgid#
24 </cfquery>
25
26 <cfquery name="InsertOrg" datasource="#programsdb#">
27 Insert Into dOrganization
28 (OrganizationName, Phone, Extension, Division, FaxNumber, TimeZone, Address1, EmailName, GeoServiceID, Address2, Hotline, City, StateOrProvince, URL, PostalCode, Country, GraphicURL, Profile)
29 Values ('#dorg.OrganizationName#',
30 '#dorg.Phone#',
31 '#dorg.Extension#',
32 '#dorg.Division#',
33 '#dorg.FaxNumber#',
34 '#dorg.TimeZone#',
35 '#dorg.Address1#',
36 '#dorg.EmailName#',
37 #dorg.GeoServiceID#,
38 '#dorg.Address2#',
39 '#dorg.Hotline#',
40 neenan 1.1 '#dorg.City#',
41 '#dorg.StateOrProvince#',
42 '#dorg.URL#',
43 '#dorg.PostalCode#',
44 '#dorg.Country#',
45 '#dorg.GraphicURL#',
46 '#dorg.Profile#'
47 )
48 </cfquery>
49
50 <cfquery name="getorgid" datasource="#programsdb#">
51 Select max(orgid) as maxid from dorganization
52 </cfquery>
53
54 <cfset maxorgid = getorgid.maxid>
55 <!--- Associating the dummy table from dcontacts table with the new orgID in the Contacts table - This query will get all the program type id's that have been
56 associated with the program type.--->
57
58 <cfquery name="getcontacts" datasource="#programsdb#">
59 Select * from contacts where Orgid = #URL.Orgid#
60 </cfquery>
61 neenan 1.1
62
63 <CFLOOP Query="getcontacts">
64
65 <CFQUERY NAME="insertcontacts" DATASOURCE="#programsdb#">
66 INSERT INTO dContacts(Prefix, FirstName, Middle, LastName, NameSuffix, Title, Primary, WorkPhone, WorkExtension, MobilePhone, FaxNumber, EmailName, Address, City, State, Zip, OrgID)
67 Values('#Prefix#','#FirstName#','#Middle#','#LastName#','#NameSuffix#','#Title#','#Primary#','#WorkPhone#','#WorkExtension#','#MobilePhone#','#FaxNumber#','#EmailName#','#Address#','#City#','#State#','#Zip#',#getorgid.maxid#)
68 </cfquery>
69 </CFLOOP>
70
71 <!--- Associating the program types to the organization - This query will get all the program type id's that have been
72 associated with the program type.--->
73
74 <cfquery name="getOrgProgtype" datasource="#programsdb#">
75 Select * from OrgtoProgramtype
76 where Orgid = #URL.Orgid#
77 </cfquery>
78
79 <cfset ProgList = ValueList(getOrgProgtype.ProgramTypeID)>
80 <cfset ProgTypeArray = ListToArray(ProgList)>
81
82 neenan 1.1 <cfif GetOrgProgType.recordcount is not 0>
83
84 <cfloop from="1" to="#ArrayLen(ProgTypeArray)#" index="x">
85 <cfquery datasource="#programsdb#">
86 Insert Into dOrgtoprogramtype (OrgID,ProgramTypeID)
87 Values(#getorgid.maxID#, #ProgTypeArray[x]#)
88 </cfquery>
89 </cfloop>
90 </cfif>
91
92 <!-- section for adding services and relate it to the organization --->
93 <cfquery name="getmaxserviceid" datasource="#programsdb#">
94 SELECT orgid, ServiceID
95 FROM OrgtoService
96 </cfquery>
97
98 <cfquery name="getService" datasource="#programsdb#">
99 SELECT orgid, ServiceID
100 FROM OrgtoService
101 WHERE Orgid=#URL.orgid# And serviceid Not in (select serviceid from service where approved=1);
102
103 neenan 1.1 </cfquery>
104
105 <cfset ServiceList = ValueList(getService.ServiceID)>
106 <cfset ServiceArray = ListToArray(ServiceList)>
107
108 <cfif getService.recordcount is not 0>
109 <cfloop from="1" to="#ArrayLen(ServiceArray)#" index="x">
110 <cfquery datasource="#programsdb#">
111 Insert Into dOrgtoService (OrgID, ServiceID)
112 Values(#getorgid.maxID#, #ServiceArray[x]#)
113 </cfquery>
114 </cfloop>
115 </cfif>
116 <!--- The Query below gets the new unapproved service names entered by the admin/online user and appends
117 the services and the links in the Service and OrgtoService Tables --->
118
119 <cfif #URL.fuseaction# is "editservices">
120
121 <cfquery name="getNewServices" datasource="#programsdb#">
122 SELECT ds.service,ds.type,ds.Approved, os.orgid
123 FROM Service AS ds, Orgtoservice AS os
124 neenan 1.1 WHERE os.Orgid=#URL.Orgid# and os.serviceid=ds.serviceid and ds.approved=0;
125 </cfquery>
126
127 <cfset NewServiceList = ValueList(getNewServices.Service)>
128 <cfset NewTypeList = ValueList(getNewServices.Type)>
129 <cfset NewServiceArray = ListToArray(NewServiceList)>
130 <cfset NewTypeArray = ListToArray(NewTypeList)>
131
132 <cfif getNewServices.recordcount is not 0>
133 <cfloop from="1" to="#ArrayLen(NewServiceArray)#" index="x">
134 <cfquery name="Addnewservice" datasource="#programsdb#">
135 Insert Into dService(Service,Type,Approved,CenterID)
136 Values('#NewServiceArray[x]#','#NewTypeArray[x]#',1,7)
137 </cfquery>
138 <cfquery name="getserviceid" datasource="#programsdb#">
139 Select max(serviceid) as maxserviceid from dService
140 </cfquery>
141 <cfquery name="link" datasource="#programsdb#">
142 Insert Into dOrgtoService (OrgID, ServiceID)
143 Values(#getorgid.maxID#, #getserviceid.maxserviceid#)
144 </cfquery>
145 neenan 1.1 </cfloop>
146 </cfif>
147
148 </cfif>
149
150 <!--- <cfoutput>
151 <input type="hidden" name="mainOrgId" value="URL.mainorgid">
152 <input type="hidden" name="orgid" value="#getorgid.maxid#">
153 </cfoutput>
154 --->
155
156
157 <CFIF #URL.fuseaction# IS "GETORG">
158 <cfquery name="provider1" datasource="#programsdb#">
159 SELECT *
160 FROM dOrganization
161 where orgID = #maxOrgID#
162 </cfquery>
163
|