|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| Question |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 238: 239: 240: 241: 242: 243: 244: 245: 246: 247: 248: 249: 250: 251: 252: 253: 254: 255: 256: 257: 258: |
flex app:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init()" xmlns:ns1="*" viewSourceURL="srcview/index.html" height="100%" borderStyle="none" width="100%">
<mx:RemoteObject id="ro" destination="ColdFusion" showBusyCursor="true" source="Media.components.Crud">
<mx:method name="getData" result="getDataResult(event)" />
<mx:method name="getcbData" result="getCBData(event)" />
<mx:method name="saveNewData" result="getDataResult(event)" />
<mx:method name="saveOldData" result="getDataResult(event)" />
<mx:method name="deleteData" result="getDataResult(event)" />
</mx:RemoteObject>
<mx:RemoteObject id="agency" destination="ColdFusion" showBusyCursor="true" source="Media.components.VideoProfessor.Agency2">
<mx:method name="getagencyData" result="getagencyData(event)" />
</mx:RemoteObject>
<mx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;
import mx.collections.ArrayCollection;
[Bindable] private var gridData:ArrayCollection;
[Bindable] private var cbData:Array;
[Bindable] private var agencyData:Array;
//on initialize, populate grid and combo boxes!
private function init():void{
ro.getData();
ro.getcbData();
agency.getagencyData();
}
private var isNew:Boolean = true;
public function getDataResult(e:ResultEvent):void{
dg.dataProvider = e.result as ArrayCollection;
makeNew();
}
private function getCBData(e:ResultEvent):void{
cbData = e.result as Array;
}
private function getagencyData(e:ResultEvent):void{
agencyData = e.result as Array;
}
private function makeNew():void{
firstNameFld.text = "";
lastNameFld.text = "";
officePhoneFld.text = "";
agencyId.text = "";
isNew = true;
}
private function save():void{
if(isNew){
ro.saveNewData(firstNameFld.text,lastNameFld.text,officePhoneFld.text,agencyId.text);
}else{
ro.saveOldData(firstNameFld.text,lastNameFld.text,officePhoneFld.text,agencyId.text,dg.selectedItem.id);
}
}
private function deleteData():void{
if(dg.selectedIndex > -1 )ro.deleteData(dg.selectedItem.id);
}
]]>
</mx:Script>
<mx:Label text="View your data below." width="1148" height="25" color="#FFFFFF" fontSize="12" fontFamily="Verdana" fontWeight="bold" id="toptext"/>
<mx:Panel width="1148" height="784" layout="absolute">
<mx:DataGrid dataProvider="{gridData}" x="10" y="10" width="1108" height="316" id="dg" change="isNew = false">
</mx:DataGrid>
<mx:Panel x="10" y="409" width="1108" height="286" layout="absolute">
<!-- fill with first names -->
<mx:FormItem label="First Name" id="firstnameLbl" x="10" y="70" width="266">
<ns1:comboBox id="firstNameFld" x="106" y="126" dataProvider="{cbData}" selectedValue="{dg.selectedItem.firstNameFld}"/>
</mx:FormItem>
<!-- fill with agency names -->
<mx:FormItem label="agency" id="agencyLbl" x="305" y="70" width="266">
<ns1:comboBox id="agencyId" x="106" y="126" dataProvider="{agencyData}" selectedValue="{dg.selectedItem.agencyId}"/>
</mx:FormItem>
<mx:FormItem label="Last Name" id="lastnameLbl" x="11" y="40">
<mx:TextInput id="lastNameFld" text="{dg.selectedItem.lastNameFld}"/>
</mx:FormItem>
<mx:FormItem label="Office Phone" id="officephoneLbl" x="305" y="40" width="266">
<mx:TextInput id="officePhoneFld" text="{dg.selectedItem.officePhoneFld}" width="176"/>
</mx:FormItem>
</mx:Panel>
<mx:Button x="10" y="712" label="Save Record" click="save()"/>
<mx:Button x="1011" y="712" label="Delete Record" click="deleteData()"/>
<mx:Button x="115" y="712" label="Add New Record" click="makeNew()"/>
<mx:Label x="105" y="334" text="Click on the record which will populate the fields below. After making your changes, click Save Record." width="1013" height="25" color="#990000" fontSize="11" fontFamily="Verdana" fontWeight="normal" id="midtext"/>
<mx:Label x="10" y="334" text="Edit A Record:" width="97" height="25" color="#990000" fontSize="11" fontFamily="Verdana" fontWeight="bold" id="midtext0"/>
<mx:Label x="130" y="355" text="Click Add New Record to clear all fields. Enter new data, then click Save Record." width="988" height="25" color="#990000" fontSize="11" fontFamily="Verdana" fontWeight="normal" id="midtext1"/>
<mx:Label x="10" y="355" text="Add New Record:" width="123" height="25" color="#990000" fontSize="11" fontFamily="Verdana" fontWeight="bold" id="midtext2"/>
<mx:Label x="115" y="376" text="Click on the record above. Then click Delete Record." width="1003" height="25" color="#990000" fontSize="11" fontFamily="Verdana" fontWeight="normal" id="midtext3"/>
<mx:Label x="10" y="376" text="Delete Record:" width="112" height="25" color="#990000" fontSize="11" fontFamily="Verdana" fontWeight="bold" id="midtext4"/>
</mx:Panel>
</mx:Application>
Crud.cfc:
<cfcomponent output="false">
<!--- get all data; populate in grid --->
<cffunction name="getData" access="remote" returntype="Query">
<cfset var local = {} />
<cfquery name="local.q" datasource="media">
select id, firstNameFld, lastNameFld, officePhoneFld, agencyId
from employees
</cfquery>
<cfreturn local.q/>
</cffunction>
<!--- get agencies; populate combo box --->
<cffunction name="getagencyData" access="remote" returntype="array">
<cfset local = {} />
<cfquery datasource="media" name="local.q">
select *
from agency
</cfquery>
<cfset local.result = arrayNew(1) />
<cfloop query="local.q">
<cfset local.temp = {} />
<cfset local.temp['data'] = local.q.agencyId />
<cfset local.temp['label'] = local.q.agency />
<cfset arrayAppend(local.result,local.temp) />
</cfloop>
<cfreturn local.result />
</cffunction>
<!--- get First Name; populate combo box --->
<cffunction name="getcbData" access="remote" returntype="array">
<cfset local = {} />
<cfquery datasource="media" name="local.q">
select firstNameFld
from employeesNames
</cfquery>
<cfset local.result = arrayNew(1) />
<cfloop query="local.q">
<cfset local.temp = {} />
<cfset local.temp['data'] = local.q.firstNameFld />
<cfset local.temp['label'] = local.q.firstNameFld />
<cfset arrayAppend(local.result,local.temp) />
</cfloop>
<cfreturn local.result />
</cffunction>
<!--- save new record --->
<cffunction name="saveNewData" access="remote" returntype="Query">
<cfargument name="firstNameFld" type="string" required="true"/>
<cfargument name="lastNameFld" type="string" required="true"/>
<cfargument name="officePhoneFld" type="string" required="true"/>
<cfargument name="agencyId" type="string" required="true"/>
<cfquery datasource="media">
insert
into employees
( firstNameFld, lastNameFld, officePhoneFld, agencyId)
values ( <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.firstNameFld#"/>,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.lastNameFld#"/>,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.officePhoneFld#"/>,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.agencyId#"/> )
</cfquery>
<cfreturn getData() />
</cffunction>
<!--- save existing record --->
<cffunction name="saveOldData" access="remote" returntype="Query">
<cfargument name="firstNameFld" type="string" required="true"/>
<cfargument name="lastNameFld" type="string" required="true"/>
<cfargument name="officePhoneFld" type="string" required="true"/>
<cfargument name="agencyId" type="string" required="true"/>
<cfargument name="id" type="Numeric" required="true" />
<cfquery datasource="media">
update employees
set firstNameFld = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.firstNameFld#" />,
lastNameFld = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.lastNameFld#" />,
officePhoneFld = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.officePhoneFld#" />,
agencyId = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.agencyId#" />
where id = <cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.id#" />
</cfquery>
<cfreturn getData() />
</cffunction>
<!--- delete record --->
<cffunction name="deleteData" access="remote" returntype="Query">
<cfargument name="id" type="string" required="true">
<cfquery datasource="media">
delete
from employees
where id = <cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.id#" />
</cfquery>
<cfreturn getData() />
</cffunction>
</cfcomponent>
Agency2.cfc:
<cfcomponent output="false">
<!--- get agencies; populate combo box --->
<cffunction name="getAgencyData" access="remote" returntype="array">
<cfset local = {} />
<cfquery datasource="media" name="local.q">
select *
from agency
</cfquery>
<cfset local.result = arrayNew(1) />
<cfloop query="local.q">
<cfset local.temp = {} />
<cfset local.temp['data'] = local.q.agencyId />
<cfset local.temp['label'] = local.q.agencyId />
<cfset arrayAppend(local.result,local.temp) />
</cfloop>
<cfreturn local.result />
</cffunction>
</cfcomponent>
|
Advertisement
| Hall of Fame |